Skip to content

Commit

Permalink
[X86Subtarget] Use isPositionIndependent(). NFC.
Browse files Browse the repository at this point in the history
Differential Revision:  http://reviews.llvm.org/D21480

llvm-svn: 273071
  • Loading branch information
dcci committed Jun 18, 2016
1 parent 2525501 commit ef5d8be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Target/X86/X86Subtarget.cpp
Expand Up @@ -66,7 +66,7 @@ X86Subtarget::classifyLocalReference(const GlobalValue *GV) const {

// If this is for a position dependent executable, the static linker can
// figure it out.
if (TM.getRelocationModel() != Reloc::PIC_)
if (!isPositionIndependent())
return X86II::MO_NO_FLAG;

// The COFF dynamic linker just patches the executable sections.
Expand Down Expand Up @@ -104,7 +104,7 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
return X86II::MO_GOTPCREL;

if (isTargetDarwin()) {
if (RM != Reloc::PIC_)
if (!isPositionIndependent())
return X86II::MO_DARWIN_NONLAZY;
return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
}
Expand Down Expand Up @@ -334,7 +334,7 @@ X86Subtarget::X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
} else if (isTargetCOFF()) {
setPICStyle(PICStyles::None);
} else if (isTargetDarwin()) {
if (TM.getRelocationModel() == Reloc::PIC_)
if (isPositionIndependent())
setPICStyle(PICStyles::StubPIC);
else {
assert(TM.getRelocationModel() == Reloc::DynamicNoPIC);
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/X86/X86Subtarget.h
Expand Up @@ -533,6 +533,10 @@ class X86Subtarget final : public X86GenSubtargetInfo {
PICStyle == PICStyles::StubPIC;
}

bool isPositionIndependent() const {
return TM.getRelocationModel() == Reloc::PIC_;
}

bool isCallingConvWin64(CallingConv::ID CC) const {
switch (CC) {
// On Win64, all these conventions just use the default convention.
Expand Down

0 comments on commit ef5d8be

Please sign in to comment.