24#define DEBUG_TYPE "wasm-ref-type-mem2local"
27class WebAssemblyRefTypeMem2Local final
31 return "WebAssembly Reference Types Memory to Local";
50char WebAssemblyRefTypeMem2Local::ID = 0;
52 "Assign reference type allocas to local address space",
true,
56 return new WebAssemblyRefTypeMem2Local();
59void WebAssemblyRefTypeMem2Local::visitAllocaInst(
AllocaInst &AI) {
63 IRB.SetInsertPoint(&AI);
84bool WebAssemblyRefTypeMem2Local::runOnFunction(
Function &
F) {
85 LLVM_DEBUG(
dbgs() <<
"********** WebAssembly RefType Mem2Local **********\n"
86 "********** Function: "
87 <<
F.getName() <<
'\n');
89 if (
F.getFnAttribute(
"target-features")
91 .contains(
"+reference-types"))
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
void visit(MachineFunction &MF, MachineBasicBlock &Start, std::function< void(MachineBasicBlock *)> op)
This file contains the declaration of the WebAssembly-specific type parsing utility functions.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
an instruction to allocate memory on the stack
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
Represent the analysis usage information of a pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
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.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Base class for instruction visitors.
RetTy visitAllocaInst(AllocaInst &I)
InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
A Use represents the edge between a Value definition and its users.
static void ValueIsRAUWd(Value *Old, Value *New)
bool materialized_use_empty() const
bool isUsedByMetadata() const
Return true if there is metadata referencing this value.
use_iterator materialized_use_begin()
LLVMContext & getContext() const
All values hold a context through their type.
bool hasValueHandle() const
Return true if there is a value handle associated with this value.
StringRef getName() const
Return a constant reference to the value's name.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool isWebAssemblyReferenceType(const Type *Ty)
Return true if this is a WebAssembly Reference Type.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionPass * createWebAssemblyRefTypeMem2Local()