the name field of instructions is never set to a non-empty string,
authorChris Lattner <sabre@nondot.org>
Mon, 7 Jan 2008 04:57:31 +0000 (04:57 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 7 Jan 2008 04:57:31 +0000 (04:57 +0000)
just unconditionally use the def name of the instruction.

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

utils/TableGen/CodeGenInstruction.cpp
utils/TableGen/CodeGenInstruction.h
utils/TableGen/InstrInfoEmitter.cpp

index 4d8693777dfedf14838fd2f5a92fdd63c6f2d29b..ea01d1b0e29a1c6e151a61e18783c2745693806c 100644 (file)
@@ -76,7 +76,6 @@ static void ParseConstraints(const std::string &CStr, CodeGenInstruction *I) {
 
 CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
   : TheDef(R), AsmString(AsmStr) {
-  Name      = R->getValueAsString("Name");
   Namespace = R->getValueAsString("Namespace");
 
   isReturn     = R->getValueAsBit("isReturn");
@@ -214,14 +213,6 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
   }
 }
 
-/// getName - Return the contents of the instruction Name field if set,
-/// otherwise return the name of the def.
-std::string CodeGenInstruction::getName() const {
-  if (!Name.empty()) return Name;
-  return TheDef->getName();
-}
-
-
 /// getOperandNamed - Return the index of the operand with the specified
 /// non-empty name.  If the instruction does not have an operand with the
 /// specified name, throw an exception.
index 5c435524f43393cbb51c4c7421e8731ee8bb24f5..351a880165f4b254ea878e81cdbec88ee87ca793 100644 (file)
@@ -26,17 +26,12 @@ namespace llvm {
   class CodeGenInstruction {
   public:
     Record *TheDef;            // The actual record defining this instruction.
-    std::string Name;          // Contents of the 'Name' field.
     std::string Namespace;     // The namespace the instruction is in.
 
     /// AsmString - The format string used to emit a .s file for the
     /// instruction.
     std::string AsmString;
     
-    /// getName - Return the contents of the instruction Name field if set,
-    /// otherwise return the name of the def.
-    std::string getName() const;
-    
     /// OperandInfo - The information we keep track of for each operand in the
     /// operand list for a tablegen instruction.
     struct OperandInfo {
index 6d08b20f3a8f66af33b5815f544bcc6241fa8423..40dd1f023e69ce53ffe8620d3e40089b5315771d 100644 (file)
@@ -205,7 +205,7 @@ void InstrInfoEmitter::InferFromPattern(const CodeGenInstruction &Inst,
       fprintf(stderr, 
               "Warning: mayStore flag explicitly set on instruction '%s'"
               " but flag already inferred from pattern.\n", 
-              Inst.getName().c_str());
+              Inst.TheDef->getName().c_str());
     mayStore = true;
   }
 
@@ -285,7 +285,7 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
   InferFromPattern(Inst, mayStore, isLoad, NeverHasSideEffects);
   
   if (NeverHasSideEffects && Inst.mayHaveSideEffects) {
-    std::cerr << "error: Instruction '" << Inst.getName()
+    std::cerr << "error: Instruction '" << Inst.TheDef->getName()
       << "' is marked with 'mayHaveSideEffects', but it can never have them!\n";
     exit(1);
   }
@@ -298,7 +298,7 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
   
   OS << "  { ";
   OS << Num << ",\t" << MinOperands << ",\t"
-     << Inst.NumDefs << ",\t\"" << Inst.getName();
+     << Inst.NumDefs << ",\t\"" << Inst.TheDef->getName();
   OS << "\",\t" << getItinClassNumber(Inst.TheDef) << ", 0";
 
   // Emit all of the target indepedent flags...