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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

22#include

23

24using namespace llvm;

25

26#define DEBUG_TYPE "wasm-lower-reftypes-intptr-conv"

27

28namespace {

29class WebAssemblyLowerRefTypesIntPtrConv final : public FunctionPass {

30 StringRef getPassName() const override {

31 return "WebAssembly Lower RefTypes Int-Ptr Conversions";

32 }

33

35

36public:

37 static char ID;

38 WebAssemblyLowerRefTypesIntPtrConv() : FunctionPass(ID) {}

39};

40}

41

42char WebAssemblyLowerRefTypesIntPtrConv::ID = 0;

44 "WebAssembly Lower RefTypes Int-Ptr Conversions", false, false)

45

47 return new WebAssemblyLowerRefTypesIntPtrConv();

48}

49

50bool WebAssemblyLowerRefTypesIntPtrConv::runOnFunction(Function &F) {

51 LLVM_DEBUG(dbgs() << "********** Lower RefTypes IntPtr Convs **********\n"

52 "********** Function: "

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

54

55

56

57

58

59

60

61 std::set<Instruction *> worklist;

62

69 continue;

70

72

76

77 worklist.insert(&*I);

78 }

79

80

81 for (Instruction *I : worklist)

82 I->eraseFromParent();

83

84 return !worklist.empty();

85}

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

static bool runOnFunction(Function &F, bool PostInlining)

#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)

This file declares the WebAssembly-specific subclass of TargetSubtarget.

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.

static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Type * getDestTy() const

Return the destination type, as a convenience.

FunctionPass class - This class is used to implement most global optimizations.

static LLVM_ABI PoisonValue * get(Type *T)

Static factory methods - Return an 'poison' object of the specified type.

Value * getPointerOperand()

Gets the pointer operand.

StringRef - Represent a constant reference to a string, i.e.

Type * getType() const

All values are typed, get the type of this value.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})

Look up the Function declaration of the intrinsic id in the Module M.

bool isWebAssemblyReferenceType(const Type *Ty)

Return true if this is a WebAssembly Reference Type.

This is an optimization pass for GlobalISel generic memory operations.

InstIterator< SymbolTableList< BasicBlock >, Function::iterator, BasicBlock::iterator, Instruction > inst_iterator

FunctionPass * createWebAssemblyLowerRefTypesIntPtrConv()

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

inst_iterator inst_begin(Function *F)

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

inst_iterator inst_end(Function *F)