@@ -670,16 +670,17 @@ SDValue MSP430TargetLowering::LowerCCCArguments(
670
670
InVals.push_back (ArgValue);
671
671
}
672
672
} else {
673
- // Only arguments passed on the stack should make it here.
673
+ // Only arguments passed on the stack should make it here.
674
674
assert (VA.isMemLoc ());
675
675
676
676
SDValue InVal;
677
677
ISD::ArgFlagsTy Flags = Ins[i].Flags ;
678
678
679
679
if (Flags.isByVal ()) {
680
+ MVT PtrVT = VA.getLocVT ();
680
681
int FI = MFI.CreateFixedObject (Flags.getByValSize (),
681
682
VA.getLocMemOffset (), true );
682
- InVal = DAG.getFrameIndex (FI, getPointerTy (DAG. getDataLayout ()) );
683
+ InVal = DAG.getFrameIndex (FI, PtrVT );
683
684
} else {
684
685
// Load the argument to a virtual register
685
686
unsigned ObjSize = VA.getLocVT ().getSizeInBits ()/8 ;
@@ -777,13 +778,14 @@ MSP430TargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
777
778
if (!Reg)
778
779
llvm_unreachable (" sret virtual register not created in entry block" );
779
780
781
+ MVT PtrVT = getFrameIndexTy (DAG.getDataLayout ());
780
782
SDValue Val =
781
- DAG.getCopyFromReg (Chain, dl, Reg, getPointerTy (DAG. getDataLayout ()) );
783
+ DAG.getCopyFromReg (Chain, dl, Reg, PtrVT );
782
784
unsigned R12 = MSP430::R12;
783
785
784
786
Chain = DAG.getCopyToReg (Chain, dl, R12, Val, Flag);
785
787
Flag = Chain.getValue (1 );
786
- RetOps.push_back (DAG.getRegister (R12, getPointerTy (DAG. getDataLayout ()) ));
788
+ RetOps.push_back (DAG.getRegister (R12, PtrVT ));
787
789
}
788
790
789
791
unsigned Opc = (CallConv == CallingConv::MSP430_INTR ?
@@ -814,7 +816,7 @@ SDValue MSP430TargetLowering::LowerCCCCallTo(
814
816
815
817
// Get a count of how many bytes are to be pushed on the stack.
816
818
unsigned NumBytes = CCInfo.getNextStackOffset ();
817
- auto PtrVT = getPointerTy (DAG.getDataLayout ());
819
+ MVT PtrVT = getFrameIndexTy (DAG.getDataLayout ());
818
820
819
821
Chain = DAG.getCALLSEQ_START (Chain, NumBytes, 0 , dl);
820
822
@@ -1010,7 +1012,7 @@ SDValue MSP430TargetLowering::LowerGlobalAddress(SDValue Op,
1010
1012
SelectionDAG &DAG) const {
1011
1013
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal ();
1012
1014
int64_t Offset = cast<GlobalAddressSDNode>(Op)->getOffset ();
1013
- auto PtrVT = getPointerTy (DAG. getDataLayout () );
1015
+ EVT PtrVT = Op. getValueType ( );
1014
1016
1015
1017
// Create the TargetGlobalAddress node, folding in the constant offset.
1016
1018
SDValue Result = DAG.getTargetGlobalAddress (GV, SDLoc (Op), PtrVT, Offset);
@@ -1021,7 +1023,7 @@ SDValue MSP430TargetLowering::LowerExternalSymbol(SDValue Op,
1021
1023
SelectionDAG &DAG) const {
1022
1024
SDLoc dl (Op);
1023
1025
const char *Sym = cast<ExternalSymbolSDNode>(Op)->getSymbol ();
1024
- auto PtrVT = getPointerTy (DAG. getDataLayout () );
1026
+ EVT PtrVT = Op. getValueType ( );
1025
1027
SDValue Result = DAG.getTargetExternalSymbol (Sym, PtrVT);
1026
1028
1027
1029
return DAG.getNode (MSP430ISD::Wrapper, dl, PtrVT, Result);
@@ -1030,8 +1032,8 @@ SDValue MSP430TargetLowering::LowerExternalSymbol(SDValue Op,
1030
1032
SDValue MSP430TargetLowering::LowerBlockAddress (SDValue Op,
1031
1033
SelectionDAG &DAG) const {
1032
1034
SDLoc dl (Op);
1033
- auto PtrVT = getPointerTy (DAG.getDataLayout ());
1034
1035
const BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress ();
1036
+ EVT PtrVT = Op.getValueType ();
1035
1037
SDValue Result = DAG.getTargetBlockAddress (BA, PtrVT);
1036
1038
1037
1039
return DAG.getNode (MSP430ISD::Wrapper, dl, PtrVT, Result);
@@ -1248,11 +1250,11 @@ MSP430TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) const {
1248
1250
MachineFunction &MF = DAG.getMachineFunction ();
1249
1251
MSP430MachineFunctionInfo *FuncInfo = MF.getInfo <MSP430MachineFunctionInfo>();
1250
1252
int ReturnAddrIndex = FuncInfo->getRAIndex ();
1251
- auto PtrVT = getPointerTy (MF.getDataLayout ());
1253
+ MVT PtrVT = getFrameIndexTy (MF.getDataLayout ());
1252
1254
1253
1255
if (ReturnAddrIndex == 0 ) {
1254
1256
// Set up a frame object for the return address.
1255
- uint64_t SlotSize = MF. getDataLayout (). getPointerSize ();
1257
+ uint64_t SlotSize = PtrVT. getStoreSize ();
1256
1258
ReturnAddrIndex = MF.getFrameInfo ().CreateFixedObject (SlotSize, -SlotSize,
1257
1259
true );
1258
1260
FuncInfo->setRAIndex (ReturnAddrIndex);
@@ -1271,12 +1273,12 @@ SDValue MSP430TargetLowering::LowerRETURNADDR(SDValue Op,
1271
1273
1272
1274
unsigned Depth = cast<ConstantSDNode>(Op.getOperand (0 ))->getZExtValue ();
1273
1275
SDLoc dl (Op);
1274
- auto PtrVT = getPointerTy (DAG. getDataLayout () );
1276
+ EVT PtrVT = Op. getValueType ( );
1275
1277
1276
1278
if (Depth > 0 ) {
1277
1279
SDValue FrameAddr = LowerFRAMEADDR (Op, DAG);
1278
1280
SDValue Offset =
1279
- DAG.getConstant (DAG. getDataLayout (). getPointerSize (), dl, MVT::i16 );
1281
+ DAG.getConstant (PtrVT. getStoreSize (), dl, MVT::i16 );
1280
1282
return DAG.getLoad (PtrVT, dl, DAG.getEntryNode (),
1281
1283
DAG.getNode (ISD::ADD, dl, PtrVT, FrameAddr, Offset),
1282
1284
MachinePointerInfo ());
@@ -1308,22 +1310,24 @@ SDValue MSP430TargetLowering::LowerVASTART(SDValue Op,
1308
1310
SelectionDAG &DAG) const {
1309
1311
MachineFunction &MF = DAG.getMachineFunction ();
1310
1312
MSP430MachineFunctionInfo *FuncInfo = MF.getInfo <MSP430MachineFunctionInfo>();
1311
- auto PtrVT = getPointerTy (DAG.getDataLayout ());
1313
+
1314
+ SDValue Ptr = Op.getOperand (1 );
1315
+ EVT PtrVT = Ptr.getValueType ();
1312
1316
1313
1317
// Frame index of first vararg argument
1314
1318
SDValue FrameIndex =
1315
1319
DAG.getFrameIndex (FuncInfo->getVarArgsFrameIndex (), PtrVT);
1316
1320
const Value *SV = cast<SrcValueSDNode>(Op.getOperand (2 ))->getValue ();
1317
1321
1318
1322
// Create a store of the frame index to the location operand
1319
- return DAG.getStore (Op.getOperand (0 ), SDLoc (Op), FrameIndex, Op. getOperand ( 1 ) ,
1323
+ return DAG.getStore (Op.getOperand (0 ), SDLoc (Op), FrameIndex, Ptr ,
1320
1324
MachinePointerInfo (SV));
1321
1325
}
1322
1326
1323
1327
SDValue MSP430TargetLowering::LowerJumpTable (SDValue Op,
1324
1328
SelectionDAG &DAG) const {
1325
1329
JumpTableSDNode *JT = cast<JumpTableSDNode>(Op);
1326
- auto PtrVT = getPointerTy (DAG. getDataLayout () );
1330
+ EVT PtrVT = Op. getValueType ( );
1327
1331
SDValue Result = DAG.getTargetJumpTable (JT->getIndex (), PtrVT);
1328
1332
return DAG.getNode (MSP430ISD::Wrapper, SDLoc (JT), PtrVT, Result);
1329
1333
}
0 commit comments