Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 878af19

Browse files
authored
Merge pull request #74 from michaelwu/hexagon-fixes
Fixes for the hexagon target
2 parents a884d21 + e4b5789 commit 878af19

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

lib/Target/Hexagon/HexagonISelLowering.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ static bool RetCC_Hexagon32(unsigned ValNo, MVT ValVT,
483483
}
484484
}
485485

486-
unsigned Offset = State.AllocateStack(4, 4);
487-
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
488-
return false;
486+
return true;
489487
}
490488

491489
static bool RetCC_Hexagon64(unsigned ValNo, MVT ValVT,
@@ -498,9 +496,7 @@ static bool RetCC_Hexagon64(unsigned ValNo, MVT ValVT,
498496
}
499497
}
500498

501-
unsigned Offset = State.AllocateStack(8, 8);
502-
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
503-
return false;
499+
return true;
504500
}
505501

506502
static bool RetCC_HexagonVector(unsigned ValNo, MVT ValVT,
@@ -511,7 +507,6 @@ static bool RetCC_HexagonVector(unsigned ValNo, MVT ValVT,
511507
bool UseHVX = HST.useHVXOps();
512508
bool UseHVXDbl = HST.useHVXDblOps();
513509

514-
unsigned OffSiz = 64;
515510
if (LocVT == MVT::v16i32) {
516511
if (unsigned Reg = State.AllocateReg(Hexagon::V0)) {
517512
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
@@ -523,18 +518,14 @@ static bool RetCC_HexagonVector(unsigned ValNo, MVT ValVT,
523518
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
524519
return false;
525520
}
526-
OffSiz = 128;
527521
} else if (LocVT == MVT::v64i32) {
528522
if (unsigned Reg = State.AllocateReg(Hexagon::W0)) {
529523
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
530524
return false;
531525
}
532-
OffSiz = 256;
533526
}
534527

535-
unsigned Offset = State.AllocateStack(OffSiz, OffSiz);
536-
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
537-
return false;
528+
return true;
538529
}
539530

540531
void HexagonTargetLowering::promoteLdStType(MVT VT, MVT PromotedLdStVT) {
@@ -590,6 +581,16 @@ static bool isHvxVectorType(MVT Ty) {
590581
}
591582
}
592583

584+
bool
585+
HexagonTargetLowering::CanLowerReturn(
586+
CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg,
587+
const SmallVectorImpl<ISD::OutputArg> &Outs,
588+
LLVMContext &Context) const {
589+
SmallVector<CCValAssign, 16> RVLocs;
590+
CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
591+
return CCInfo.CheckReturn(Outs, RetCC_Hexagon);
592+
}
593+
593594
// LowerReturn - Lower ISD::RET. If a struct is larger than 8 bytes and is
594595
// passed by value, the function prototype is modified to return void and
595596
// the value is stored in memory pointed by a pointer passed by caller.
@@ -1217,7 +1218,7 @@ SDValue HexagonTargetLowering::LowerFormalArguments(
12171218
InVals.push_back(FIN);
12181219
} else {
12191220
InVals.push_back(
1220-
DAG.getLoad(VA.getLocVT(), dl, Chain, FIN, MachinePointerInfo()));
1221+
DAG.getLoad(VA.getValVT(), dl, Chain, FIN, MachinePointerInfo()));
12211222
}
12221223
}
12231224
}

lib/Target/Hexagon/HexagonISelLowering.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ namespace HexagonISD {
185185
SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
186186
SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;
187187

188+
bool CanLowerReturn(CallingConv::ID CallConv,
189+
MachineFunction &MF, bool isVarArg,
190+
const SmallVectorImpl<ISD::OutputArg> &Outs,
191+
LLVMContext &Context) const override;
192+
188193
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
189194
const SmallVectorImpl<ISD::OutputArg> &Outs,
190195
const SmallVectorImpl<SDValue> &OutVals,

0 commit comments

Comments
 (0)