summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-16 01:40:00 +0000
committerChris Lattner <sabre@nondot.org>2006-01-16 01:40:00 +0000
commite636ba84b59e5969c2a7010959233ba135dae15f (patch)
tree1d6c736f49ca76bd539df7287c1e582b729fd60a
parentfe5cb66e9d3eb5653ba794ea42bc490aa11d41a8 (diff)
downloadbcm5719-llvm-e636ba84b59e5969c2a7010959233ba135dae15f.tar.gz
bcm5719-llvm-e636ba84b59e5969c2a7010959233ba135dae15f.zip
Silly Sparc is big endian. If we have to load args out of incoming stack slots
that are smaller than an int, make sure to adjust the frame pointer to take this into consideration. llvm-svn: 25351
-rw-r--r--llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp b/llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
index 08c66367141..e09b308e1fa 100644
--- a/llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
@@ -241,6 +241,10 @@ SparcV8TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
unsigned LoadOp =
I->getType()->isSigned() ? ISD::SEXTLOAD : ISD::ZEXTLOAD;
+ // Sparc is big endian, so add an offset based on the ObjectVT.
+ unsigned Offset = 4-std::max(1U, MVT::getSizeInBits(ObjectVT)/8);
+ FIPtr = DAG.getNode(ISD::ADD, MVT::i32, FIPtr,
+ DAG.getConstant(Offset, MVT::i32));
Load = DAG.getExtLoad(LoadOp, MVT::i32, Root, FIPtr,
DAG.getSrcValue(0), ObjectVT);
Load = DAG.getNode(ISD::TRUNCATE, ObjectVT, Load);
OpenPOWER on IntegriCloud