#include "llvm/CodeGen/PreISelIntrinsicLowering.h"
#include "llvm/Analysis/ObjCARCInstKind.h"
#include "llvm/Analysis/ObjCARCUtil.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/ExpandVectorPredication.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h"
#include "llvm/Transforms/Utils/LowerMemIntrinsics.h"
usingnamespacellvm;
static cl::opt<int64_t> MemIntrinsicExpandSizeThresholdOpt(
"mem-intrinsic-expand-size",
cl::desc("Set minimum mem intrinsic size to expand in IR"), cl::init(-1),
cl::Hidden);
namespace {
struct PreISelIntrinsicLowering { … };
}
template <class T> static bool forEachCall(Function &Intrin, T Callback) { … }
static bool lowerLoadRelative(Function &F) { … }
static CallInst::TailCallKind getOverridingTailCallKind(const Function &F) { … }
static bool lowerObjCCall(Function &F, const char *NewFn,
bool setNonLazyBind = false) { … }
bool PreISelIntrinsicLowering::shouldExpandMemIntrinsicWithSize(
Value *Size, const TargetTransformInfo &TTI) { … }
static bool canEmitLibcall(const TargetMachine *TM, Function *F,
RTLIB::Libcall LC) { … }
bool PreISelIntrinsicLowering::expandMemIntrinsicUses(Function &F) const { … }
bool PreISelIntrinsicLowering::lowerIntrinsics(Module &M) const { … }
namespace {
class PreISelIntrinsicLoweringLegacyPass : public ModulePass { … };
}
char PreISelIntrinsicLoweringLegacyPass::ID;
INITIALIZE_PASS_BEGIN(PreISelIntrinsicLoweringLegacyPass,
"pre-isel-intrinsic-lowering",
"Pre-ISel Intrinsic Lowering", false, false)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
INITIALIZE_PASS_END(PreISelIntrinsicLoweringLegacyPass,
"pre-isel-intrinsic-lowering",
"Pre-ISel Intrinsic Lowering", false, false)
ModulePass *llvm::createPreISelIntrinsicLoweringPass() { … }
PreservedAnalyses PreISelIntrinsicLoweringPass::run(Module &M,
ModuleAnalysisManager &AM) { … }