Fixed some indentation in the AsmWriterInst
authorSean Callanan <scallanan@apple.com>
Tue, 9 Feb 2010 23:06:35 +0000 (23:06 +0000)
committerSean Callanan <scallanan@apple.com>
Tue, 9 Feb 2010 23:06:35 +0000 (23:06 +0000)
implementation.  Also changed the constructor
so that it does not require a Record, making it
usable by the EDEmitter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95715 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmWriterEmitter.cpp
utils/TableGen/AsmWriterInst.cpp
utils/TableGen/AsmWriterInst.h
utils/TableGen/EDEmitter.cpp

index 07666b0f69dbcb679b0f774b89d5404229b6db21..143a2f700fdba944cb5a14cc09fb155c4de7a135 100644 (file)
@@ -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);
index 2b7a2144eeee4eb8b5c44c209a0fb144d42ecd76..ccf39c4c9a74c12618ee6377ef0a60a0cf3a1c48 100644 (file)
@@ -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
+}
index 7ea69ce27bd09cfed76ab62e103fb317e6fc3807..5a8cf7708bd3fd4fb73e34fb5814165e8b3827b0 100644 (file)
@@ -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
index f428a20479d54aea2553c2de600a8663c18d80a3..6bbe4d9c529759db552ee233d6cc63c62085a5c3 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "EDEmitter.h"
 
+#include "AsmWriterInst.h"
 #include "CodeGenTarget.h"
 #include "Record.h"