[llvm] r235978 - [mips] [IAS] Store the expandLoadImm destination register in a variable. NFC.
Toma Tabacu
toma.tabacu at imgtec.com
Tue Apr 28 05:04:53 PDT 2015
Author: tomatabacu
Date: Tue Apr 28 07:04:53 2015
New Revision: 235978
URL: http://llvm.org/viewvc/llvm-project?rev=235978&view=rev
Log:
[mips] [IAS] Store the expandLoadImm destination register in a variable. NFC.
Summary: This removes multiple calls to getReg() and saves us column space in the source file.
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8924
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=235978&r1=235977&r2=235978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Tue Apr 28 07:04:53 2015
@@ -1713,6 +1713,7 @@ bool MipsAsmParser::expandLoadImm(MCInst
assert(RegOp.isReg() && "expected register operand kind");
int64_t ImmValue = ImmOp.getImm();
+ unsigned Reg = RegOp.getReg();
tmpInst.setLoc(IDLoc);
// FIXME: gas has a special case for values that are 000...1111, which
// becomes a li -1 and then a dsrl
@@ -1720,7 +1721,7 @@ bool MipsAsmParser::expandLoadImm(MCInst
// For unsigned and positive signed 16-bit values (0 <= j <= 65535):
// li d,j => ori d,$zero,j
tmpInst.setOpcode(Mips::ORi);
- tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
Instructions.push_back(tmpInst);
@@ -1728,7 +1729,7 @@ bool MipsAsmParser::expandLoadImm(MCInst
// For negative signed 16-bit values (-32768 <= j < 0):
// li d,j => addiu d,$zero,j
tmpInst.setOpcode(Mips::ADDiu);
- tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
Instructions.push_back(tmpInst);
@@ -1737,10 +1738,10 @@ bool MipsAsmParser::expandLoadImm(MCInst
// li d,j => lui d,hi16(j)
// ori d,d,lo16(j)
tmpInst.setOpcode(Mips::LUi);
- tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(MCOperand::CreateImm((ImmValue & 0xffff0000) >> 16));
Instructions.push_back(tmpInst);
- createShiftOr<0, false>(ImmValue, RegOp.getReg(), IDLoc, Instructions);
+ createShiftOr<0, false>(ImmValue, Reg, IDLoc, Instructions);
} else if ((ImmValue & (0xffffLL << 48)) == 0) {
if (!isGP64bit()) {
Error(IDLoc, "instruction requires a 64-bit architecture");
@@ -1761,12 +1762,12 @@ bool MipsAsmParser::expandLoadImm(MCInst
// dsll d,d,16
// ori d,d,lo16(lo32(j))
tmpInst.setOpcode(Mips::LUi);
- tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(
MCOperand::CreateImm((ImmValue & (0xffffLL << 32)) >> 32));
Instructions.push_back(tmpInst);
- createShiftOr<16, false>(ImmValue, RegOp.getReg(), IDLoc, Instructions);
- createShiftOr<0, true>(ImmValue, RegOp.getReg(), IDLoc, Instructions);
+ createShiftOr<16, false>(ImmValue, Reg, IDLoc, Instructions);
+ createShiftOr<0, true>(ImmValue, Reg, IDLoc, Instructions);
} else {
if (!isGP64bit()) {
Error(IDLoc, "instruction requires a 64-bit architecture");
@@ -1788,13 +1789,13 @@ bool MipsAsmParser::expandLoadImm(MCInst
// dsll d,d,16
// ori d,d,lo16(lo32(j))
tmpInst.setOpcode(Mips::LUi);
- tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(
MCOperand::CreateImm((ImmValue & (0xffffLL << 48)) >> 48));
Instructions.push_back(tmpInst);
- createShiftOr<32, false>(ImmValue, RegOp.getReg(), IDLoc, Instructions);
- createShiftOr<16, true>(ImmValue, RegOp.getReg(), IDLoc, Instructions);
- createShiftOr<0, true>(ImmValue, RegOp.getReg(), IDLoc, Instructions);
+ createShiftOr<32, false>(ImmValue, Reg, IDLoc, Instructions);
+ createShiftOr<16, true>(ImmValue, Reg, IDLoc, Instructions);
+ createShiftOr<0, true>(ImmValue, Reg, IDLoc, Instructions);
}
return false;
}
More information about the llvm-commits
mailing list