[PATCH] Transform 3 operand instructions to 2 operand versions of the same instruction if first 2 register operands are the same for thumb1
Renato Golin
renato.golin at linaro.org
Wed Sep 24 03:12:26 PDT 2014
================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:5655
@@ +5654,3 @@
+ Mnemonic == "ror" || Mnemonic == "orr" || Mnemonic == "bic")) {
+ ARMOperand &Op1 = static_cast<ARMOperand &>(*Operands[3]);
+ ARMOperand &Op2 = static_cast<ARMOperand &>(*Operands[4]);
----------------
Either call these Reg1, Reg2 or Op3, Op4.
================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:5666
@@ +5665,3 @@
+ if (!Op3.isReg() || !((Mnemonic == "add" && CarrySetting) || Mnemonic == "sub")) {
+ Operands.erase(Operands.begin() + 4);
+ if (Mnemonic == "add" && !CarrySetting) {
----------------
Being pedantic, the ARM ARM refers to the first register as being optional, not the second. :)
================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:5670
@@ +5669,3 @@
+ // remove the CCOut operand as well.
+ Operands.erase(Operands.begin() + 1);
+ }
----------------
why is this necessary?
================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:5686
@@ +5685,3 @@
+ static_cast<ARMOperand &>(*Operands[2]).getReg() ==
+ static_cast<ARMOperand &>(*Operands[3]).getReg()) {
+ Operands.erase(Operands.begin() + 2);
----------------
You could simplify this with a nested if
================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:8196
@@ -8151,3 +8195,3 @@
// to be from r0-r7 when in Thumb2.
- else if (Opc == ARM::tADDhirr && isThumbOne() &&
+ else if (Opc == ARM::tADDhirr && isThumbOne() && !hasV6MOps() &&
isARMLowRegister(Inst.getOperand(1).getReg()) &&
----------------
Can you describe why is this change needed?
http://reviews.llvm.org/D5463
More information about the llvm-commits
mailing list