diff options
author | Sean Callanan <scallanan@apple.com> | 2010-02-09 23:06:35 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2010-02-09 23:06:35 +0000 |
commit | d4b19e12ed6ec6a9c944c18ac3a21d76f5f3c22e (patch) | |
tree | f28c6946a2d3184f9ed40e6073c78ae184c5c81f /llvm/utils | |
parent | c6ee3766928fa392797cb7be64cd714ffca09080 (diff) | |
download | bcm5719-llvm-d4b19e12ed6ec6a9c944c18ac3a21d76f5f3c22e.tar.gz bcm5719-llvm-d4b19e12ed6ec6a9c944c18ac3a21d76f5f3c22e.zip |
Fixed some indentation in the AsmWriterInst
implementation. Also changed the constructor
so that it does not require a Record, making it
usable by the EDEmitter.
llvm-svn: 95715
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 6 | ||||
-rw-r--r-- | llvm/utils/TableGen/AsmWriterInst.cpp | 24 | ||||
-rw-r--r-- | llvm/utils/TableGen/AsmWriterInst.h | 5 | ||||
-rw-r--r-- | llvm/utils/TableGen/EDEmitter.cpp | 1 |
4 files changed, 22 insertions, 14 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 07666b0f69d..143a2f700fd 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -256,7 +256,11 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) { E = Target.inst_end(); I != E; ++I) if (!I->second.AsmString.empty() && I->second.TheDef->getName() != "PHI") - Instructions.push_back(AsmWriterInst(I->second, AsmWriter)); + Instructions.push_back( + AsmWriterInst(I->second, + AsmWriter->getValueAsInt("Variant"), + AsmWriter->getValueAsInt("FirstOperandColumn"), + AsmWriter->getValueAsInt("OperandSpacing"))); // Get the instruction numbering. Target.getInstructionsByEnumValue(NumberedInstructions); diff --git a/llvm/utils/TableGen/AsmWriterInst.cpp b/llvm/utils/TableGen/AsmWriterInst.cpp index 2b7a2144eee..ccf39c4c9a7 100644 --- a/llvm/utils/TableGen/AsmWriterInst.cpp +++ b/llvm/utils/TableGen/AsmWriterInst.cpp @@ -46,13 +46,12 @@ std::string AsmWriterOperand::getCode() const { /// ParseAsmString - Parse the specified Instruction's AsmString into this /// AsmWriterInst. /// -AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { +AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, + unsigned Variant, + int FirstOperandColumn, + int OperandSpacing) { this->CGI = &CGI; - unsigned Variant = AsmWriter->getValueAsInt("Variant"); - int FirstOperandColumn = AsmWriter->getValueAsInt("FirstOperandColumn"); - int OperandSpacing = AsmWriter->getValueAsInt("OperandSpacing"); - unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} region, other #. // This is the number of tabs we've seen if we're doing columnar layout. @@ -88,9 +87,10 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { unsigned DestColumn = FirstOperandColumn + CurColumn++ * OperandSpacing; Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + - utostr(DestColumn) + ");\n", - AsmWriterOperand::isLiteralStatementOperand)); + AsmWriterOperand( + "O.PadToColumn(" + + utostr(DestColumn) + ");\n", + AsmWriterOperand::isLiteralStatementOperand)); } break; case '"': @@ -123,8 +123,8 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { unsigned DestColumn = FirstOperandColumn + CurColumn++ * OperandSpacing; Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", - AsmWriterOperand::isLiteralStatementOperand)); + AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", + AsmWriterOperand::isLiteralStatementOperand)); break; } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) != std::string::npos) { @@ -236,7 +236,7 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { } Operands.push_back(AsmWriterOperand("return;", - AsmWriterOperand::isLiteralStatementOperand)); + AsmWriterOperand::isLiteralStatementOperand)); } /// MatchesAllButOneOp - If this instruction is exactly identical to the @@ -256,4 +256,4 @@ unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other)const{ } } return MismatchOperand; -}
\ No newline at end of file +} diff --git a/llvm/utils/TableGen/AsmWriterInst.h b/llvm/utils/TableGen/AsmWriterInst.h index 7ea69ce27bd..5a8cf7708bd 100644 --- a/llvm/utils/TableGen/AsmWriterInst.h +++ b/llvm/utils/TableGen/AsmWriterInst.h @@ -81,7 +81,10 @@ namespace llvm { std::vector<AsmWriterOperand> Operands; const CodeGenInstruction *CGI; - AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter); + AsmWriterInst(const CodeGenInstruction &CGI, + unsigned Variant, + int FirstOperandColumn, + int OperandSpacing); /// MatchesAllButOneOp - If this instruction is exactly identical to the /// specified instruction except for one differing operand, return the diff --git a/llvm/utils/TableGen/EDEmitter.cpp b/llvm/utils/TableGen/EDEmitter.cpp index f428a20479d..6bbe4d9c529 100644 --- a/llvm/utils/TableGen/EDEmitter.cpp +++ b/llvm/utils/TableGen/EDEmitter.cpp @@ -15,6 +15,7 @@ #include "EDEmitter.h" +#include "AsmWriterInst.h" #include "CodeGenTarget.h" #include "Record.h" |