mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 03:06:28 +00:00
* Speed up canUseAsImmediateForOpcode() by comparing Operand before
dyn_cast<>ing and checking Constant's value * Convert tabs to spaces llvm-svn: 15086
This commit is contained in:
parent
b77bda4432
commit
9543849102
@ -431,31 +431,31 @@ bool ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Operator)
|
|||||||
ConstantUInt *Op1Cu;
|
ConstantUInt *Op1Cu;
|
||||||
|
|
||||||
// ADDI, Compare, and non-indexed Load take SIMM
|
// ADDI, Compare, and non-indexed Load take SIMM
|
||||||
bool cond1 = (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
bool cond1 = (Operator == 0)
|
||||||
|
&& (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
||||||
&& (Op1Cs->getValue() <= 32767)
|
&& (Op1Cs->getValue() <= 32767)
|
||||||
&& (Op1Cs->getValue() >= -32768)
|
&& (Op1Cs->getValue() >= -32768);
|
||||||
&& (Operator == 0);
|
|
||||||
|
|
||||||
// SUBI takes -SIMM since it is a mnemonic for ADDI
|
// SUBI takes -SIMM since it is a mnemonic for ADDI
|
||||||
bool cond2 = (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
bool cond2 = (Operator == 1)
|
||||||
|
&& (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
||||||
&& (Op1Cs->getValue() <= 32768)
|
&& (Op1Cs->getValue() <= 32768)
|
||||||
&& (Op1Cs->getValue() >= -32767)
|
&& (Op1Cs->getValue() >= -32767);
|
||||||
&& (Operator == 1);
|
|
||||||
|
|
||||||
// ANDIo, ORI, and XORI take unsigned values
|
// ANDIo, ORI, and XORI take unsigned values
|
||||||
bool cond3 = (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
bool cond3 = (Operator >= 2)
|
||||||
&& (Op1Cs->getValue() <= 32767)
|
&& (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
||||||
&& (Operator >= 2);
|
&& (Op1Cs->getValue() <= 32767);
|
||||||
|
|
||||||
// ADDI and SUBI take SIMMs, so we have to make sure the UInt would fit
|
// ADDI and SUBI take SIMMs, so we have to make sure the UInt would fit
|
||||||
bool cond4 = (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
bool cond4 = (Operator < 2)
|
||||||
&& (Op1Cu->getValue() <= 32767)
|
&& (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
||||||
&& (Operator < 2);
|
&& (Op1Cu->getValue() <= 32767);
|
||||||
|
|
||||||
// ANDIo, ORI, and XORI take UIMMs, so they can be larger
|
// ANDIo, ORI, and XORI take UIMMs, so they can be larger
|
||||||
bool cond5 = (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
bool cond5 = (Operator >= 2)
|
||||||
&& (Op1Cu->getValue() <= 65535)
|
&& (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
||||||
&& (Operator >= 2);
|
&& (Op1Cu->getValue() <= 65535);
|
||||||
|
|
||||||
if (cond1 || cond2 || cond3 || cond4 || cond5)
|
if (cond1 || cond2 || cond3 || cond4 || cond5)
|
||||||
return true;
|
return true;
|
||||||
@ -2699,10 +2699,10 @@ void ISel::visitGetElementPtrInst(GetElementPtrInst &I) {
|
|||||||
/// emitGEPOperation - Common code shared between visitGetElementPtrInst and
|
/// emitGEPOperation - Common code shared between visitGetElementPtrInst and
|
||||||
/// constant expression GEP support.
|
/// constant expression GEP support.
|
||||||
///
|
///
|
||||||
void ISel::emitGEPOperation (MachineBasicBlock *MBB,
|
void ISel::emitGEPOperation(MachineBasicBlock *MBB,
|
||||||
MachineBasicBlock::iterator IP,
|
MachineBasicBlock::iterator IP,
|
||||||
Value *Src, User::op_iterator IdxBegin,
|
Value *Src, User::op_iterator IdxBegin,
|
||||||
User::op_iterator IdxEnd, unsigned TargetReg) {
|
User::op_iterator IdxEnd, unsigned TargetReg) {
|
||||||
const TargetData &TD = TM.getTargetData ();
|
const TargetData &TD = TM.getTargetData ();
|
||||||
const Type *Ty = Src->getType ();
|
const Type *Ty = Src->getType ();
|
||||||
unsigned basePtrReg = getReg (Src, MBB, IP);
|
unsigned basePtrReg = getReg (Src, MBB, IP);
|
||||||
|
@ -431,31 +431,31 @@ bool ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Operator)
|
|||||||
ConstantUInt *Op1Cu;
|
ConstantUInt *Op1Cu;
|
||||||
|
|
||||||
// ADDI, Compare, and non-indexed Load take SIMM
|
// ADDI, Compare, and non-indexed Load take SIMM
|
||||||
bool cond1 = (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
bool cond1 = (Operator == 0)
|
||||||
|
&& (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
||||||
&& (Op1Cs->getValue() <= 32767)
|
&& (Op1Cs->getValue() <= 32767)
|
||||||
&& (Op1Cs->getValue() >= -32768)
|
&& (Op1Cs->getValue() >= -32768);
|
||||||
&& (Operator == 0);
|
|
||||||
|
|
||||||
// SUBI takes -SIMM since it is a mnemonic for ADDI
|
// SUBI takes -SIMM since it is a mnemonic for ADDI
|
||||||
bool cond2 = (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
bool cond2 = (Operator == 1)
|
||||||
|
&& (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
||||||
&& (Op1Cs->getValue() <= 32768)
|
&& (Op1Cs->getValue() <= 32768)
|
||||||
&& (Op1Cs->getValue() >= -32767)
|
&& (Op1Cs->getValue() >= -32767);
|
||||||
&& (Operator == 1);
|
|
||||||
|
|
||||||
// ANDIo, ORI, and XORI take unsigned values
|
// ANDIo, ORI, and XORI take unsigned values
|
||||||
bool cond3 = (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
bool cond3 = (Operator >= 2)
|
||||||
&& (Op1Cs->getValue() <= 32767)
|
&& (Op1Cs = dyn_cast<ConstantSInt>(CI))
|
||||||
&& (Operator >= 2);
|
&& (Op1Cs->getValue() <= 32767);
|
||||||
|
|
||||||
// ADDI and SUBI take SIMMs, so we have to make sure the UInt would fit
|
// ADDI and SUBI take SIMMs, so we have to make sure the UInt would fit
|
||||||
bool cond4 = (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
bool cond4 = (Operator < 2)
|
||||||
&& (Op1Cu->getValue() <= 32767)
|
&& (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
||||||
&& (Operator < 2);
|
&& (Op1Cu->getValue() <= 32767);
|
||||||
|
|
||||||
// ANDIo, ORI, and XORI take UIMMs, so they can be larger
|
// ANDIo, ORI, and XORI take UIMMs, so they can be larger
|
||||||
bool cond5 = (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
bool cond5 = (Operator >= 2)
|
||||||
&& (Op1Cu->getValue() <= 65535)
|
&& (Op1Cu = dyn_cast<ConstantUInt>(CI))
|
||||||
&& (Operator >= 2);
|
&& (Op1Cu->getValue() <= 65535);
|
||||||
|
|
||||||
if (cond1 || cond2 || cond3 || cond4 || cond5)
|
if (cond1 || cond2 || cond3 || cond4 || cond5)
|
||||||
return true;
|
return true;
|
||||||
@ -2699,10 +2699,10 @@ void ISel::visitGetElementPtrInst(GetElementPtrInst &I) {
|
|||||||
/// emitGEPOperation - Common code shared between visitGetElementPtrInst and
|
/// emitGEPOperation - Common code shared between visitGetElementPtrInst and
|
||||||
/// constant expression GEP support.
|
/// constant expression GEP support.
|
||||||
///
|
///
|
||||||
void ISel::emitGEPOperation (MachineBasicBlock *MBB,
|
void ISel::emitGEPOperation(MachineBasicBlock *MBB,
|
||||||
MachineBasicBlock::iterator IP,
|
MachineBasicBlock::iterator IP,
|
||||||
Value *Src, User::op_iterator IdxBegin,
|
Value *Src, User::op_iterator IdxBegin,
|
||||||
User::op_iterator IdxEnd, unsigned TargetReg) {
|
User::op_iterator IdxEnd, unsigned TargetReg) {
|
||||||
const TargetData &TD = TM.getTargetData ();
|
const TargetData &TD = TM.getTargetData ();
|
||||||
const Type *Ty = Src->getType ();
|
const Type *Ty = Src->getType ();
|
||||||
unsigned basePtrReg = getReg (Src, MBB, IP);
|
unsigned basePtrReg = getReg (Src, MBB, IP);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user