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
This commit is contained in:
Chris Lattner 2006-01-16 01:40:00 +00:00
parent fe5cb66e9d
commit e636ba84b5
1 changed files with 4 additions and 0 deletions

View File

@ -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);