mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-11 09:00:06 +00:00
Add various accessors needed to read and edit SPIRV code.
This commit is contained in:
parent
7fe8a57a5b
commit
b85997a1df
@ -44,6 +44,8 @@ class BasicBlock {
|
||||
void SetParent(Function* function) { function_ = function; }
|
||||
// Appends an instruction to this basic block.
|
||||
inline void AddInstruction(std::unique_ptr<Instruction> i);
|
||||
// The label starting this basic block.
|
||||
Instruction& Label() { return *label_; }
|
||||
|
||||
iterator begin() { return iterator(&insts_, insts_.begin()); }
|
||||
iterator end() { return iterator(&insts_, insts_.end()); }
|
||||
|
@ -38,6 +38,8 @@ class Function {
|
||||
// Creates a function instance declared by the given OpFunction instruction
|
||||
// |def_inst|.
|
||||
inline explicit Function(std::unique_ptr<Instruction> def_inst);
|
||||
// The OpFunction instruction that begins the definition of this function.
|
||||
Instruction& DefInst() { return *def_inst_; }
|
||||
|
||||
// Sets the enclosing module for this function.
|
||||
void SetParent(Module* module) { module_ = module; }
|
||||
|
@ -52,6 +52,8 @@ class Module {
|
||||
void SetHeader(const ModuleHeader& header) { header_ = header; }
|
||||
// Sets the Id bound.
|
||||
void SetIdBound(uint32_t bound) { header_.bound = bound; }
|
||||
// Returns the Id bound.
|
||||
uint32_t IdBound() { return header_.bound; }
|
||||
// Appends a capability instruction to this module.
|
||||
inline void AddCapability(std::unique_ptr<Instruction> c);
|
||||
// Appends an extension instruction to this module.
|
||||
|
@ -231,6 +231,7 @@ class Array : public Type {
|
||||
bool IsSame(Type* that) const override;
|
||||
std::string str() const override;
|
||||
const Type* element_type() const { return element_type_; }
|
||||
uint32_t LengthId() const { return length_id_; }
|
||||
|
||||
Array* AsArray() override { return this; }
|
||||
const Array* AsArray() const override { return this; }
|
||||
@ -265,6 +266,7 @@ class Struct : public Type {
|
||||
|
||||
bool IsSame(Type* that) const override;
|
||||
std::string str() const override;
|
||||
const std::vector<Type*>& element_types() const { return element_types_; }
|
||||
bool decoration_empty() const override {
|
||||
return decorations_.empty() && element_decorations_.empty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user