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

Commit 4948d77

Browse files
alexcrichtonarielb1
authored andcommitted
Merge pull request #74 from michaelwu/hexagon-fixes
Fixes for the hexagon target
2 parents b6b4e81 + 9394f96 commit 4948d77

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
@@ -485,9 +485,7 @@ static bool RetCC_Hexagon32(unsigned ValNo, MVT ValVT,
485485
}
486486
}
487487

488-
unsigned Offset = State.AllocateStack(4, 4);
489-
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
490-
return false;
488+
return true;
491489
}
492490

493491
static bool RetCC_Hexagon64(unsigned ValNo, MVT ValVT,
@@ -500,9 +498,7 @@ static bool RetCC_Hexagon64(unsigned ValNo, MVT ValVT,
500498
}
501499
}
502500

503-
unsigned Offset = State.AllocateStack(8, 8);
504-
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
505-
return false;
501+
return true;
506502
}
507503

508504
static bool RetCC_HexagonVector(unsigned ValNo, MVT ValVT,
@@ -513,7 +509,6 @@ static bool RetCC_HexagonVector(unsigned ValNo, MVT ValVT,
513509
bool UseHVX = HST.useHVXOps();
514510
bool UseHVXDbl = HST.useHVXDblOps();
515511

516-
unsigned OffSiz = 64;
517512
if (LocVT == MVT::v16i32) {
518513
if (unsigned Reg = State.AllocateReg(Hexagon::V0)) {
519514
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
@@ -525,18 +520,14 @@ static bool RetCC_HexagonVector(unsigned ValNo, MVT ValVT,
525520
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
526521
return false;
527522
}
528-
OffSiz = 128;
529523
} else if (LocVT == MVT::v64i32) {
530524
if (unsigned Reg = State.AllocateReg(Hexagon::W0)) {
531525
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
532526
return false;
533527
}
534-
OffSiz = 256;
535528
}
536529

537-
unsigned Offset = State.AllocateStack(OffSiz, OffSiz);
538-
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
539-
return false;
530+
return true;
540531
}
541532

542533
void HexagonTargetLowering::promoteLdStType(MVT VT, MVT PromotedLdStVT) {
@@ -592,6 +583,16 @@ static bool isHvxVectorType(MVT Ty) {
592583
}
593584
}
594585

586+
bool
587+
HexagonTargetLowering::CanLowerReturn(
588+
CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg,
589+
const SmallVectorImpl<ISD::OutputArg> &Outs,
590+
LLVMContext &Context) const {
591+
SmallVector<CCValAssign, 16> RVLocs;
592+
CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
593+
return CCInfo.CheckReturn(Outs, RetCC_Hexagon);
594+
}
595+
595596
// LowerReturn - Lower ISD::RET. If a struct is larger than 8 bytes and is
596597
// passed by value, the function prototype is modified to return void and
597598
// the value is stored in memory pointed by a pointer passed by caller.
@@ -1234,7 +1235,7 @@ SDValue HexagonTargetLowering::LowerFormalArguments(
12341235
InVals.push_back(FIN);
12351236
} else {
12361237
InVals.push_back(
1237-
DAG.getLoad(VA.getLocVT(), dl, Chain, FIN, MachinePointerInfo()));
1238+
DAG.getLoad(VA.getValVT(), dl, Chain, FIN, MachinePointerInfo()));
12381239
}
12391240
}
12401241
}

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)