27#define DEBUG_TYPE "wasm-ref-type-mem2local"
30class WebAssemblyRefTypeMem2LocalImpl
31 :
public InstVisitor<WebAssemblyRefTypeMem2LocalImpl> {
39class WebAssemblyRefTypeMem2LocalLegacy final :
public FunctionPass {
41 return "WebAssembly Reference Types Memory to Local";
53 WebAssemblyRefTypeMem2LocalLegacy() :
FunctionPass(ID) {}
57char WebAssemblyRefTypeMem2LocalLegacy::ID = 0;
59 "Assign reference type allocas to local address space",
true,
63 return new WebAssemblyRefTypeMem2LocalLegacy();
66void WebAssemblyRefTypeMem2LocalImpl::visitAllocaInst(
AllocaInst &AI) {
71 WebAssembly::WASM_ADDRESS_SPACE_VAR,
nullptr,
92bool WebAssemblyRefTypeMem2LocalImpl::runOnFunction(
Function &
F) {
93 LLVM_DEBUG(
dbgs() <<
"********** WebAssembly RefType Mem2Local **********\n"
94 "********** Function: "
95 <<
F.getName() <<
'\n');
97 if (
F.getFnAttribute(
"target-features")
99 .contains(
"+reference-types"))
104bool WebAssemblyRefTypeMem2LocalLegacy::runOnFunction(
Function &
F) {
105 WebAssemblyRefTypeMem2LocalImpl Impl;
106 return Impl.runOnFunction(
F);
112 WebAssemblyRefTypeMem2LocalImpl Impl;
113 return Impl.runOnFunction(
F)
static bool runOnFunction(Function &F, bool PostInlining)
This header defines various interfaces for pass management in LLVM.
FunctionAnalysisManager FAM
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static void visit(BasicBlock &Start, std::function< bool(BasicBlock *)> 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
Align getAlign() const
Return the alignment of the memory that is being allocated by the instruction.
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
FunctionPass class - This class is used to implement most global optimizations.
Base class for instruction visitors.
LLVM_ABI 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...
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Represent a constant reference to a string, i.e.
static LLVM_ABI 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()
bool hasValueHandle() const
Return true if there is a value handle associated with this value.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Pass manager infrastructure for declaring and invalidating analyses.
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
IRBuilder(LLVMContext &, FolderTy, InserterTy) -> IRBuilder< FolderTy, InserterTy >
FunctionPass * createWebAssemblyRefTypeMem2LocalLegacyPass()
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.