@@ -576,6 +576,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
576576 // FIXME - use subtarget debug flags
577577 if (!Subtarget.isTargetDarwin() && !Subtarget.isTargetELF() &&
578578 !Subtarget.isTargetCygMing() && !Subtarget.isTargetWin64() &&
579+ !Subtarget.isTargetUEFI64() &&
579580 TM.Options.ExceptionModel != ExceptionHandling::SjLj) {
580581 setOperationAction(ISD::EH_LABEL, MVT::Other, Expand);
581582 }
@@ -2521,7 +2522,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
25212522 setOperationAction(ISD::FSINCOS, MVT::f32, Custom);
25222523 }
25232524
2524- if (Subtarget.isTargetWin64()) {
2525+ if (Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64() ) {
25252526 setOperationAction(ISD::SDIV, MVT::i128, Custom);
25262527 setOperationAction(ISD::UDIV, MVT::i128, Custom);
25272528 setOperationAction(ISD::SREM, MVT::i128, Custom);
@@ -19487,7 +19488,8 @@ SDValue X86TargetLowering::LowerSINT_TO_FP(SDValue Op,
1948719488 else if (isLegalConversion(SrcVT, true, Subtarget))
1948819489 return Op;
1948919490
19490- if (Subtarget.isTargetWin64() && SrcVT == MVT::i128)
19491+ if ((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
19492+ SrcVT == MVT::i128)
1949119493 return LowerWin64_INT128_TO_FP(Op, DAG);
1949219494
1949319495 if (SDValue Extract = vectorizeExtractedCast(Op, dl, DAG, Subtarget))
@@ -19994,7 +19996,8 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
1999419996 if (DstVT.isVector())
1999519997 return lowerUINT_TO_FP_vec(Op, dl, DAG, Subtarget);
1999619998
19997- if (Subtarget.isTargetWin64() && SrcVT == MVT::i128)
19999+ if ((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
20000+ SrcVT == MVT::i128)
1999820001 return LowerWin64_INT128_TO_FP(Op, DAG);
1999920002
2000020003 if (SDValue Extract = vectorizeExtractedCast(Op, dl, DAG, Subtarget))
@@ -27626,7 +27629,6 @@ Register X86TargetLowering::getRegisterByName(const char* RegName, LLT VT,
2762627629 .Case("r14", X86::R14)
2762727630 .Case("r15", X86::R15)
2762827631 .Default(0);
27629-
2763027632 if (Reg == X86::EBP || Reg == X86::RBP) {
2763127633 if (!TFI.hasFP(MF))
2763227634 report_fatal_error("register " + StringRef(RegName) +
@@ -27670,7 +27672,7 @@ Register X86TargetLowering::getExceptionSelectorRegister(
2767027672}
2767127673
2767227674bool X86TargetLowering::needsFixedCatchObjects() const {
27673- return Subtarget.isTargetWin64();
27675+ return Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64() ;
2767427676}
2767527677
2767627678SDValue X86TargetLowering::LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const {
@@ -29224,7 +29226,8 @@ static SDValue LowerMULO(SDValue Op, const X86Subtarget &Subtarget,
2922429226}
2922529227
2922629228SDValue X86TargetLowering::LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) const {
29227- assert(Subtarget.isTargetWin64() && "Unexpected target");
29229+ assert((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
29230+ "Unexpected target");
2922829231 EVT VT = Op.getValueType();
2922929232 assert(VT.isInteger() && VT.getSizeInBits() == 128 &&
2923029233 "Unexpected return type for lowering");
@@ -29291,7 +29294,8 @@ SDValue X86TargetLowering::LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) cons
2929129294SDValue X86TargetLowering::LowerWin64_FP_TO_INT128(SDValue Op,
2929229295 SelectionDAG &DAG,
2929329296 SDValue &Chain) const {
29294- assert(Subtarget.isTargetWin64() && "Unexpected target");
29297+ assert((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
29298+ "Unexpected target");
2929529299 EVT VT = Op.getValueType();
2929629300 bool IsStrict = Op->isStrictFPOpcode();
2929729301
@@ -29324,7 +29328,8 @@ SDValue X86TargetLowering::LowerWin64_FP_TO_INT128(SDValue Op,
2932429328
2932529329SDValue X86TargetLowering::LowerWin64_INT128_TO_FP(SDValue Op,
2932629330 SelectionDAG &DAG) const {
29327- assert(Subtarget.isTargetWin64() && "Unexpected target");
29331+ assert((Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64()) &&
29332+ "Unexpected target");
2932829333 EVT VT = Op.getValueType();
2932929334 bool IsStrict = Op->isStrictFPOpcode();
2933029335
@@ -33564,7 +33569,8 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
3356433569 return;
3356533570 }
3356633571
33567- if (VT == MVT::i128 && Subtarget.isTargetWin64()) {
33572+ if (VT == MVT::i128 &&
33573+ (Subtarget.isTargetWin64() || Subtarget.isTargetUEFI64())) {
3356833574 SDValue Chain;
3356933575 SDValue V = LowerWin64_FP_TO_INT128(SDValue(N, 0), DAG, Chain);
3357033576 Results.push_back(V);
@@ -36945,6 +36951,8 @@ X86TargetLowering::EmitSjLjDispatchBlock(MachineInstr &MI,
3694536951 // N.B. the order the invoke BBs are processed in doesn't matter here.
3694636952 SmallVector<MachineBasicBlock *, 64> MBBLPads;
3694736953 const MCPhysReg *SavedRegs = MF->getRegInfo().getCalleeSavedRegs();
36954+ // llvm::outs() << "Callee saved regs from isellowering " <<
36955+ // SavedRegs->
3694836956 for (MachineBasicBlock *MBB : InvokeBBs) {
3694936957 // Remove the landing pad successor from the invoke block and replace it
3695036958 // with the new dispatch block.
@@ -60153,8 +60161,8 @@ bool X86TargetLowering::hasStackProbeSymbol(const MachineFunction &MF) const {
6015360161/// Returns true if stack probing through inline assembly is requested.
6015460162bool X86TargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
6015560163
60156- // No inline stack probe for Windows, they have their own mechanism.
60157- if (Subtarget.isOSWindows() ||
60164+ // No inline stack probe for Windows and UEFI , they have their own mechanism.
60165+ if (Subtarget.isOSWindows() || Subtarget.isUEFI() ||
6015860166 MF.getFunction().hasFnAttribute("no-stack-arg-probe"))
6015960167 return false;
6016060168
@@ -60178,9 +60186,10 @@ X86TargetLowering::getStackProbeSymbolName(const MachineFunction &MF) const {
6017860186 if (MF.getFunction().hasFnAttribute("probe-stack"))
6017960187 return MF.getFunction().getFnAttribute("probe-stack").getValueAsString();
6018060188
60181- // Generally, if we aren't on Windows, the platform ABI does not include
60182- // support for stack probes, so don't emit them.
60183- if (!Subtarget.isOSWindows() || Subtarget.isTargetMachO() ||
60189+ // Generally, if we aren't on Windows or UEFI, the platform ABI does not
60190+ // include support for stack probes, so don't emit them.
60191+ if (!(Subtarget.isOSWindows() || Subtarget.isUEFI()) ||
60192+ Subtarget.isTargetMachO() ||
6018460193 MF.getFunction().hasFnAttribute("no-stack-arg-probe"))
6018560194 return "";
6018660195
0 commit comments