aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/SystemZSubtarget.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:16:05 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:16:05 +0000
commit6fe326c713c25e33e7e3ea3d1202ba19a19090c5 (patch)
treee8b7e30b19761f001bf7ef80cf05472f74948967 /lib/Target/SystemZ/SystemZSubtarget.cpp
parent48e8b3cc5841f0652430aa9f0ce3eb9fa09bdcda (diff)
Implement 'large' PIC model
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/SystemZSubtarget.cpp')
-rw-r--r--lib/Target/SystemZ/SystemZSubtarget.cpp19
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;
+}