mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
GV with ghost linkage (module being lazily streamed in in JIT lazy compilation mode) do not require extra load from stub. This fixes ExecutionEngine/2005-12-02-TailCallBug.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76121 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
423ccfe51d
commit
a82b22c667
@ -44,6 +44,10 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
if (GV->hasDLLImportLinkage())
|
if (GV->hasDLLImportLinkage())
|
||||||
return X86II::MO_DLLIMPORT;
|
return X86II::MO_DLLIMPORT;
|
||||||
|
|
||||||
|
// GV with ghost linkage (in JIT lazy compilation mode) do not require an
|
||||||
|
// extra load from stub.
|
||||||
|
bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
|
||||||
|
|
||||||
// X86-64 in PIC mode.
|
// X86-64 in PIC mode.
|
||||||
if (isPICStyleRIPRel()) {
|
if (isPICStyleRIPRel()) {
|
||||||
// Large model never uses stubs.
|
// Large model never uses stubs.
|
||||||
@ -55,7 +59,7 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
// target is x86-64 or the symbol is definitely defined in the current
|
// target is x86-64 or the symbol is definitely defined in the current
|
||||||
// translation unit.
|
// translation unit.
|
||||||
if (GV->hasDefaultVisibility() &&
|
if (GV->hasDefaultVisibility() &&
|
||||||
(GV->isDeclaration() || GV->isWeakForLinker()))
|
(isDecl || GV->isWeakForLinker()))
|
||||||
return X86II::MO_GOTPCREL;
|
return X86II::MO_GOTPCREL;
|
||||||
} else {
|
} else {
|
||||||
assert(isTargetELF() && "Unknown rip-relative target");
|
assert(isTargetELF() && "Unknown rip-relative target");
|
||||||
@ -81,7 +85,7 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
|
|
||||||
// If this is a strong reference to a definition, it is definitely not
|
// If this is a strong reference to a definition, it is definitely not
|
||||||
// through a stub.
|
// through a stub.
|
||||||
if (!GV->isDeclaration() && !GV->isWeakForLinker())
|
if (!isDecl && !GV->isWeakForLinker())
|
||||||
return X86II::MO_PIC_BASE_OFFSET;
|
return X86II::MO_PIC_BASE_OFFSET;
|
||||||
|
|
||||||
// Unless we have a symbol with hidden visibility, we have to go through a
|
// Unless we have a symbol with hidden visibility, we have to go through a
|
||||||
@ -91,7 +95,7 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
|
|
||||||
// If symbol visibility is hidden, we have a stub for common symbol
|
// If symbol visibility is hidden, we have a stub for common symbol
|
||||||
// references and external declarations.
|
// references and external declarations.
|
||||||
if (GV->isDeclaration() || GV->hasCommonLinkage()) {
|
if (isDecl || GV->hasCommonLinkage()) {
|
||||||
// Hidden $non_lazy_ptr reference.
|
// Hidden $non_lazy_ptr reference.
|
||||||
return X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE;
|
return X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE;
|
||||||
}
|
}
|
||||||
@ -105,7 +109,7 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
|
|
||||||
// If this is a strong reference to a definition, it is definitely not
|
// If this is a strong reference to a definition, it is definitely not
|
||||||
// through a stub.
|
// through a stub.
|
||||||
if (!GV->isDeclaration() && !GV->isWeakForLinker())
|
if (!isDecl && !GV->isWeakForLinker())
|
||||||
return X86II::MO_NO_FLAG;
|
return X86II::MO_NO_FLAG;
|
||||||
|
|
||||||
// Unless we have a symbol with hidden visibility, we have to go through a
|
// Unless we have a symbol with hidden visibility, we have to go through a
|
||||||
@ -115,7 +119,7 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
|
|
||||||
// If symbol visibility is hidden, we have a stub for common symbol
|
// If symbol visibility is hidden, we have a stub for common symbol
|
||||||
// references and external declarations.
|
// references and external declarations.
|
||||||
if (GV->isDeclaration() || GV->hasCommonLinkage()) {
|
if (isDecl || GV->hasCommonLinkage()) {
|
||||||
// Hidden $non_lazy_ptr reference.
|
// Hidden $non_lazy_ptr reference.
|
||||||
return X86II::MO_DARWIN_HIDDEN_NONLAZY;
|
return X86II::MO_DARWIN_HIDDEN_NONLAZY;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user