aboutsummaryrefslogtreecommitdiff
path: root/source/opt/module.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/opt/module.h')
-rw-r--r--source/opt/module.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/opt/module.h b/source/opt/module.h
index 37d49025..e29615fc 100644
--- a/source/opt/module.h
+++ b/source/opt/module.h
@@ -112,6 +112,10 @@ class Module {
IteratorRange<inst_iterator> annotations();
IteratorRange<const_inst_iterator> annotations() const;
+ // Iterators for extension instructions contained in this module.
+ IteratorRange<inst_iterator> extensions();
+ IteratorRange<const_inst_iterator> extensions() const;
+
// Iterators for types, constants and global variables instructions.
inline inst_iterator types_values_begin();
inline inst_iterator types_values_end();
@@ -141,6 +145,10 @@ class Module {
// Returns true if module has capability |cap|
bool HasCapability(uint32_t cap);
+ // Returns id for OpExtInst instruction for extension |extstr|.
+ // Returns 0 if not found.
+ uint32_t GetExtInstImportId(const char* extstr);
+
private:
ModuleHeader header_; // Module header
@@ -235,6 +243,14 @@ inline IteratorRange<Module::const_inst_iterator> Module::annotations() const {
return make_const_range(annotations_);
}
+inline IteratorRange<Module::inst_iterator> Module::extensions() {
+ return make_range(extensions_);
+}
+
+inline IteratorRange<Module::const_inst_iterator> Module::extensions() const {
+ return make_const_range(extensions_);
+}
+
inline Module::inst_iterator Module::types_values_begin() {
return inst_iterator(&types_values_, types_values_.begin());
}