]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/MC/MCSymbolWasm.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / MC / MCSymbolWasm.h
1 //===- MCSymbolWasm.h -  ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCSYMBOLWASM_H
10 #define LLVM_MC_MCSYMBOLWASM_H
11
12 #include "llvm/BinaryFormat/Wasm.h"
13 #include "llvm/MC/MCSymbol.h"
14
15 namespace llvm {
16
17 class MCSymbolWasm : public MCSymbol {
18 private:
19   bool IsFunction = false;
20   bool IsWeak = false;
21   std::string ModuleName;
22   SmallVector<wasm::ValType, 1> Returns;
23   SmallVector<wasm::ValType, 4> Params;
24
25   /// An expression describing how to calculate the size of a symbol. If a
26   /// symbol has no size this field will be NULL.
27   const MCExpr *SymbolSize = nullptr;
28
29 public:
30   // Use a module name of "env" for now, for compatibility with existing tools.
31   // This is temporary, and may change, as the ABI is not yet stable.
32   MCSymbolWasm(const StringMapEntry<bool> *Name, bool isTemporary)
33       : MCSymbol(SymbolKindWasm, Name, isTemporary),
34         ModuleName("env") {}
35   static bool classof(const MCSymbol *S) { return S->isWasm(); }
36
37   const MCExpr *getSize() const { return SymbolSize; }
38   void setSize(const MCExpr *SS) { SymbolSize = SS; }
39
40   bool isFunction() const { return IsFunction; }
41   void setIsFunction(bool isFunc) { IsFunction = isFunc; }
42
43   bool isWeak() const { return IsWeak; }
44   void setWeak(bool isWeak) { IsWeak = isWeak; }
45
46   const StringRef getModuleName() const { return ModuleName; }
47
48   const SmallVector<wasm::ValType, 1> &getReturns() const { return Returns; }
49
50   void setReturns(SmallVectorImpl<wasm::ValType> &&Rets) {
51     Returns = std::move(Rets);
52   }
53
54   const SmallVector<wasm::ValType, 4> &getParams() const { return Params; }
55
56   void setParams(SmallVectorImpl<wasm::ValType> &&Pars) {
57     Params = std::move(Pars);
58   }
59 };
60
61 }  // end namespace llvm
62
63 #endif // LLVM_MC_MCSYMBOLWASM_H