summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-04-22 21:18:02 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-04-22 21:18:02 +0000
commit7dd8dbf48652dfddd08cb7a6de0f2b079be45ea8 (patch)
tree5dfcc400c31a3efdcb20c300d9d24cdb262ac16c /llvm/lib/CodeGen/LLVMTargetMachine.cpp
parentb29465fe478b92e896e7d1de5d48fcc35f115a5e (diff)
downloadbcm5719-llvm-7dd8dbf48652dfddd08cb7a6de0f2b079be45ea8.tar.gz
bcm5719-llvm-7dd8dbf48652dfddd08cb7a6de0f2b079be45ea8.zip
Introduce llvm.load.relative intrinsic.
This intrinsic takes two arguments, ``%ptr`` and ``%offset``. It loads a 32-bit value from the address ``%ptr + %offset``, adds ``%ptr`` to that value and returns it. The constant folder specifically recognizes the form of this intrinsic and the constant initializers it may load from; if a loaded constant initializer is known to have the form ``i32 trunc(x - %ptr)``, the intrinsic call is folded to ``x``. LLVM provides that the calculation of such a constant initializer will not overflow at link time under the medium code model if ``x`` is an ``unnamed_addr`` function. However, it does not provide this guarantee for a constant initializer folded into a function body. This intrinsic can be used to avoid the possibility of overflows when loading from such a constant. Differential Revision: http://reviews.llvm.org/D18367 llvm-svn: 267223
Diffstat (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index a19049360c0..ea113c894cf 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -102,6 +102,8 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
if (TM->Options.EmulatedTLS)
PM.add(createLowerEmuTLSPass(TM));
+ PM.add(createPreISelIntrinsicLoweringPass());
+
// Add internal analysis passes from the target machine.
PM.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
OpenPOWER on IntegriCloud