class ParsedIR

Defined at line 39 of file ../../third_party/spirv-cross/src/spirv_cross_parsed_ir.hpp

This data structure holds all information needed to perform cross-compilation and reflection.

It is the output of the Parser, but any implementation could create this structure.

It is intentionally very "open" and struct-like with some helper functions to deal with decorations.

Parser is the reference implementation of how this data structure should be filled in.

Public Members

vector spirv
SmallVector ids
unordered_map meta
SmallVector<ID>[14] ids_for_type
SmallVector ids_for_constant_undef_or_type
SmallVector ids_for_constant_or_variable
unordered_map load_type_width
SmallVector declared_capabilities
SmallVector declared_extensions
SmallVector block_meta
unordered_map continue_block_to_loop_header
unordered_map entry_points
TypedID default_entry_point
Source source
AddressingModel addressing_model
MemoryModel memory_model

Public Methods

void ParsedIR ()
void ParsedIR (const ParsedIR & other)

Due to custom allocations from object pools, we cannot use a default copy constructor.

void ParsedIR (ParsedIR && other)

Moves are unproblematic, but we need to implement it anyways, since MSVC 2013 does not understand

how to default-implement these.

template <typename T, typename Op>
void for_each_typed_id (const Op & op)

Defined at line 187 of file ../../third_party/spirv-cross/src/spirv_cross_parsed_ir.hpp

template <typename T, typename Op>
void for_each_typed_id (const Op & op)

Defined at line 198 of file ../../third_party/spirv-cross/src/spirv_cross_parsed_ir.hpp

ParsedIR & operator= (const ParsedIR & other)
ParsedIR & operator= (ParsedIR && other)
void set_id_bounds (uint32_t bounds)

Resizes ids, meta and block_meta.

void set_name (ID id, const std::string & name)

Decoration handling methods.

Can be useful for simple "raw" reflection.

However, most members are here because the Parser needs most of these,

and might as well just have the whole suite of decoration/name handling in one place.

const std::string & get_name (ID id)
void set_decoration (ID id, spv::Decoration decoration, uint32_t argument)
void set_decoration_string (ID id, spv::Decoration decoration, const std::string & argument)
bool has_decoration (ID id, spv::Decoration decoration)
uint32_t get_decoration (ID id, spv::Decoration decoration)
const std::string & get_decoration_string (ID id, spv::Decoration decoration)
const Bitset & get_decoration_bitset (ID id)
const std::string & get_empty_string ()

Defined at line 219 of file ../../third_party/spirv-cross/src/spirv_cross_parsed_ir.hpp

void unset_decoration (ID id, spv::Decoration decoration)
void set_member_name (TypeID id, uint32_t index, const std::string & name)

Decoration handling methods (for members of a struct).

const std::string & get_member_name (TypeID id, uint32_t index)
void set_member_decoration (TypeID id, uint32_t index, spv::Decoration decoration, uint32_t argument)
void set_member_decoration_string (TypeID id, uint32_t index, spv::Decoration decoration, const std::string & argument)
uint32_t get_member_decoration (TypeID id, uint32_t index, spv::Decoration decoration)
const std::string & get_member_decoration_string (TypeID id, uint32_t index, spv::Decoration decoration)
bool has_member_decoration (TypeID id, uint32_t index, spv::Decoration decoration)
const Bitset & get_member_decoration_bitset (TypeID id, uint32_t index)
void mark_used_as_array_length (ID id)
uint32_t increase_bound_by (uint32_t count)
Bitset get_buffer_block_flags (const SPIRVariable & var)
Bitset get_buffer_block_type_flags (const SPIRType & type)
void add_typed_id (Types type, ID id)
void remove_typed_id (Types type, ID id)
LoopLock create_loop_hard_lock ()

If we have a hard lock, it is an error to call set

<

>(), and an exception is thrown.

If we have a soft lock, we silently ignore any additions to the typed arrays.

This should only be used for physical ID remapping where we need to create an ID, but we will never

care about iterating over them.

LoopLock create_loop_soft_lock ()
template <typename T>
void reset_all_of_type ()

Defined at line 209 of file ../../third_party/spirv-cross/src/spirv_cross_parsed_ir.hpp

void unset_member_decoration (TypeID id, uint32_t index, spv::Decoration decoration)
void reset_all_of_type (Types type)
Meta * find_meta (ID id)
const Meta * find_meta (ID id)
void make_constant_null (uint32_t id, uint32_t type, bool add_to_typed_id_set)
void fixup_reserved_names ()
void sanitize_underscores (std::string & str)
void sanitize_identifier (std::string & str, bool member, bool allow_reserved_prefixes)
bool is_globally_reserved_identifier (std::string & str, bool allow_reserved_prefixes)
uint32_t get_spirv_version ()

Enumerations

enum BlockMetaFlagBits
Name Value
BLOCK_META_LOOP_HEADER_BIT 1 << 0
BLOCK_META_CONTINUE_BIT 1 << 1
BLOCK_META_LOOP_MERGE_BIT 1 << 2
BLOCK_META_SELECTION_MERGE_BIT 1 << 3
BLOCK_META_MULTISELECT_MERGE_BIT 1 << 4

Meta data about blocks. The cross-compiler needs to query if a block is either of these types.

It is a bitset as there can be more than one tag per block.

Defined at line 95 of file ../../third_party/spirv-cross/src/spirv_cross_parsed_ir.hpp

Records