1 //===- MCSymbolWasm.h - ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCSYMBOLWASM_H
10 #define LLVM_MC_MCSYMBOLWASM_H
12 #include "llvm/BinaryFormat/Wasm.h"
13 #include "llvm/MC/MCSymbol.h"
17 class MCSymbolWasm : public MCSymbol {
19 bool IsFunction = false;
21 std::string ModuleName;
22 SmallVector<wasm::ValType, 1> Returns;
23 SmallVector<wasm::ValType, 4> Params;
24 bool ParamsSet = false;
25 bool ReturnsSet = false;
27 /// An expression describing how to calculate the size of a symbol. If a
28 /// symbol has no size this field will be NULL.
29 const MCExpr *SymbolSize = nullptr;
32 // Use a module name of "env" for now, for compatibility with existing tools.
33 // This is temporary, and may change, as the ABI is not yet stable.
34 MCSymbolWasm(const StringMapEntry<bool> *Name, bool isTemporary)
35 : MCSymbol(SymbolKindWasm, Name, isTemporary),
37 static bool classof(const MCSymbol *S) { return S->isWasm(); }
39 const MCExpr *getSize() const { return SymbolSize; }
40 void setSize(const MCExpr *SS) { SymbolSize = SS; }
42 bool isFunction() const { return IsFunction; }
43 void setIsFunction(bool isFunc) { IsFunction = isFunc; }
45 bool isWeak() const { return IsWeak; }
46 void setWeak(bool isWeak) { IsWeak = isWeak; }
48 const StringRef getModuleName() const { return ModuleName; }
50 const SmallVector<wasm::ValType, 1> &getReturns() const {
55 void setReturns(SmallVectorImpl<wasm::ValType> &&Rets) {
57 Returns = std::move(Rets);
60 const SmallVector<wasm::ValType, 4> &getParams() const {
65 void setParams(SmallVectorImpl<wasm::ValType> &&Pars) {
67 Params = std::move(Pars);
71 } // end namespace llvm
73 #endif // LLVM_MC_MCSYMBOLWASM_H