Go to the documentation of this file.
20 #include "llvm/IR/IntrinsicsAMDGPU.h"
21 #include "llvm/IR/IntrinsicsR600.h"
24 #define DEBUG_TYPE "amdgpu-annotate-kernel-features"
40 bool doInitialization(
CallGraph &CG)
override;
44 return "AMDGPU Annotate Kernel Features";
60 "Add AMDGPU function attributes",
false,
false)
62 bool AMDGPUAnnotateKernelFeatures::addFeatureAttributes(
Function &
F) {
63 bool HaveStackObjects =
false;
65 bool HaveCall =
false;
70 if (isa<AllocaInst>(
I)) {
71 HaveStackObjects =
true;
75 if (
auto *CB = dyn_cast<CallBase>(&
I)) {
77 dyn_cast<Function>(CB->getCalledOperand()->stripPointerCasts());
81 if (!CB->isInlineAsm())
99 if (!IsFunc && HaveCall) {
100 F.addFnAttr(
"amdgpu-calls");
104 if (HaveStackObjects) {
105 F.addFnAttr(
"amdgpu-stack-objects");
113 bool Changed =
false;
122 Changed |= addFeatureAttributes(*
F);
128 bool AMDGPUAnnotateKernelFeatures::doInitialization(
CallGraph &CG) {
129 auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
138 return new AMDGPUAnnotateKernelFeatures();
This is an optimization pass for GlobalISel generic memory operations.
The basic data container for the call graph of a Module of IR.
LLVM Basic Block Representation.
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
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.
A node in the call graph for a module.
Pass * createAMDGPUAnnotateKernelFeaturesPass()
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool isEntryFunctionCC(CallingConv::ID CC)
INITIALIZE_PASS(AMDGPUAnnotateKernelFeatures, DEBUG_TYPE, "Add AMDGPU function attributes", false, false) bool AMDGPUAnnotateKernelFeatures
void getAnalysisUsage(AnalysisUsage &Info) const override
getAnalysisUsage - For this class, we declare that we require and preserve the call graph.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
bool isGraphics(CallingConv::ID cc)
amdgpu Simplify well known AMD library false FunctionCallee Callee
void setPreservesAll()
Set by analyses that do not transform their input at all.
Pass interface - Implemented by all 'passes'.
const char LLVMTargetMachineRef TM
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
char & AMDGPUAnnotateKernelFeaturesID