Propagate MCSubtargetInfo through TableGen's getBinaryCodeForInstr()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200349 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Woodhouse
2014-01-28 23:13:18 +00:00
parent 2ddea4b44d
commit 4faa861f19
10 changed files with 555 additions and 315 deletions

View File

@@ -122,14 +122,14 @@ AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName,
Case += " // op: " + VarName + "\n" +
" op = " + EncoderMethodName + "(MI, " + utostr(OpIdx);
if (MCEmitter)
Case += ", Fixups";
Case += ", Fixups, STI";
Case += ");\n";
}
} else {
Case += " // op: " + VarName + "\n" +
" op = getMachineOpValue(MI, MI.getOperand(" + utostr(OpIdx) + ")";
if (MCEmitter)
Case += ", Fixups";
Case += ", Fixups, STI";
Case += ");\n";
}
@@ -192,8 +192,12 @@ std::string CodeEmitterGen::getInstructionCase(Record *R,
}
std::string PostEmitter = R->getValueAsString("PostEncoderMethod");
if (!PostEmitter.empty())
Case += " Value = " + PostEmitter + "(MI, Value);\n";
if (!PostEmitter.empty()) {
Case += " Value = " + PostEmitter + "(MI, Value";
if (MCEmitter)
Case += ", STI";
Case += ");\n";
}
return Case;
}
@@ -212,7 +216,8 @@ void CodeEmitterGen::run(raw_ostream &o) {
o << "uint64_t " << Target.getName();
if (MCEmitter)
o << "MCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,\n"
<< " SmallVectorImpl<MCFixup> &Fixups) const {\n";
<< " SmallVectorImpl<MCFixup> &Fixups,\n"
<< " const MCSubtargetInfo &STI) const {\n";
else
o << "CodeEmitter::getBinaryCodeForInstr(const MachineInstr &MI) const {\n";