Go to the documentation of this file.
25 #define DEBUG_TYPE "ppc-lower-massv-entries"
32 #define TLI_DEFINE_MASSV_VECFUNCS_NAMES
33 #include "llvm/Analysis/VecFuncs.def"
36 class PPCLowerMASSVEntries :
public ModulePass {
42 bool runOnModule(
Module &
M)
override;
44 StringRef getPassName()
const override {
return "PPC Lower MASS Entries"; }
53 static std::string createMASSVFuncName(
Function &Func,
88 "Mininum subtarget for -vector-library=MASSV option is Power8 on Linux "
89 "and Power7 on AIX when vectorization is not disabled.");
95 PPCLowerMASSVEntries::createMASSVFuncName(
Function &Func,
97 StringRef Suffix = getCPUSuffix(Subtarget);
98 auto GenericName =
Func.getName().str();
99 std::string MASSVEntryName = GenericName + Suffix.
str();
100 return MASSVEntryName;
105 bool PPCLowerMASSVEntries::handlePowSpecialCases(
CallInst *CI,
Function &Func,
107 if (
Func.getName() !=
"__powf4" &&
Func.getName() !=
"__powd2")
111 if (
ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(
Exp->getSplatValue())) {
117 if (!CFP->isExactlyValue(0.75) && !CFP->isExactlyValue(0.25))
141 if (handlePowSpecialCases(CI, Func, M))
144 std::string MASSVEntryName = createMASSVFuncName(Func, Subtarget);
146 MASSVEntryName,
Func.getFunctionType(),
Func.getAttributes());
153 bool PPCLowerMASSVEntries::runOnModule(
Module &M) {
154 bool Changed =
false;
156 auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
164 if (!
Func.isDeclaration())
167 if (!isMASSVFunc(
Func.getName()))
175 for (
auto *
User : MASSVUsers) {
176 auto *CI = dyn_cast<CallInst>(
User);
181 Changed |= lowerMASSVCall(CI, Func, M, Subtarget);
196 return new PPCLowerMASSVEntries();
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
const Function * getParent() const
Return the enclosing method, or null if none.
void setCalledFunction(Function *Fn)
Sets the function called, including updating the function type.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
bool hasApproxFunc() const
Determine whether the approximate-math-functions flag is set.
Represent the analysis usage information of a pass.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
ConstantFP - Floating Point Values [float, double].
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
ModulePass * createPPCLowerMASSVEntriesPass()
This is an important base class in LLVM.
INITIALIZE_PASS(PPCLowerMASSVEntries, DEBUG_TYPE, "Lower MASSV entries", false, false) ModulePass *llvm
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
Type * getType() const
All values are typed, get the type of this value.
Common code between 32-bit and 64-bit PowerPC targets.
char & PPCLowerMASSVEntriesID
Value * getArgOperand(unsigned i) const
const BasicBlock * getParent() const
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
bool hasNoInfs() const
Determine whether the no-infs flag is set.
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
const char LLVMTargetMachineRef TM
This class represents a function call, abstracting a target machine's calling convention.
AnalysisUsage & addRequired()
bool hasP10Vector() const