Go to the documentation of this file.
25 #define DEBUG_TYPE "ppc-gen-scalar-mass"
31 class PPCGenScalarMASSEntries :
public ModulePass {
37 #define TLI_DEFINE_SCALAR_MASS_FUNCS
38 #include "llvm/Analysis/ScalarFuncs.def"
42 bool runOnModule(
Module &
M)
override;
45 return "PPC Generate Scalar MASS Entries";
53 std::map<StringRef, StringRef> ScalarMASSFuncs;
54 bool isCandidateSafeToLower(
const CallInst &CI)
const;
55 bool isFiniteCallSafe(
const CallInst &CI)
const;
64 bool PPCGenScalarMASSEntries::isCandidateSafeToLower(
const CallInst &CI)
const {
66 if (!isa<FPMathOperator>(CI))
74 bool PPCGenScalarMASSEntries::isFiniteCallSafe(
const CallInst &CI)
const {
76 if (!isa<FPMathOperator>(CI))
87 bool PPCGenScalarMASSEntries::createScalarMASSCall(
StringRef MASSEntry,
94 assert(M &&
"Expecting a valid Module");
96 std::string MASSEntryStr = MASSEntry.
str();
97 if (isFiniteCallSafe(CI))
98 MASSEntryStr +=
"_finite";
101 MASSEntryStr,
Func.getFunctionType(),
Func.getAttributes());
108 bool PPCGenScalarMASSEntries::runOnModule(
Module &M) {
109 bool Changed =
false;
111 auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
112 if (!TPC || skipModule(M))
116 if (!
Func.isDeclaration())
119 auto Iter = ScalarMASSFuncs.find(
Func.getName());
120 if (Iter == ScalarMASSFuncs.end())
128 TheUsers.push_back(
User);
130 for (
auto *
User : TheUsers)
131 if (
auto *CI = dyn_cast_or_null<CallInst>(
User)) {
132 if (isCandidateSafeToLower(*CI))
133 Changed |= createScalarMASSCall(Iter->second, *CI, Func);
145 "Generate Scalar MASS entries",
false,
false)
148 return new PPCGenScalarMASSEntries();
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
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
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.
ModulePass * createPPCGenScalarMASSEntriesPass()
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.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
bool hasNoNaNs() const
Determine whether the no-NaNs flag is set.
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.
This class represents a function call, abstracting a target machine's calling convention.
AnalysisUsage & addRequired()
INITIALIZE_PASS(PPCGenScalarMASSEntries, DEBUG_TYPE, "Generate Scalar MASS entries", false, false) ModulePass *llvm
char & PPCGenScalarMASSEntriesID