LLVM: lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

22using namespace llvm;

23

24#define DEBUG_TYPE "wasm-ref-type-mem2local"

25

26namespace {

27class WebAssemblyRefTypeMem2Local final

29 public InstVisitor {

30 StringRef getPassName() const override {

31 return "WebAssembly Reference Types Memory to Local";

32 }

33

34 void getAnalysisUsage(AnalysisUsage &AU) const override {

37 }

38

41

42public:

43 static char ID;

45

47};

48}

49

50char WebAssemblyRefTypeMem2Local::ID = 0;

52 "Assign reference type allocas to local address space", true,

53 false)

54

56 return new WebAssemblyRefTypeMem2Local();

57}

58

59void WebAssemblyRefTypeMem2Local::visitAllocaInst(AllocaInst &AI) {

63 IRB.SetInsertPoint(&AI);

67

68

69

70

77 U.set(NewAI);

78 }

79

81 }

82}

83

84bool WebAssemblyRefTypeMem2Local::runOnFunction(Function &F) {

85 LLVM_DEBUG(dbgs() << "********** WebAssembly RefType Mem2Local **********\n"

86 "********** Function: "

87 << F.getName() << '\n');

88

89 if (F.getFnAttribute("target-features")

90 .getValueAsString()

91 .contains("+reference-types"))

94}

static bool runOnFunction(Function &F, bool PostInlining)

#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.

LLVM_ABI 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.

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...

StringRef - 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()

LLVM_ABI 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.

LLVM_ABI 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.

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.

FunctionPass * createWebAssemblyRefTypeMem2Local()

IRBuilder(LLVMContext &, FolderTy, InserterTy, MDNode *, ArrayRef< OperandBundleDef >) -> IRBuilder< FolderTy, InserterTy >