summaryrefslogtreecommitdiff
path: root/utils/TableGen/AsmWriterEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-05 02:12:02 +0000
committerChris Lattner <sabre@nondot.org>2006-09-05 02:12:02 +0000
commit2926869b4a083fc951484de03a9867eabf81e880 (patch)
treed5a3563e0fd5e35bed241a405a34af2bd5202994 /utils/TableGen/AsmWriterEmitter.cpp
parent89c0b4a90eb86756dd83ac20216fc55a38c87376 (diff)
downloadllvm-2926869b4a083fc951484de03a9867eabf81e880.tar.gz
llvm-2926869b4a083fc951484de03a9867eabf81e880.tar.bz2
llvm-2926869b4a083fc951484de03a9867eabf81e880.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 02773d2ab6..2ea74494f2 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -211,15 +211,12 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
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,