[llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Sep 4 19:12:19 PDT 2006



Changes in directory llvm/utils/TableGen:

AsmWriterEmitter.cpp updated: 1.40 -> 1.41
---
Log message:

Fix a long-standing wart in the code generator: two-address instruction lowering
actually *removes* one of the operands, instead of just assigning both operands
the same register.  This make reasoning about instructions unnecessarily complex,
because you need to know if you are before or after register allocation to match
up operand #'s with the target description file.

Changing this also gets rid of a bunch of hacky code in various places.

This patch also includes changes to fold loads into cmp/test instructions in
the X86 backend, along with a significant simplification to the X86 spill 
folding code.


---
Diffs of the changes:  (+5 -8)

 AsmWriterEmitter.cpp |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)


Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.40 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.41
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.40	Tue Jul 18 20:39:06 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp	Mon Sep  4 21:12:02 2006
@@ -211,15 +211,12 @@
       unsigned OpNo = CGI.getOperandNamed(VarName);
       CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo];
 
-      // If this is a two-address instruction and we are not accessing the
-      // 0th operand, remove an operand.
+      // If this is a two-address instruction, verify the second operand isn't
+      // used.
       unsigned MIOp = OpInfo.MIOperandNo;
-      if (CGI.isTwoAddress && MIOp != 0) {
-        if (MIOp == 1)
-          throw "Should refer to operand #0 instead of #1 for two-address"
-            " instruction '" + CGI.TheDef->getName() + "'!";
-        --MIOp;
-      }
+      if (CGI.isTwoAddress && MIOp == 1)
+        throw "Should refer to operand #0 instead of #1 for two-address"
+              " instruction '" + CGI.TheDef->getName() + "'!";
 
       if (CurVariant == Variant || CurVariant == ~0U) 
         Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp,






More information about the llvm-commits mailing list