summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-05-09 23:48:41 +0000
committerSam Clegg <sbc@chromium.org>2017-05-09 23:48:41 +0000
commit2ffff5af851cffe62aeacc33f62d474982ee0579 (patch)
tree6902f92fbd91d0946ebba01de1c3cd04eb739860 /llvm/include
parent78046e462417425daae02ddc7a472df117dfd05e (diff)
downloadbcm5719-llvm-2ffff5af851cffe62aeacc33f62d474982ee0579.tar.gz
bcm5719-llvm-2ffff5af851cffe62aeacc33f62d474982ee0579.zip
[WebAssembly] Improve libObject support for wasm imports and exports
Previously we had only supported the importing and exporting of functions and globals. Also, add usefull overload of getWasmSymbol() and getNumberOfSymbols() in support of lld port. Differential Revision: https://reviews.llvm.org/D33011 llvm-svn: 302601
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Object/Wasm.h7
-rw-r--r--llvm/include/llvm/ObjectYAML/WasmYAML.h23
-rw-r--r--llvm/include/llvm/Support/Wasm.h23
3 files changed, 30 insertions, 23 deletions
diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h
index 4bc39d98b7a..d200d4a148e 100644
--- a/llvm/include/llvm/Object/Wasm.h
+++ b/llvm/include/llvm/Object/Wasm.h
@@ -67,7 +67,8 @@ public:
WasmObjectFile(MemoryBufferRef Object, Error &Err);
const wasm::WasmObjectHeader &getHeader() const;
- const WasmSymbol &getWasmSymbol(DataRefImpl Symb) const;
+ const WasmSymbol &getWasmSymbol(const DataRefImpl &Symb) const;
+ const WasmSymbol &getWasmSymbol(const SymbolRef &Symbol) const;
const WasmSection &getWasmSection(const SectionRef &Section) const;
const wasm::WasmRelocation &getWasmRelocation(const RelocationRef& Ref) const;
@@ -81,6 +82,10 @@ public:
const std::vector<wasm::WasmGlobal>& globals() const { return Globals; }
const std::vector<wasm::WasmExport>& exports() const { return Exports; }
+ uint32_t getNumberOfSymbols() const {
+ return Symbols.size();
+ }
+
const std::vector<wasm::WasmElemSegment>& elements() const {
return ElemSegments;
}
diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h
index bd7d72be4db..747cd624055 100644
--- a/llvm/include/llvm/ObjectYAML/WasmYAML.h
+++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h
@@ -34,17 +34,6 @@ struct FileHeader {
yaml::Hex32 Version;
};
-struct Import {
- StringRef Module;
- StringRef Field;
- ExportKind Kind;
- union {
- uint32_t SigIndex;
- ValueType GlobalType;
- };
- bool GlobalMutable;
-};
-
struct Limits {
yaml::Hex32 Flags;
yaml::Hex32 Initial;
@@ -74,6 +63,18 @@ struct Global {
wasm::WasmInitExpr InitExpr;
};
+struct Import {
+ StringRef Module;
+ StringRef Field;
+ ExportKind Kind;
+ union {
+ uint32_t SigIndex;
+ Global Global;
+ Table Table;
+ Limits Memory;
+ };
+};
+
struct LocalDecl {
ValueType Type;
uint32_t Count;
diff --git a/llvm/include/llvm/Support/Wasm.h b/llvm/include/llvm/Support/Wasm.h
index a48dfe10b3b..e3831827062 100644
--- a/llvm/include/llvm/Support/Wasm.h
+++ b/llvm/include/llvm/Support/Wasm.h
@@ -37,17 +37,6 @@ struct WasmSignature {
int32_t ReturnType;
};
-struct WasmImport {
- StringRef Module;
- StringRef Field;
- uint32_t Kind;
- union {
- uint32_t SigIndex;
- int32_t GlobalType;
- };
- bool GlobalMutable;
-};
-
struct WasmExport {
StringRef Name;
uint32_t Kind;
@@ -82,6 +71,18 @@ struct WasmGlobal {
WasmInitExpr InitExpr;
};
+struct WasmImport {
+ StringRef Module;
+ StringRef Field;
+ uint32_t Kind;
+ union {
+ uint32_t SigIndex;
+ WasmGlobal Global;
+ WasmTable Table;
+ WasmLimits Memory;
+ };
+};
+
struct WasmLocalDecl {
int32_t Type;
uint32_t Count;
OpenPOWER on IntegriCloud