One definition of isThumb is plenty, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2010-09-02 01:39:14 +00:00
parent b0739b7833
commit eaa204b2f8

View File

@ -59,6 +59,9 @@ class ARMFastISel : public FastISel {
const TargetLowering &TLI; const TargetLowering &TLI;
const ARMFunctionInfo *AFI; const ARMFunctionInfo *AFI;
// Convenience variable to avoid checking all the time.
bool isThumb;
public: public:
explicit ARMFastISel(FunctionLoweringInfo &funcInfo) explicit ARMFastISel(FunctionLoweringInfo &funcInfo)
: FastISel(funcInfo), : FastISel(funcInfo),
@ -67,6 +70,7 @@ class ARMFastISel : public FastISel {
TLI(*TM.getTargetLowering()) { TLI(*TM.getTargetLowering()) {
Subtarget = &TM.getSubtarget<ARMSubtarget>(); Subtarget = &TM.getSubtarget<ARMSubtarget>();
AFI = funcInfo.MF->getInfo<ARMFunctionInfo>(); AFI = funcInfo.MF->getInfo<ARMFunctionInfo>();
isThumb = AFI->isThumbFunction();
} }
// Code from FastISel.cpp. // Code from FastISel.cpp.
@ -395,7 +399,7 @@ bool ARMFastISel::ARMComputeRegOffset(const Value *Obj, unsigned &Reg,
ARMCC::CondCodes Pred = ARMCC::AL; ARMCC::CondCodes Pred = ARMCC::AL;
unsigned PredReg = 0; unsigned PredReg = 0;
if (!AFI->isThumbFunction()) if (!isThumb)
emitARMRegPlusImmediate(*FuncInfo.MBB, FuncInfo.InsertPt, DL, emitARMRegPlusImmediate(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
Reg, Reg, Offset, Pred, PredReg, Reg, Reg, Offset, Pred, PredReg,
static_cast<const ARMBaseInstrInfo&>(TII)); static_cast<const ARMBaseInstrInfo&>(TII));
@ -435,8 +439,6 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
unsigned Reg, int Offset) { unsigned Reg, int Offset) {
assert(VT.isSimple() && "Non-simple types are invalid here!"); assert(VT.isSimple() && "Non-simple types are invalid here!");
bool isThumb = AFI->isThumbFunction();
unsigned Opc; unsigned Opc;
switch (VT.getSimpleVT().SimpleTy) { switch (VT.getSimpleVT().SimpleTy) {
@ -475,7 +477,6 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
bool ARMFastISel::ARMMaterializeConstant(const ConstantInt *CI, unsigned &Reg) { bool ARMFastISel::ARMMaterializeConstant(const ConstantInt *CI, unsigned &Reg) {
unsigned Opc; unsigned Opc;
bool Signed = true; bool Signed = true;
bool isThumb = AFI->isThumbFunction();
EVT VT = TLI.getValueType(CI->getType(), true); EVT VT = TLI.getValueType(CI->getType(), true);
switch (VT.getSimpleVT().SimpleTy) { switch (VT.getSimpleVT().SimpleTy) {
@ -518,8 +519,6 @@ bool ARMFastISel::ARMStoreAlloca(const Instruction *I, unsigned SrcReg) {
bool ARMFastISel::ARMEmitStore(EVT VT, unsigned SrcReg, bool ARMFastISel::ARMEmitStore(EVT VT, unsigned SrcReg,
unsigned DstReg, int Offset) { unsigned DstReg, int Offset) {
bool isThumb = AFI->isThumbFunction();
unsigned StrOpc; unsigned StrOpc;
switch (VT.getSimpleVT().SimpleTy) { switch (VT.getSimpleVT().SimpleTy) {
default: return false; default: return false;
@ -615,7 +614,7 @@ bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
bool ARMFastISel::TargetSelectInstruction(const Instruction *I) { bool ARMFastISel::TargetSelectInstruction(const Instruction *I) {
// No Thumb-1 for now. // No Thumb-1 for now.
if (AFI->isThumbFunction() && !AFI->isThumb2Function()) return false; if (isThumb && !AFI->isThumb2Function()) return false;
switch (I->getOpcode()) { switch (I->getOpcode()) {
case Instruction::Load: case Instruction::Load: