LLVM: lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMACHINEFUNCTIONINFO_H

16#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMACHINEFUNCTIONINFO_H

17

22

23namespace llvm {

25

27

28namespace yaml {

30}

31

32

33

35 std::vector Params;

36 std::vector Results;

37 std::vector Locals;

38

39

40 std::vector WARegs;

41

42

43

44

45

46

47

49

50

51

52

53 unsigned VarargVreg = -1U;

54

55

56

57 unsigned BasePtrVreg = -1U;

58

59

60 unsigned FrameBaseVreg = -1U;

61

62

63 unsigned FrameBaseLocal = -1U;

64

65

66 bool CFGStackified = false;

67

68public:

72

76 const override;

77

80

82 const std::vector &getParams() const { return Params; }

83

85 const std::vector &getResults() const { return Results; }

86

88 Params.clear();

89 Results.clear();

90 }

91

92 void setNumLocals(size_t NumLocals) { Locals.resize(NumLocals, MVT::i32); }

93 void setLocal(size_t i, MVT VT) { Locals[i] = VT; }

95 const std::vector &getLocals() const { return Locals; }

96

98 assert(VarargVreg != -1U && "Vararg vreg hasn't been set");

99 return VarargVreg;

100 }

102

104 assert(BasePtrVreg != -1U && "Base ptr vreg hasn't been set");

105 return BasePtrVreg;

106 }

109 assert(FrameBaseVreg != -1U && "Frame base vreg hasn't been set");

110 return FrameBaseVreg;

111 }

113

117 assert(FrameBaseLocal != -1U && "Frame base local hasn't been set");

118 return FrameBaseLocal;

119 }

121

123 assert(MRI.getUniqueVRegDef(VReg));

125 if (I >= VRegStackified.size())

126 VRegStackified.resize(I + 1);

127 VRegStackified.set(I);

128 }

131 if (I < VRegStackified.size())

132 VRegStackified.reset(I);

133 }

136 if (I >= VRegStackified.size())

137 return false;

138 return VRegStackified.test(I);

139 }

140

145 assert(I < WARegs.size());

146 WARegs[I] = WAReg;

147 }

150 assert(I < WARegs.size());

151 return WARegs[I];

152 }

153

156};

157

159 LLVMContext &Ctx, const DataLayout &DL, Type *Ty,

160 SmallVectorImpl &ValueVTs);

161

163 SmallVectorImpl &ValueVTs);

164

165

166

168 const Function &ContextFunc, const TargetMachine &TM,

169 SmallVectorImpl &Params,

170 SmallVectorImpl &Results);

171

173

175 const SmallVectorImpl &Results,

176 const SmallVectorImpl &Params);

177

178namespace yaml {

179

181

183 std::vector Params;

184 std::vector Results;

186

187

189

193

196};

197

206

212

214 for (auto [Src, Dest] : SrcToUnwindDest)

215 YamlIO.mapRequired(std::to_string(Src), Dest);

216 }

217};

218

219}

220

221}

222

223#endif

unsigned const MachineRegisterInfo * MRI

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Function Alias Analysis Results

This file provides WebAssembly-specific target descriptions.

MachineRegisterInfo - Keep track of information for virtual and physical registers,...

Wrapper class representing virtual and physical registers.

unsigned virtRegIndex() const

Convert a virtual register number to a 0-based index.

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

TargetSubtargetInfo - Generic base class for all target subtargets.

LLVM Value Representation.

This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...

Definition WebAssemblyMachineFunctionInfo.h:34

void setFrameBaseVreg(unsigned Reg)

Definition WebAssemblyMachineFunctionInfo.h:107

bool isCFGStackified() const

Definition WebAssemblyMachineFunctionInfo.h:154

WebAssemblyFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)

Definition WebAssemblyMachineFunctionInfo.h:69

~WebAssemblyFunctionInfo() override

const std::vector< MVT > & getResults() const

Definition WebAssemblyMachineFunctionInfo.h:85

void stackifyVReg(MachineRegisterInfo &MRI, Register VReg)

Definition WebAssemblyMachineFunctionInfo.h:122

void addResult(MVT VT)

Definition WebAssemblyMachineFunctionInfo.h:84

unsigned getFrameBaseLocal() const

Definition WebAssemblyMachineFunctionInfo.h:116

void setLocal(size_t i, MVT VT)

Definition WebAssemblyMachineFunctionInfo.h:93

MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override

Make a functionally equivalent copy of this MachineFunctionInfo in MF.

void initWARegs(MachineRegisterInfo &MRI)

void addLocal(MVT VT)

Definition WebAssemblyMachineFunctionInfo.h:94

void clearParamsAndResults()

Definition WebAssemblyMachineFunctionInfo.h:87

void setBasePointerVreg(unsigned Reg)

Definition WebAssemblyMachineFunctionInfo.h:120

void setNumLocals(size_t NumLocals)

Definition WebAssemblyMachineFunctionInfo.h:92

void setVarargBufferVreg(unsigned Reg)

Definition WebAssemblyMachineFunctionInfo.h:101

void setCFGStackified(bool Value=true)

Definition WebAssemblyMachineFunctionInfo.h:155

unsigned getFrameBaseVreg() const

Definition WebAssemblyMachineFunctionInfo.h:108

void setFrameBaseLocal(unsigned Local)

Definition WebAssemblyMachineFunctionInfo.h:115

unsigned getVarargBufferVreg() const

Definition WebAssemblyMachineFunctionInfo.h:97

bool isVRegStackified(Register VReg) const

Definition WebAssemblyMachineFunctionInfo.h:134

unsigned getBasePointerVreg() const

Definition WebAssemblyMachineFunctionInfo.h:103

const std::vector< MVT > & getLocals() const

Definition WebAssemblyMachineFunctionInfo.h:95

void clearFrameBaseVreg()

Definition WebAssemblyMachineFunctionInfo.h:112

void setWAReg(Register VReg, unsigned WAReg)

Definition WebAssemblyMachineFunctionInfo.h:142

unsigned getWAReg(Register VReg) const

Definition WebAssemblyMachineFunctionInfo.h:148

void initializeBaseYamlFields(MachineFunction &MF, const yaml::WebAssemblyFunctionInfo &YamlMFI)

bool isFrameBaseVirtual() const

Definition WebAssemblyMachineFunctionInfo.h:114

void unstackifyVReg(Register VReg)

Definition WebAssemblyMachineFunctionInfo.h:129

void addParam(MVT VT)

Definition WebAssemblyMachineFunctionInfo.h:81

const std::vector< MVT > & getParams() const

Definition WebAssemblyMachineFunctionInfo.h:82

void mapOptional(StringRef Key, T &Val)

void mapRequired(StringRef Key, T &Val)

static const unsigned UnusedReg

DenseMap< int, int > BBNumberMap

Definition WebAssemblyMachineFunctionInfo.h:180

This is an optimization pass for GlobalISel generic memory operations.

void computeSignatureVTs(const FunctionType *Ty, const Function *TargetFunc, const Function &ContextFunc, const TargetMachine &TM, SmallVectorImpl< MVT > &Params, SmallVectorImpl< MVT > &Results)

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

ArrayRef(const T &OneElt) -> ArrayRef< T >

void valTypesFromMVTs(ArrayRef< MVT > In, SmallVectorImpl< wasm::ValType > &Out)

wasm::WasmSignature * signatureFromMVTs(MCContext &Ctx, const SmallVectorImpl< MVT > &Results, const SmallVectorImpl< MVT > &Params)

void computeLegalValueVTs(const WebAssemblyTargetLowering &TLI, LLVMContext &Ctx, const DataLayout &DL, Type *Ty, SmallVectorImpl< MVT > &ValueVTs)

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...

static void output(IO &YamlIO, BBNumberMap &SrcToUnwindDest)

Definition WebAssemblyMachineFunctionInfo.h:213

static void inputOne(IO &YamlIO, StringRef Key, BBNumberMap &SrcToUnwindDest)

Definition WebAssemblyMachineFunctionInfo.h:208

This class should be specialized by any type that needs to be converted to/from a YAML mapping in the...

Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.

static void mapping(IO &YamlIO, WebAssemblyFunctionInfo &MFI)

Definition WebAssemblyMachineFunctionInfo.h:199

This class should be specialized by any type that needs to be converted to/from a YAML mapping.

WebAssemblyFunctionInfo()=default

bool CFGStackified

Definition WebAssemblyMachineFunctionInfo.h:185

~WebAssemblyFunctionInfo() override=default

void mappingImpl(yaml::IO &YamlIO) override

std::vector< FlowStringValue > Results

Definition WebAssemblyMachineFunctionInfo.h:184

std::vector< FlowStringValue > Params

Definition WebAssemblyMachineFunctionInfo.h:183

BBNumberMap SrcToUnwindDest

Definition WebAssemblyMachineFunctionInfo.h:188