summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMFastISel.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-08-25 08:43:57 +0000
committerEric Christopher <echristo@apple.com>2010-08-25 08:43:57 +0000
commit7a0d8c69cbeca8e08bac1cc5344be402ab66c61f (patch)
treebaa26f1768361f1ff6ad1758444bb84af41e6652 /llvm/lib/Target/ARM/ARMFastISel.cpp
parentaab3e41eb2391fd6aeb6ff65adc78cf3d015af9f (diff)
downloadbcm5719-llvm-7a0d8c69cbeca8e08bac1cc5344be402ab66c61f.tar.gz
bcm5719-llvm-7a0d8c69cbeca8e08bac1cc5344be402ab66c61f.zip
Do type checks before we bother to do everything else.
llvm-svn: 112039
Diffstat (limited to 'llvm/lib/Target/ARM/ARMFastISel.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMFastISel.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index 5e2bf68d774..10c7e5d6d27 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -415,14 +415,19 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
}
bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
- // Our register and offset with innocuous defaults.
- unsigned Reg = 0;
- int Offset = 0;
-
// If we're an alloca we know we have a frame index and can emit the load
// directly in short order.
if (ARMLoadAlloca(I))
return true;
+
+ // Verify we have a legal type before going any further.
+ EVT VT;
+ if (!isTypeLegal(I->getType(), VT))
+ return false;
+
+ // Our register and offset with innocuous defaults.
+ unsigned Reg = 0;
+ int Offset = 0;
// See if we can handle this as Reg + Offset
if (!ARMComputeRegOffset(I->getOperand(0), Reg, Offset))
@@ -445,10 +450,6 @@ bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
static_cast<const ARMBaseInstrInfo&>(TII));
}
- EVT VT;
- if (!isTypeLegal(I->getType(), VT))
- return false;
-
unsigned ResultReg;
// TODO: Verify the additions above work, otherwise we'll need to add the
// offset instead of 0 and do all sorts of operand munging.
OpenPOWER on IntegriCloud