]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/MC/MCSymbolWasm.h
Update ACPICA to 20181003.
[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   bool IsHidden = false;
22   std::string ModuleName;
23   SmallVector<wasm::ValType, 1> Returns;
24   SmallVector<wasm::ValType, 4> Params;
25   bool ParamsSet = false;
26   bool ReturnsSet = false;
27
28   /// An expression describing how to calculate the size of a symbol. If a
29   /// symbol has no size this field will be NULL.
30   const MCExpr *SymbolSize = nullptr;
31
32 public:
33   // Use a module name of "env" for now, for compatibility with existing tools.
34   // This is temporary, and may change, as the ABI is not yet stable.
35   MCSymbolWasm(const StringMapEntry<bool> *Name, bool isTemporary)
36       : MCSymbol(SymbolKindWasm, Name, isTemporary),
37         ModuleName("env") {}
38   static bool classof(const MCSymbol *S) { return S->isWasm(); }
39
40   const MCExpr *getSize() const { return SymbolSize; }
41   void setSize(const MCExpr *SS) { SymbolSize = SS; }
42
43   bool isFunction() const { return IsFunction; }
44   void setIsFunction(bool isFunc) { IsFunction = isFunc; }
45
46   bool isWeak() const { return IsWeak; }
47   void setWeak(bool isWeak) { IsWeak = isWeak; }
48
49   bool isHidden() const { return IsHidden; }
50   void setHidden(bool isHidden) { IsHidden = isHidden; }
51
52   const StringRef getModuleName() const { return ModuleName; }
53
54   const SmallVector<wasm::ValType, 1> &getReturns() const {
55     assert(ReturnsSet);
56     return Returns;
57   }
58
59   void setReturns(SmallVectorImpl<wasm::ValType> &&Rets) {
60     ReturnsSet = true;
61     Returns = std::move(Rets);
62   }
63
64   const SmallVector<wasm::ValType, 4> &getParams() const {
65     assert(ParamsSet);
66     return Params;
67   }
68
69   void setParams(SmallVectorImpl<wasm::ValType> &&Pars) {
70     ParamsSet = true;
71     Params = std::move(Pars);
72   }
73 };
74
75 }  // end namespace llvm
76
77 #endif // LLVM_MC_MCSYMBOLWASM_H