24#include "llvm/IR/IntrinsicsAArch64.h"
32#define DEBUG_TYPE "aarch64-sme-abi"
49static const char *
name =
"SME ABI Pass";
62 FunctionType::get(
Builder.getVoidTy(), {},
false);
68 M->getOrInsertFunction(
"__arm_tpidr2_save", TPIDR2SaveTy, Attrs);
96 Builder.SetInsertPoint(PreludeBB);
102 Builder.CreateCmp(ICmpInst::ICMP_NE, TPIDR2,
Builder.getInt64(0),
"cmp");
103 Builder.CreateCondBr(Cmp, SaveBB, OrigBB);
106 Builder.SetInsertPoint(&SaveBB->back());
118 if (!
T || !isa<ReturnInst>(
T))
126 F->addFnAttr(
"aarch64_expanded_pstate_za");
135 if (
F.isDeclaration() ||
F.hasFnAttribute(
"aarch64_expanded_pstate_za"))
138 bool Changed =
false;
140 if (FnAttrs.hasNewZAInterface())
141 Changed |= updateNewZAFunctions(M, &
F, Builder);
amdgpu Simplify well known AMD library false FunctionCallee Callee
This file contains the declarations for the subclasses of Constant, which represent the different fla...
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
void emitTPIDR2Save(Module *M, IRBuilder<> &Builder)
This file defines the SmallVector class.
AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a function attribute to the list.
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
const Instruction & front() const
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="", bool Before=false)
Split the basic block into two basic blocks at the specified instruction.
This class represents a function call, abstracting a target machine's calling convention.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
This is an important class for using LLVM in a threaded context.
A Module instance is used to store all the information related to an LLVM module.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
SMEAttrs is a utility class to parse the SME ACLE attributes on functions.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0
Preserve X0-X13, X19-X29, SP, Z0-Z31, P0-P15.
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createSMEABIPass()
void initializeSMEABIPass(PassRegistry &)