X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FAsmWriterInst.h;h=a597e6ba1a558528cd116d2c7d7ccfd7c93aa596;hb=47f0e3f434e2e43f951c3a826c40906cb15b7285;hp=5a8cf7708bd3fd4fb73e34fb5814165e8b3827b0;hpb=d0bc7f060ece77c670794ef60f7052e2ff1847c9;p=oota-llvm.git diff --git a/utils/TableGen/AsmWriterInst.h b/utils/TableGen/AsmWriterInst.h index 5a8cf7708bd..a597e6ba1a5 100644 --- a/utils/TableGen/AsmWriterInst.h +++ b/utils/TableGen/AsmWriterInst.h @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#ifndef ASMWRITER_INST_H -#define ASMWRITER_INST_H +#ifndef LLVM_UTILS_TABLEGEN_ASMWRITERINST_H +#define LLVM_UTILS_TABLEGEN_ASMWRITERINST_H #include #include @@ -23,45 +23,57 @@ namespace llvm { class CodeGenInstruction; class Record; - + struct AsmWriterOperand { enum OpType { // Output this text surrounded by quotes to the asm. - isLiteralTextOperand, + isLiteralTextOperand, // This is the name of a routine to call to print the operand. isMachineInstrOperand, // Output this text verbatim to the asm writer. It is code that // will output some text to the asm. isLiteralStatementOperand } OperandType; - + /// Str - For isLiteralTextOperand, this IS the literal text. For /// isMachineInstrOperand, this is the PrinterMethodName for the operand.. - /// For isLiteralStatementOperand, this is the code to insert verbatim + /// For isLiteralStatementOperand, this is the code to insert verbatim /// into the asm writer. 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 /// machine instruction. unsigned MIOpNo; - + /// MiModifier - For isMachineInstrOperand, this is the modifier string for /// an operand, specified with syntax like ${opname:modifier}. std::string MiModifier; - + + // PassSubtarget - Pass MCSubtargetInfo to the print method if this is + // equal to 1. + // FIXME: Remove after all ports are updated. + unsigned PassSubtarget; + // To make VS STL happy AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {} - + AsmWriterOperand(const std::string &LitStr, OpType op = isLiteralTextOperand) : OperandType(op), Str(LitStr) {} - - AsmWriterOperand(const std::string &Printer, unsigned OpNo, + + AsmWriterOperand(const std::string &Printer, + unsigned _CGIOpNo, + unsigned _MIOpNo, const std::string &Modifier, - OpType op = isMachineInstrOperand) - : OperandType(op), Str(Printer), MIOpNo(OpNo), - MiModifier(Modifier) {} - + unsigned PassSubtarget, + OpType op = isMachineInstrOperand) + : OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo), + MiModifier(Modifier), PassSubtarget(PassSubtarget) {} + bool operator!=(const AsmWriterOperand &Other) const { if (OperandType != Other.OperandType || Str != Other.Str) return true; if (OperandType == isMachineInstrOperand) @@ -71,26 +83,24 @@ namespace llvm { bool operator==(const AsmWriterOperand &Other) const { return !operator!=(Other); } - + /// getCode - Return the code that prints this operand. std::string getCode() const; }; - + class AsmWriterInst { public: std::vector Operands; const CodeGenInstruction *CGI; - - AsmWriterInst(const CodeGenInstruction &CGI, - unsigned Variant, - int FirstOperandColumn, - int OperandSpacing); - + + AsmWriterInst(const CodeGenInstruction &CGI, + unsigned Variant, unsigned PassSubtarget); + /// MatchesAllButOneOp - If this instruction is exactly identical to the /// specified instruction except for one differing operand, return the /// differing operand number. Otherwise return ~0. unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; - + private: void AddLiteralString(const std::string &Str) { // If the last operand was already a literal text string, append this to