@@ -18204,15 +18204,17 @@ unsigned X86TargetLowering::getGlobalWrapperKind(
18204
18204
if (GV && GV->isAbsoluteSymbolRef())
18205
18205
return X86ISD::Wrapper;
18206
18206
18207
- CodeModel::Model M = getTargetMachine().getCodeModel();
18207
+ // The following OpFlags under RIP-rel PIC use RIP.
18208
18208
if (Subtarget.isPICStyleRIPRel() &&
18209
- (M == CodeModel::Small || M == CodeModel::Kernel))
18209
+ (OpFlags == X86II::MO_NO_FLAG || OpFlags == X86II::MO_COFFSTUB ||
18210
+ OpFlags == X86II::MO_DLLIMPORT))
18210
18211
return X86ISD::WrapperRIP;
18211
18212
18212
18213
// In the medium model, functions can always be referenced RIP-relatively,
18213
18214
// since they must be within 2GiB. This is also possible in non-PIC mode, and
18214
18215
// shorter than the 64-bit absolute immediate that would otherwise be emitted.
18215
- if (M == CodeModel::Medium && isa_and_nonnull<Function>(GV))
18216
+ if (getTargetMachine().getCodeModel() == CodeModel::Medium &&
18217
+ isa_and_nonnull<Function>(GV))
18216
18218
return X86ISD::WrapperRIP;
18217
18219
18218
18220
// GOTPCREL references must always use RIP.
@@ -18240,7 +18242,8 @@ X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) const {
18240
18242
SDValue Result = DAG.getTargetConstantPool(
18241
18243
CP->getConstVal(), PtrVT, CP->getAlign(), CP->getOffset(), OpFlag);
18242
18244
SDLoc DL(CP);
18243
- Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
18245
+ Result =
18246
+ DAG.getNode(getGlobalWrapperKind(nullptr, OpFlag), DL, PtrVT, Result);
18244
18247
// With PIC, the address is actually $g + Offset.
18245
18248
if (OpFlag) {
18246
18249
Result =
@@ -18261,7 +18264,8 @@ SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
18261
18264
auto PtrVT = getPointerTy(DAG.getDataLayout());
18262
18265
SDValue Result = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OpFlag);
18263
18266
SDLoc DL(JT);
18264
- Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
18267
+ Result =
18268
+ DAG.getNode(getGlobalWrapperKind(nullptr, OpFlag), DL, PtrVT, Result);
18265
18269
18266
18270
// With PIC, the address is actually $g + Offset.
18267
18271
if (OpFlag)
@@ -18287,7 +18291,8 @@ X86TargetLowering::LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const {
18287
18291
SDLoc dl(Op);
18288
18292
auto PtrVT = getPointerTy(DAG.getDataLayout());
18289
18293
SDValue Result = DAG.getTargetBlockAddress(BA, PtrVT, Offset, OpFlags);
18290
- Result = DAG.getNode(getGlobalWrapperKind(), dl, PtrVT, Result);
18294
+ Result =
18295
+ DAG.getNode(getGlobalWrapperKind(nullptr, OpFlags), dl, PtrVT, Result);
18291
18296
18292
18297
// With PIC, the address is actually $g + Offset.
18293
18298
if (isGlobalRelativeToPICBase(OpFlags)) {
@@ -25975,7 +25980,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
25975
25980
auto &Context = MF.getMMI().getContext();
25976
25981
MCSymbol *S = Context.getOrCreateSymbol(Twine("GCC_except_table") +
25977
25982
Twine(MF.getFunctionNumber()));
25978
- return DAG.getNode(getGlobalWrapperKind(), dl, VT,
25983
+ return DAG.getNode(getGlobalWrapperKind(nullptr, /*OpFlags=*/0 ), dl, VT,
25979
25984
DAG.getMCSymbol(S, PtrVT));
25980
25985
}
25981
25986
0 commit comments