summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEgor Churaev <echuraev@users.noreply.github.com>2016-09-29 17:21:29 +0300
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2016-09-29 10:21:29 -0400
commit12ecce2137079faa896e1a999a0a2085585b7dfd (patch)
tree5a60c3b4b7f357acce00e5fe201973168c4b0899 /lib
parentad489aff2bcca760bfcce432824db4c48b1c2714 (diff)
OpVariable in OpSpecConstantOp. (#186)
* Fixed problem with OpSpecConstantOp. In one of last change of spirv spec was added following change: "Public SPIRV-Headers issues #12 and #13 and Khronos SPIR-V issue #65: Allow OpVariable as an initializer for another OpVariable instruction or the Base of an OpSpecConstantOp with an AccessChain opcode." In this way, OpVariable can be initialize before OpSpecConstantOp. To do this, it's necessary add OpSpecConstantOp in one container with OpVariable in TopologicalSort. After this change, OpSpecConstantOp and OpVariable instructions will be add to spirv file in the right order. * Renamed InstructionVec to ConstAndVarVec and fixed indentation
Diffstat (limited to 'lib')
-rw-r--r--lib/SPIRV/libSPIRV/SPIRVModule.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/SPIRV/libSPIRV/SPIRVModule.cpp b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
index 3aaf8af..1b6c2fd 100644
--- a/lib/SPIRV/libSPIRV/SPIRVModule.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
@@ -1225,6 +1225,7 @@ class TopologicalSort {
typedef std::vector<SPIRVType *> SPIRVTypeVec;
typedef std::vector<SPIRVValue *> SPIRVConstantVector;
typedef std::vector<SPIRVVariable *> SPIRVVariableVec;
+ typedef std::vector<SPIRVEntry *> SPIRVConstAndVarVec;
typedef std::vector<SPIRVTypeForwardPointer *> SPIRVForwardPointerVec;
typedef std::function<bool(SPIRVEntry*, SPIRVEntry*)> IdComp;
typedef std::map<SPIRVEntry*, DFSState, IdComp> EntryStateMapTy;
@@ -1232,8 +1233,7 @@ class TopologicalSort {
SPIRVTypeVec TypeIntVec;
SPIRVConstantVector ConstIntVec;
SPIRVTypeVec TypeVec;
- SPIRVConstantVector ConstVec;
- SPIRVVariableVec VariableVec;
+ SPIRVConstAndVarVec ConstAndVarVec;
const SPIRVForwardPointerVec& ForwardPointerVec;
EntryStateMapTy EntryStateMap;
@@ -1269,11 +1269,11 @@ class TopologicalSort {
if (C->getType()->isTypeInt())
ConstIntVec.push_back(C);
else
- ConstVec.push_back(C);
+ ConstAndVarVec.push_back(E);
} else if (isTypeOpCode(OC))
TypeVec.push_back(static_cast<SPIRVType*>(E));
- else if (E->isVariable())
- VariableVec.push_back(static_cast<SPIRVVariable*>(E));
+ else
+ ConstAndVarVec.push_back(E);
}
public:
TopologicalSort(const SPIRVTypeVec &_TypeVec,
@@ -1303,8 +1303,7 @@ operator<< (spv_ostream &O, const TopologicalSort &S) {
O << S.TypeIntVec
<< S.ConstIntVec
<< S.TypeVec
- << S.ConstVec
- << S.VariableVec;
+ << S.ConstAndVarVec;
return O;
}