From c7e98132285502ae4ad8586778be86e2850cd392 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 20 May 2016 12:20:10 +0000 Subject: Refactor X86 symbol access classification. This refactors the logic in X86 to avoid code duplication. It also splits it in two steps: it first decides if a symbol is local to the DSO and then uses that information to decide how to access it. The first part is implemented by shouldAssumeDSOLocal. It is not in any way specific to X86. In a followup patch I intend to move it to somewhere common and reused it in other backends. llvm-svn: 270209 --- llvm/lib/Target/X86/X86Subtarget.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Target/X86/X86Subtarget.h') diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h index 68672c28060..f77a33f2348 100644 --- a/llvm/lib/Target/X86/X86Subtarget.h +++ b/llvm/lib/Target/X86/X86Subtarget.h @@ -556,18 +556,17 @@ public: } } - /// Determine if this global is defined in a Position Independent - /// Executable (PIE) where its definition cannot be interposed. - bool isGlobalDefinedInPIE(const GlobalValue *GV) const { - return GV->getParent()->getPIELevel() != PIELevel::Default && - !GV->isDeclarationForLinker(); - } - /// Classify a global variable reference for the current subtarget according /// to how we should reference it in a non-pcrel context. + unsigned char classifyLocalReference(const GlobalValue *GV) const; + + unsigned char classifyGlobalReference(const GlobalValue *GV, + const Module &M) const; unsigned char classifyGlobalReference(const GlobalValue *GV) const; /// Classify a global function reference for the current subtarget. + unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, + const Module &M) const; unsigned char classifyGlobalFunctionReference(const GlobalValue *GV) const; /// Classify a blockaddress reference for the current subtarget according to -- cgit v1.2.3