diff options
author | Tim Northover <tnorthover@apple.com> | 2017-03-20 21:58:23 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2017-03-20 21:58:23 +0000 |
commit | 4340d64f916c95dcfec1159ebab3d9d1b278a8d8 (patch) | |
tree | 7b7ccc16b124cd11cd68c08caff09778330c06fc /llvm/utils/TableGen/GlobalISelEmitter.cpp | |
parent | 3cbce5d278b1dd8a50073ea81b2acaeba892cc2e (diff) | |
download | bcm5719-llvm-4340d64f916c95dcfec1159ebab3d9d1b278a8d8.tar.gz bcm5719-llvm-4340d64f916c95dcfec1159ebab3d9d1b278a8d8.zip |
GlobalISel: add implicit defs & uses when mutating an instruction.
Otherwise a scheduler might do bad things to the code we produce.
llvm-svn: 298311
Diffstat (limited to 'llvm/utils/TableGen/GlobalISelEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/GlobalISelEmitter.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 596cd3cddb9..169dd32daa6 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -835,8 +835,25 @@ public: void emitCxxActionStmts(raw_ostream &OS, RuleMatcher &Rule, StringRef RecycleVarName) const override { if (canMutate()) { - OS << RecycleVarName << ".setDesc(TII.get(" << I->Namespace + OS << " " << RecycleVarName << ".setDesc(TII.get(" << I->Namespace << "::" << I->TheDef->getName() << "));\n"; + + if (!I->ImplicitDefs.empty() || !I->ImplicitUses.empty()) { + OS << " auto MIB = MachineInstrBuilder(MF, &" << RecycleVarName + << ");\n"; + + for (auto Def : I->ImplicitDefs) { + auto Namespace = Def->getValueAsString("Namespace"); + OS << " MIB.addDef(" << Namespace << "::" << Def->getName() + << ", RegState::Implicit);\n"; + } + for (auto Use : I->ImplicitUses) { + auto Namespace = Use->getValueAsString("Namespace"); + OS << " MIB.addUse(" << Namespace << "::" << Use->getName() + << ", RegState::Implicit);\n"; + } + } + OS << " MachineInstr &NewI = " << RecycleVarName << ";\n"; return; } |