summaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-08-31 01:28:42 +0000
committerEric Christopher <echristo@apple.com>2010-08-31 01:28:42 +0000
commitdc90804a402b9d617c154625e04a74ebd7fe3599 (patch)
tree3f4e4552d3a85986e9afc58418a84591d1cbdda9 /lib/Target
parente49e6a852b29b4f5fb13160ca3d2cc316f43030b (diff)
downloadllvm-dc90804a402b9d617c154625e04a74ebd7fe3599.tar.gz
llvm-dc90804a402b9d617c154625e04a74ebd7fe3599.tar.bz2
llvm-dc90804a402b9d617c154625e04a74ebd7fe3599.tar.xz
Rewrite slightly so we can expand for floating point types easier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM/ARMFastISel.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index a99f05fc05..198a965c75 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/lib/Target/ARM/ARMFastISel.cpp
@@ -318,8 +318,9 @@ bool ARMFastISel::isTypeLegal(const Type *Ty, EVT &VT) {
// Only handle simple types.
if (VT == MVT::Other || !VT.isSimple()) return false;
- // For now, only handle 32-bit types.
- return VT == MVT::i32;
+ // Handle all legal types, i.e. a register that will directly hold this
+ // value.
+ return TLI.isTypeLegal(VT);
}
// Computes the Reg+Offset to get to an object.
@@ -387,7 +388,6 @@ bool ARMFastISel::ARMLoadAlloca(const Instruction *I) {
return true;
}
}
-
return false;
}
@@ -395,25 +395,33 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
unsigned Reg, int Offset) {
assert(VT.isSimple() && "Non-simple types are invalid here!");
+
+ bool isThumb = AFI->isThumbFunction();
+ unsigned Opc;
+
switch (VT.getSimpleVT().SimpleTy) {
default:
assert(false && "Trying to emit for an unhandled type!");
return false;
- case MVT::i32: {
- ResultReg = createResultReg(ARM::GPRRegisterClass);
- // TODO: Fix the Addressing modes so that these can share some code.
- // Since this is a Thumb1 load this will work in Thumb1 or 2 mode.
- if (AFI->isThumbFunction())
- AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
- TII.get(ARM::tLDR), ResultReg)
- .addReg(Reg).addImm(Offset).addReg(0));
- else
- AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
- TII.get(ARM::LDR), ResultReg)
- .addReg(Reg).addReg(0).addImm(Offset));
- return true;
- }
+ case MVT::i32:
+ Opc = isThumb ? ARM::tLDR : ARM::LDR;
+ break;
}
+
+ ResultReg = createResultReg(TLI.getRegClassFor(VT));
+
+ // TODO: Fix the Addressing modes so that these can share some code.
+ // Since this is a Thumb1 load this will work in Thumb1 or 2 mode.
+ if (isThumb)
+ AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+ TII.get(Opc), ResultReg)
+ .addReg(Reg).addImm(Offset).addReg(0));
+ else
+ AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+ TII.get(Opc), ResultReg)
+ .addReg(Reg).addReg(0).addImm(Offset));
+
+ return true;
}
bool ARMFastISel::ARMSelectLoad(const Instruction *I) {