aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-11-13 10:40:19 +0000
committerBill Wendling <isanbard@gmail.com>2010-11-13 10:40:19 +0000
commit04863d06fb3f2972355c990b29edcab1d9a85b41 (patch)
tree87b91000b642ef427409d1381a73bd70d352f3e6 /lib
parent6c470b806fe8eefae1b7bf180f269a4b120173a4 (diff)
downloadexternal_llvm-04863d06fb3f2972355c990b29edcab1d9a85b41.zip
external_llvm-04863d06fb3f2972355c990b29edcab1d9a85b41.tar.gz
external_llvm-04863d06fb3f2972355c990b29edcab1d9a85b41.tar.bz2
Minor cleanups:
- Get the opcode once. - Add a ParserMatchClass to reglist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMInstrInfo.td11
-rw-r--r--lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp14
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td
index b436780..6ff4bbb 100644
--- a/lib/Target/ARM/ARMInstrInfo.td
+++ b/lib/Target/ARM/ARMInstrInfo.td
@@ -285,16 +285,17 @@ def bltarget : Operand<i32> {
}
// A list of registers separated by comma. Used by load/store multiple.
-def reglist : Operand<i32> {
- string EncoderMethod = "getRegisterListOpValue";
- let PrintMethod = "printRegisterList";
-}
-
def RegListAsmOperand : AsmOperandClass {
let Name = "RegList";
let SuperClasses = [];
}
+def reglist : Operand<i32> {
+ string EncoderMethod = "getRegisterListOpValue";
+ let ParserMatchClass = RegListAsmOperand;
+ let PrintMethod = "printRegisterList";
+}
+
// An operand for the CONSTPOOL_ENTRY pseudo-instruction.
def cpinst_operand : Operand<i32> {
let PrintMethod = "printCPInstOperand";
diff --git a/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp b/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
index cb8f787..f54398c 100644
--- a/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
+++ b/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
@@ -31,8 +31,10 @@ StringRef ARMInstPrinter::getOpcodeName(unsigned Opcode) const {
void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
+ unsigned Opcode = MI->getOpcode();
+
// Check for MOVs and print canonical forms, instead.
- if (MI->getOpcode() == ARM::MOVs) {
+ if (Opcode == ARM::MOVs) {
// FIXME: Thumb variants?
const MCOperand &Dst = MI->getOperand(0);
const MCOperand &MO1 = MI->getOperand(1);
@@ -61,7 +63,7 @@ void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
}
// A8.6.123 PUSH
- if ((MI->getOpcode() == ARM::STM_UPD || MI->getOpcode() == ARM::t2STM_UPD) &&
+ if ((Opcode == ARM::STM_UPD || Opcode == ARM::t2STM_UPD) &&
MI->getOperand(0).getReg() == ARM::SP) {
const MCOperand &MO1 = MI->getOperand(2);
if (ARM_AM::getAM4SubMode(MO1.getImm()) == ARM_AM::db) {
@@ -74,7 +76,7 @@ void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
}
// A8.6.122 POP
- if ((MI->getOpcode() == ARM::LDM_UPD || MI->getOpcode() == ARM::t2LDM_UPD) &&
+ if ((Opcode == ARM::LDM_UPD || Opcode == ARM::t2LDM_UPD) &&
MI->getOperand(0).getReg() == ARM::SP) {
const MCOperand &MO1 = MI->getOperand(2);
if (ARM_AM::getAM4SubMode(MO1.getImm()) == ARM_AM::ia) {
@@ -87,7 +89,7 @@ void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
}
// A8.6.355 VPUSH
- if ((MI->getOpcode() == ARM::VSTMS_UPD || MI->getOpcode() ==ARM::VSTMD_UPD) &&
+ if ((Opcode == ARM::VSTMS_UPD || Opcode == ARM::VSTMD_UPD) &&
MI->getOperand(0).getReg() == ARM::SP) {
const MCOperand &MO1 = MI->getOperand(2);
if (ARM_AM::getAM4SubMode(MO1.getImm()) == ARM_AM::db) {
@@ -100,7 +102,7 @@ void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
}
// A8.6.354 VPOP
- if ((MI->getOpcode() == ARM::VLDMS_UPD || MI->getOpcode() ==ARM::VLDMD_UPD) &&
+ if ((Opcode == ARM::VLDMS_UPD || Opcode == ARM::VLDMD_UPD) &&
MI->getOperand(0).getReg() == ARM::SP) {
const MCOperand &MO1 = MI->getOperand(2);
if (ARM_AM::getAM4SubMode(MO1.getImm()) == ARM_AM::ia) {
@@ -113,7 +115,7 @@ void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
}
printInstruction(MI, O);
- }
+}
void ARMInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
raw_ostream &O) {