Changed AsmWriterOperand to also include the index of the

operand into the CodeGenInstruction's list of operands,
which is useful for EDEmitter.  (Still working on PR6219)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95759 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sean Callanan 2010-02-10 02:27:43 +00:00
parent 046632f272
commit 397170b0ab
2 changed files with 15 additions and 4 deletions

View File

@ -219,7 +219,10 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI,
if (VarName.empty()) { if (VarName.empty()) {
// Just a modifier, pass this into PrintSpecial. // Just a modifier, pass this into PrintSpecial.
Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, Modifier)); Operands.push_back(AsmWriterOperand("PrintSpecial",
~0U,
~0U,
Modifier));
} else { } else {
// Otherwise, normal operand. // Otherwise, normal operand.
unsigned OpNo = CGI.getOperandNamed(VarName); unsigned OpNo = CGI.getOperandNamed(VarName);
@ -227,7 +230,9 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI,
if (CurVariant == Variant || CurVariant == ~0U) { if (CurVariant == Variant || CurVariant == ~0U) {
unsigned MIOp = OpInfo.MIOperandNo; unsigned MIOp = OpInfo.MIOperandNo;
Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName,
OpNo,
MIOp,
Modifier)); Modifier));
} }
} }

View File

@ -41,6 +41,10 @@ namespace llvm {
/// into the asm writer. /// into the asm writer.
std::string Str; std::string Str;
/// CGIOpNo - For isMachineInstrOperand, this is the index of the operand in
/// the CodeGenInstruction.
unsigned CGIOpNo;
/// MiOpNo - For isMachineInstrOperand, this is the operand number of the /// MiOpNo - For isMachineInstrOperand, this is the operand number of the
/// machine instruction. /// machine instruction.
unsigned MIOpNo; unsigned MIOpNo;
@ -56,10 +60,12 @@ namespace llvm {
OpType op = isLiteralTextOperand) OpType op = isLiteralTextOperand)
: OperandType(op), Str(LitStr) {} : OperandType(op), Str(LitStr) {}
AsmWriterOperand(const std::string &Printer, unsigned OpNo, AsmWriterOperand(const std::string &Printer,
unsigned _CGIOpNo,
unsigned _MIOpNo,
const std::string &Modifier, const std::string &Modifier,
OpType op = isMachineInstrOperand) OpType op = isMachineInstrOperand)
: OperandType(op), Str(Printer), MIOpNo(OpNo), : OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo),
MiModifier(Modifier) {} MiModifier(Modifier) {}
bool operator!=(const AsmWriterOperand &Other) const { bool operator!=(const AsmWriterOperand &Other) const {