Commit 9bc85f97 by John Kessenich

Merge branch 'opsource-order' into 'master'

Reorder OpSource according to version 1. `OpSource` should be placed together with other debug instructions instead of at the beginning of the module (which is rev31 layout). See merge request !2
parents fac0d1c7 e7f36011
...@@ -2162,21 +2162,12 @@ void Builder::dump(std::vector<unsigned int>& out) const ...@@ -2162,21 +2162,12 @@ void Builder::dump(std::vector<unsigned int>& out) const
out.push_back(uniqueId + 1); out.push_back(uniqueId + 1);
out.push_back(0); out.push_back(0);
// First instructions, some created on the spot here:
if (source != SourceLanguageUnknown) {
Instruction sourceInst(0, 0, OpSource);
sourceInst.addImmediateOperand(source);
sourceInst.addImmediateOperand(sourceVersion);
sourceInst.dump(out);
}
for (int e = 0; e < (int)extensions.size(); ++e) { for (int e = 0; e < (int)extensions.size(); ++e) {
Instruction extInst(0, 0, OpSourceExtension); Instruction extInst(0, 0, OpSourceExtension);
extInst.addStringOperand(extensions[e]); extInst.addStringOperand(extensions[e]);
extInst.dump(out); extInst.dump(out);
} }
// TBD: OpExtension ...
// Capabilities // Capabilities
for (auto cap : capabilities) { for (auto cap : capabilities) {
Instruction capInst(0, 0, OpCapability); Instruction capInst(0, 0, OpCapability);
...@@ -2184,6 +2175,8 @@ void Builder::dump(std::vector<unsigned int>& out) const ...@@ -2184,6 +2175,8 @@ void Builder::dump(std::vector<unsigned int>& out) const
capInst.dump(out); capInst.dump(out);
} }
// TBD: OpExtension ...
dumpInstructions(out, imports); dumpInstructions(out, imports);
Instruction memInst(0, 0, OpMemoryModel); Instruction memInst(0, 0, OpMemoryModel);
memInst.addImmediateOperand(addressModel); memInst.addImmediateOperand(addressModel);
...@@ -2193,9 +2186,20 @@ void Builder::dump(std::vector<unsigned int>& out) const ...@@ -2193,9 +2186,20 @@ void Builder::dump(std::vector<unsigned int>& out) const
// Instructions saved up while building: // Instructions saved up while building:
dumpInstructions(out, entryPoints); dumpInstructions(out, entryPoints);
dumpInstructions(out, executionModes); dumpInstructions(out, executionModes);
// Debug instructions
if (source != SourceLanguageUnknown) {
Instruction sourceInst(0, 0, OpSource);
sourceInst.addImmediateOperand(source);
sourceInst.addImmediateOperand(sourceVersion);
sourceInst.dump(out);
}
dumpInstructions(out, names); dumpInstructions(out, names);
dumpInstructions(out, lines); dumpInstructions(out, lines);
// Annotation instructions
dumpInstructions(out, decorations); dumpInstructions(out, decorations);
dumpInstructions(out, constantsTypesGlobals); dumpInstructions(out, constantsTypesGlobals);
dumpInstructions(out, externals); dumpInstructions(out, externals);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment