SPIRV: Add more utility functions to build some opcodes (#2398)
Add more builder functions to OpExecutionMode, OpExecutionModeId, OpDecorateString, OpMemberDecorateString. According to SPIR-V, OpExecutionMode and OpExecutionModeId could take variable extra operands. Current implementation doesn't support this and assumes at most 3 operands are extra operands. It is not true. Similarly, OpDecorateString and OpMemberDecorateString could support multiple strings either as literal strings or as string operands. Further, OpDecorate and OpDecorateId have the same problem, taking variable extra operands.
This commit is contained in:
@@ -321,13 +321,20 @@ public:
|
||||
// Methods for adding information outside the CFG.
|
||||
Instruction* addEntryPoint(ExecutionModel, Function*, const char* name);
|
||||
void addExecutionMode(Function*, ExecutionMode mode, int value1 = -1, int value2 = -1, int value3 = -1);
|
||||
void addExecutionMode(Function*, ExecutionMode mode, const std::vector<unsigned>& literals);
|
||||
void addExecutionModeId(Function*, ExecutionMode mode, const std::vector<Id>& operandIds);
|
||||
void addName(Id, const char* name);
|
||||
void addMemberName(Id, int member, const char* name);
|
||||
void addDecoration(Id, Decoration, int num = -1);
|
||||
void addDecoration(Id, Decoration, const char*);
|
||||
void addDecoration(Id, Decoration, const std::vector<unsigned>& literals);
|
||||
void addDecoration(Id, Decoration, const std::vector<const char*>& strings);
|
||||
void addDecorationId(Id id, Decoration, Id idDecoration);
|
||||
void addDecorationId(Id id, Decoration, const std::vector<Id>& operandIds);
|
||||
void addMemberDecoration(Id, unsigned int member, Decoration, int num = -1);
|
||||
void addMemberDecoration(Id, unsigned int member, Decoration, const char*);
|
||||
void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<unsigned>& literals);
|
||||
void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<const char*>& strings);
|
||||
|
||||
// At the end of what block do the next create*() instructions go?
|
||||
void setBuildPoint(Block* bp) { buildPoint = bp; }
|
||||
|
||||
Reference in New Issue
Block a user