diff options
Diffstat (limited to 'lib/Target/SystemZ/SystemZSubtarget.cpp')
-rw-r--r-- | lib/Target/SystemZ/SystemZSubtarget.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Target/SystemZ/SystemZSubtarget.cpp b/lib/Target/SystemZ/SystemZSubtarget.cpp index 9c3262e722..18a8e1633d 100644 --- a/lib/Target/SystemZ/SystemZSubtarget.cpp +++ b/lib/Target/SystemZ/SystemZSubtarget.cpp @@ -14,6 +14,7 @@ #include "SystemZSubtarget.h" #include "SystemZ.h" #include "SystemZGenSubtarget.inc" +#include "llvm/GlobalValue.h" #include "llvm/Target/TargetMachine.h" using namespace llvm; @@ -26,3 +27,21 @@ SystemZSubtarget::SystemZSubtarget(const TargetMachine &TM, const Module &M, // Parse features string. ParseSubtargetFeatures(FS, CPU); } + +/// True if accessing the GV requires an extra load. +bool SystemZSubtarget::GVRequiresExtraLoad(const GlobalValue* GV, + const TargetMachine& TM, + bool isDirectCall) const { + if (TM.getRelocationModel() == Reloc::PIC_) { + // Extra load is needed for all externally visible. + if (isDirectCall) + return false; + + if (GV->hasLocalLinkage() || GV->hasHiddenVisibility()) + return false; + + return true; + } + + return false; +} |