39 if (!CI || CI->getCalledValue() != &
F)
44 B.CreateGEP(Int8Ty, CI->getArgOperand(0), CI->getArgOperand(1));
45 Value *OffsetPtrI32 =
B.CreateBitCast(OffsetPtr, Int32PtrTy);
46 Value *OffsetI32 =
B.CreateAlignedLoad(OffsetPtrI32, 4);
48 Value *ResultPtr =
B.CreateGEP(Int8Ty, CI->getArgOperand(0), OffsetI32);
50 CI->replaceAllUsesWith(ResultPtr);
51 CI->eraseFromParent();
58 bool lowerIntrinsics(
Module &M) {
62 Changed |= lowerLoadRelative(F);
67 class PreISelIntrinsicLoweringLegacyPass :
public ModulePass {
72 bool runOnModule(
Module &M) {
return lowerIntrinsics(M); }
79 "pre-isel-intrinsic-lowering",
"Pre-ISel Intrinsic Lowering",
84 return new PreISelIntrinsicLoweringLegacyPass;
89 if (!lowerIntrinsics(M))
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
A Module instance is used to store all the information related to an LLVM module. ...
This class represents a function call, abstracting a target machine's calling convention.
StringRef getName() const
Return a constant reference to the value's name.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
A set of analyses that are preserved following a run of a transformation pass.
The instances of the Type class are immutable: once they are created, they are never changed...
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Module.h This file contains the declarations for the Module class.
INITIALIZE_PASS(PreISelIntrinsicLoweringLegacyPass,"pre-isel-intrinsic-lowering","Pre-ISel Intrinsic Lowering", false, false) namespace llvm
static IntegerType * getInt32Ty(LLVMContext &C)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
LLVM Value Representation.
ModulePass * createPreISelIntrinsicLoweringPass()
This pass lowers the .load.relative intrinsic to instructions.
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
A container for analyses that lazily runs them and caches their results.
static IntegerType * getInt8Ty(LLVMContext &C)