@@ -578,6 +578,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
578578 // FIXME - use subtarget debug flags
579579 if (!Subtarget.isTargetDarwin() && !Subtarget.isTargetELF() &&
580580 !Subtarget.isTargetCygMing() && !Subtarget.isTargetWin64() &&
581+ !Subtarget.isTargetUEFI64() &&
581582 TM.Options.ExceptionModel != ExceptionHandling::SjLj) {
582583 setOperationAction(ISD::EH_LABEL, MVT::Other, Expand);
583584 }
@@ -2543,7 +2544,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
25432544 setOperationAction(ISD::FSINCOS, MVT::f32, Custom);
25442545 }
25452546
2546- if (Subtarget.isTargetWin64()) {
2547+ if (Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64() ) {
25472548 setOperationAction(ISD::SDIV, MVT::i128, Custom);
25482549 setOperationAction(ISD::UDIV, MVT::i128, Custom);
25492550 setOperationAction(ISD::SREM, MVT::i128, Custom);
@@ -19656,7 +19657,8 @@ SDValue X86TargetLowering::LowerSINT_TO_FP(SDValue Op,
1965619657 else if (isLegalConversion(SrcVT, true, Subtarget))
1965719658 return Op;
1965819659
19659- if (Subtarget.isTargetWin64() && SrcVT == MVT::i128)
19660+ if ((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
19661+ SrcVT == MVT::i128)
1966019662 return LowerWin64_INT128_TO_FP(Op, DAG);
1966119663
1966219664 if (SDValue Extract = vectorizeExtractedCast(Op, dl, DAG, Subtarget))
@@ -20163,7 +20165,8 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
2016320165 if (DstVT.isVector())
2016420166 return lowerUINT_TO_FP_vec(Op, dl, DAG, Subtarget);
2016520167
20166- if (Subtarget.isTargetWin64() && SrcVT == MVT::i128)
20168+ if ((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
20169+ SrcVT == MVT::i128)
2016720170 return LowerWin64_INT128_TO_FP(Op, DAG);
2016820171
2016920172 if (SDValue Extract = vectorizeExtractedCast(Op, dl, DAG, Subtarget))
@@ -27880,7 +27883,6 @@ Register X86TargetLowering::getRegisterByName(const char* RegName, LLT VT,
2788027883 .Case("r14", X86::R14)
2788127884 .Case("r15", X86::R15)
2788227885 .Default(0);
27883-
2788427886 if (Reg == X86::EBP || Reg == X86::RBP) {
2788527887 if (!TFI.hasFP(MF))
2788627888 report_fatal_error("register " + StringRef(RegName) +
@@ -27924,7 +27926,7 @@ Register X86TargetLowering::getExceptionSelectorRegister(
2792427926}
2792527927
2792627928bool X86TargetLowering::needsFixedCatchObjects() const {
27927- return Subtarget.isTargetWin64();
27929+ return Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64() ;
2792827930}
2792927931
2793027932SDValue X86TargetLowering::LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const {
@@ -29515,7 +29517,8 @@ static SDValue LowerMULO(SDValue Op, const X86Subtarget &Subtarget,
2951529517}
2951629518
2951729519SDValue X86TargetLowering::LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) const {
29518- assert(Subtarget.isTargetWin64() && "Unexpected target");
29520+ assert((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
29521+ "Unexpected target");
2951929522 EVT VT = Op.getValueType();
2952029523 assert(VT.isInteger() && VT.getSizeInBits() == 128 &&
2952129524 "Unexpected return type for lowering");
@@ -29582,7 +29585,8 @@ SDValue X86TargetLowering::LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) cons
2958229585SDValue X86TargetLowering::LowerWin64_FP_TO_INT128(SDValue Op,
2958329586 SelectionDAG &DAG,
2958429587 SDValue &Chain) const {
29585- assert(Subtarget.isTargetWin64() && "Unexpected target");
29588+ assert((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
29589+ "Unexpected target");
2958629590 EVT VT = Op.getValueType();
2958729591 bool IsStrict = Op->isStrictFPOpcode();
2958829592
@@ -29615,7 +29619,8 @@ SDValue X86TargetLowering::LowerWin64_FP_TO_INT128(SDValue Op,
2961529619
2961629620SDValue X86TargetLowering::LowerWin64_INT128_TO_FP(SDValue Op,
2961729621 SelectionDAG &DAG) const {
29618- assert(Subtarget.isTargetWin64() && "Unexpected target");
29622+ assert((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
29623+ "Unexpected target");
2961929624 EVT VT = Op.getValueType();
2962029625 bool IsStrict = Op->isStrictFPOpcode();
2962129626
@@ -33861,7 +33866,8 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
3386133866 return;
3386233867 }
3386333868
33864- if (VT == MVT::i128 && Subtarget.isTargetWin64()) {
33869+ if (VT == MVT::i128 &&
33870+ (Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64())) {
3386533871 SDValue Chain;
3386633872 SDValue V = LowerWin64_FP_TO_INT128(SDValue(N, 0), DAG, Chain);
3386733873 Results.push_back(V);
@@ -37136,6 +37142,8 @@ X86TargetLowering::EmitSjLjDispatchBlock(MachineInstr &MI,
3713637142 // N.B. the order the invoke BBs are processed in doesn't matter here.
3713737143 SmallVector<MachineBasicBlock *, 64> MBBLPads;
3713837144 const MCPhysReg *SavedRegs = MF->getRegInfo().getCalleeSavedRegs();
37145+ // llvm::outs() << "Callee saved regs from isellowering " <<
37146+ // SavedRegs->
3713937147 for (MachineBasicBlock *MBB : InvokeBBs) {
3714037148 // Remove the landing pad successor from the invoke block and replace it
3714137149 // with the new dispatch block.
@@ -60753,8 +60761,8 @@ bool X86TargetLowering::hasStackProbeSymbol(const MachineFunction &MF) const {
6075360761/// Returns true if stack probing through inline assembly is requested.
6075460762bool X86TargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
6075560763
60756- // No inline stack probe for Windows, they have their own mechanism.
60757- if (Subtarget.isOSWindows() ||
60764+ // No inline stack probe for Windows and UEFI , they have their own mechanism.
60765+ if (Subtarget.isOSWindows() || Subtarget.isUEFI() ||
6075860766 MF.getFunction().hasFnAttribute("no-stack-arg-probe"))
6075960767 return false;
6076060768
@@ -60778,9 +60786,10 @@ X86TargetLowering::getStackProbeSymbolName(const MachineFunction &MF) const {
6077860786 if (MF.getFunction().hasFnAttribute("probe-stack"))
6077960787 return MF.getFunction().getFnAttribute("probe-stack").getValueAsString();
6078060788
60781- // Generally, if we aren't on Windows, the platform ABI does not include
60782- // support for stack probes, so don't emit them.
60783- if (!Subtarget.isOSWindows() || Subtarget.isTargetMachO() ||
60789+ // Generally, if we aren't on Windows or UEFI, the platform ABI does not
60790+ // include support for stack probes, so don't emit them.
60791+ if (!(Subtarget.isOSWindows() || Subtarget.isUEFI()) ||
60792+ Subtarget.isTargetMachO() ||
6078460793 MF.getFunction().hasFnAttribute("no-stack-arg-probe"))
6078560794 return "";
6078660795
0 commit comments