@@ -18183,15 +18183,17 @@ unsigned X86TargetLowering::getGlobalWrapperKind(
18183
18183
if (GV && GV->isAbsoluteSymbolRef())
18184
18184
return X86ISD::Wrapper;
18185
18185
18186
- CodeModel::Model M = getTargetMachine().getCodeModel();
18186
+ // The following OpFlags under RIP-rel PIC use RIP.
18187
18187
if (Subtarget.isPICStyleRIPRel() &&
18188
- (M == CodeModel::Small || M == CodeModel::Kernel))
18188
+ (OpFlags == X86II::MO_NO_FLAG || OpFlags == X86II::MO_COFFSTUB ||
18189
+ OpFlags == X86II::MO_DLLIMPORT))
18189
18190
return X86ISD::WrapperRIP;
18190
18191
18191
18192
// In the medium model, functions can always be referenced RIP-relatively,
18192
18193
// since they must be within 2GiB. This is also possible in non-PIC mode, and
18193
18194
// shorter than the 64-bit absolute immediate that would otherwise be emitted.
18194
- if (M == CodeModel::Medium && isa_and_nonnull<Function>(GV))
18195
+ if (getTargetMachine().getCodeModel() == CodeModel::Medium &&
18196
+ isa_and_nonnull<Function>(GV))
18195
18197
return X86ISD::WrapperRIP;
18196
18198
18197
18199
// GOTPCREL references must always use RIP.
@@ -18219,7 +18221,8 @@ X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) const {
18219
18221
SDValue Result = DAG.getTargetConstantPool(
18220
18222
CP->getConstVal(), PtrVT, CP->getAlign(), CP->getOffset(), OpFlag);
18221
18223
SDLoc DL(CP);
18222
- Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
18224
+ Result =
18225
+ DAG.getNode(getGlobalWrapperKind(nullptr, OpFlag), DL, PtrVT, Result);
18223
18226
// With PIC, the address is actually $g + Offset.
18224
18227
if (OpFlag) {
18225
18228
Result =
@@ -18240,7 +18243,8 @@ SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
18240
18243
auto PtrVT = getPointerTy(DAG.getDataLayout());
18241
18244
SDValue Result = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, OpFlag);
18242
18245
SDLoc DL(JT);
18243
- Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
18246
+ Result =
18247
+ DAG.getNode(getGlobalWrapperKind(nullptr, OpFlag), DL, PtrVT, Result);
18244
18248
18245
18249
// With PIC, the address is actually $g + Offset.
18246
18250
if (OpFlag)
@@ -18266,7 +18270,8 @@ X86TargetLowering::LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const {
18266
18270
SDLoc dl(Op);
18267
18271
auto PtrVT = getPointerTy(DAG.getDataLayout());
18268
18272
SDValue Result = DAG.getTargetBlockAddress(BA, PtrVT, Offset, OpFlags);
18269
- Result = DAG.getNode(getGlobalWrapperKind(), dl, PtrVT, Result);
18273
+ Result =
18274
+ DAG.getNode(getGlobalWrapperKind(nullptr, OpFlags), dl, PtrVT, Result);
18270
18275
18271
18276
// With PIC, the address is actually $g + Offset.
18272
18277
if (isGlobalRelativeToPICBase(OpFlags)) {
@@ -25982,7 +25987,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
25982
25987
auto &Context = MF.getMMI().getContext();
25983
25988
MCSymbol *S = Context.getOrCreateSymbol(Twine("GCC_except_table") +
25984
25989
Twine(MF.getFunctionNumber()));
25985
- return DAG.getNode(getGlobalWrapperKind(), dl, VT,
25990
+ return DAG.getNode(getGlobalWrapperKind(nullptr, /*OpFlags=*/0 ), dl, VT,
25986
25991
DAG.getMCSymbol(S, PtrVT));
25987
25992
}
25988
25993
0 commit comments