[ir] Add Property enum to Module The capabilities from `ir::Capability` will be migrated over to this new enum. Bug: 512904070 Change-Id: I41fd6e14db6ea4b09c0f1f53b2e1ae452cd4aaf5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/311666 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/core/ir/module.h b/src/tint/lang/core/ir/module.h index 62d4b3e..25f49c0 100644 --- a/src/tint/lang/core/ir/module.h +++ b/src/tint/lang/core/ir/module.h
@@ -37,6 +37,7 @@ #include "src/tint/lang/core/ir/instruction.h" #include "src/tint/lang/core/ir/value.h" #include "src/tint/lang/core/type/manager.h" +#include "src/tint/utils/containers/enum_set.h" #include "src/tint/utils/containers/filtered_iterator.h" #include "src/tint/utils/containers/vector.h" #include "src/tint/utils/diagnostic/source.h" @@ -51,6 +52,14 @@ #define TINT_IR_UNIMPLEMENTED(module) TINT_UNIMPLEMENTED(module.ice_callback) #define TINT_IR_ASSERT(module, condition) TINT_ASSERT((condition), module.ice_callback) +/// Enumerator of IR properties which can either add or subtract functionality from the core IR. +/// The IR validator will reject use of any non-core IR functionality when the module does not +/// contain the corresponding property. +enum class Property : uint8_t {}; + +/// Properties is a set of Property values. +using Properties = EnumSet<Property>; + /// Main module class for the IR. class Module { /// Map of value to name @@ -183,6 +192,9 @@ /// @param func the function to destroy void Destroy(Function* func); + /// The set of properties used by the module. + Properties properties; + /// The block allocator BlockAllocator<Block> blocks;
diff --git a/src/tint/lang/core/ir/validator.h b/src/tint/lang/core/ir/validator.h index 0533977..fcfae95 100644 --- a/src/tint/lang/core/ir/validator.h +++ b/src/tint/lang/core/ir/validator.h
@@ -41,6 +41,7 @@ namespace tint::core::ir { /// Enumerator of optional IR capabilities. +/// TODO(crbug.com/512904070): Remove this when transition to properties is complete. enum class Capability : uint8_t { /// Allows 8-bit integer types. kAllow8BitIntegers,