diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-10 20:53:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-10 20:53:38 +0000 |
commit | 144e348b50f6be7774a99b2426315e006f316877 (patch) | |
tree | 5856893690b71c2c6a1c55667b8f76f2d34c6885 /lib | |
parent | 4a94893171be00461ecc4266280d39d6abc3f555 (diff) | |
download | external_llvm-144e348b50f6be7774a99b2426315e006f316877.zip external_llvm-144e348b50f6be7774a99b2426315e006f316877.tar.gz external_llvm-144e348b50f6be7774a99b2426315e006f316877.tar.bz2 |
some minor simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86Subtarget.cpp | 44 |
2 files changed, 32 insertions, 14 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 20ae002..c5a0c89 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -3270,7 +3270,7 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI, unsigned X86InstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const { const TargetInstrDesc &Desc = MI->getDesc(); - bool IsPIC = (TM.getRelocationModel() == Reloc::PIC_); + bool IsPIC = TM.getRelocationModel() == Reloc::PIC_; bool Is64BitMode = TM.getSubtargetImpl()->is64Bit(); unsigned Size = GetInstSizeWithDesc(*MI, &Desc, IsPIC, Is64BitMode); if (Desc.getOpcode() == X86::MOVPC32r) diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index c68b29b..db9a09f 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -87,35 +87,53 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const { return X86II::MO_GOT; } - if (isPICStyleStubAny()) { - // In Darwin/32, we have multiple different stub types, and we have both PIC - // and -mdynamic-no-pic. Determine whether we have a stub reference - // and/or whether the reference is relative to the PIC base or not. - bool IsPIC = TM.getRelocationModel() == Reloc::PIC_; + if (isPICStyleStubPIC(TM)) { // Darwin/32 in PIC mode. + // Determine whether we have a stub reference and/or whether the reference + // is relative to the PIC base or not. // If this is a strong reference to a definition, it is definitely not // through a stub. if (!GV->isDeclaration() && !GV->isWeakForLinker()) - return IsPIC ? X86II::MO_PIC_BASE_OFFSET : 0; + return X86II::MO_PIC_BASE_OFFSET; // Unless we have a symbol with hidden visibility, we have to go through a // normal $non_lazy_ptr stub because this symbol might be resolved late. - if (!GV->hasHiddenVisibility()) { - // Non-hidden $non_lazy_ptr reference. - return IsPIC ? X86II::MO_DARWIN_NONLAZY_PIC_BASE : - X86II::MO_DARWIN_NONLAZY; + if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference. + return X86II::MO_DARWIN_NONLAZY_PIC_BASE; + + // If symbol visibility is hidden, we have a stub for common symbol + // references and external declarations. + if (GV->isDeclaration() || GV->hasCommonLinkage()) { + // Hidden $non_lazy_ptr reference. + return X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE; } + // Otherwise, no stub. + return X86II::MO_PIC_BASE_OFFSET; + } + + if (isPICStyleStubNoDynamic(TM)) { // Darwin/32 in -mdynamic-no-pic mode. + // Determine whether we have a stub reference. + + // If this is a strong reference to a definition, it is definitely not + // through a stub. + if (!GV->isDeclaration() && !GV->isWeakForLinker()) + return X86II::MO_NO_FLAG; + + // Unless we have a symbol with hidden visibility, we have to go through a + // normal $non_lazy_ptr stub because this symbol might be resolved late. + if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference. + return X86II::MO_DARWIN_NONLAZY; + // If symbol visibility is hidden, we have a stub for common symbol // references and external declarations. if (GV->isDeclaration() || GV->hasCommonLinkage()) { // Hidden $non_lazy_ptr reference. - return IsPIC ? X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE : - X86II::MO_DARWIN_HIDDEN_NONLAZY; + return X86II::MO_DARWIN_HIDDEN_NONLAZY; } // Otherwise, no stub. - return IsPIC ? X86II::MO_PIC_BASE_OFFSET : 0; + return X86II::MO_NO_FLAG; } // Direct static reference to global. |