@@ -18204,17 +18204,15 @@ unsigned X86TargetLowering::getGlobalWrapperKind(
1820418204 if (GV && GV->isAbsoluteSymbolRef())
1820518205 return X86ISD::Wrapper;
1820618206
18207- // The following OpFlags under RIP-rel PIC use RIP.
18207+ CodeModel::Model M = getTargetMachine().getCodeModel();
1820818208 if (Subtarget.isPICStyleRIPRel() &&
18209- (OpFlags == X86II::MO_NO_FLAG || OpFlags == X86II::MO_COFFSTUB ||
18210- OpFlags == X86II::MO_DLLIMPORT))
18209+ (M == CodeModel::Small || M == CodeModel::Kernel))
1821118210 return X86ISD::WrapperRIP;
1821218211
1821318212 // In the medium model, functions can always be referenced RIP-relatively,
1821418213 // since they must be within 2GiB. This is also possible in non-PIC mode, and
1821518214 // shorter than the 64-bit absolute immediate that would otherwise be emitted.
18216- if (getTargetMachine().getCodeModel() == CodeModel::Medium &&
18217- isa_and_nonnull<Function>(GV))
18215+ if (M == CodeModel::Medium && isa_and_nonnull<Function>(GV))
1821818216 return X86ISD::WrapperRIP;
1821918217
1822018218 // GOTPCREL references must always use RIP.
@@ -18242,8 +18240,7 @@ X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) const {
1824218240 SDValue Result = DAG.getTargetConstantPool(
1824318241 CP->getConstVal(), PtrVT, CP->getAlign(), CP->getOffset(), OpFlag);
1824418242 SDLoc DL(CP);
18245- Result =
18246- DAG.getNode(getGlobalWrapperKind(nullptr, OpFlag), DL, PtrVT, Result);
18243+ Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
1824718244 // With PIC, the address is actually $g + Offset.
1824818245 if (OpFlag) {
1824918246 Result =
@@ -18264,8 +18261,7 @@ SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
1826418261 auto PtrVT = getPointerTy(DAG.getDataLayout());
1826518262 SDValue Result = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OpFlag);
1826618263 SDLoc DL(JT);
18267- Result =
18268- DAG.getNode(getGlobalWrapperKind(nullptr, OpFlag), DL, PtrVT, Result);
18264+ Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
1826918265
1827018266 // With PIC, the address is actually $g + Offset.
1827118267 if (OpFlag)
@@ -18291,8 +18287,7 @@ X86TargetLowering::LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const {
1829118287 SDLoc dl(Op);
1829218288 auto PtrVT = getPointerTy(DAG.getDataLayout());
1829318289 SDValue Result = DAG.getTargetBlockAddress(BA, PtrVT, Offset, OpFlags);
18294- Result =
18295- DAG.getNode(getGlobalWrapperKind(nullptr, OpFlags), dl, PtrVT, Result);
18290+ Result = DAG.getNode(getGlobalWrapperKind(), dl, PtrVT, Result);
1829618291
1829718292 // With PIC, the address is actually $g + Offset.
1829818293 if (isGlobalRelativeToPICBase(OpFlags)) {
@@ -25980,7 +25975,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
2598025975 auto &Context = MF.getMMI().getContext();
2598125976 MCSymbol *S = Context.getOrCreateSymbol(Twine("GCC_except_table") +
2598225977 Twine(MF.getFunctionNumber()));
25983- return DAG.getNode(getGlobalWrapperKind(nullptr, /*OpFlags=*/0 ), dl, VT,
25978+ return DAG.getNode(getGlobalWrapperKind(), dl, VT,
2598425979 DAG.getMCSymbol(S, PtrVT));
2598525980 }
2598625981
0 commit comments