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