2017-03-31 03:44:09 +08:00
|
|
|
//===- yaml2wasm - Convert YAML to a Wasm object file --------------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-03-31 03:44:09 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
2018-05-01 23:54:18 +08:00
|
|
|
/// The Wasm component of yaml2obj.
|
2017-03-31 03:44:09 +08:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2018-02-23 13:08:34 +08:00
|
|
|
|
2018-12-15 08:58:12 +08:00
|
|
|
#include "llvm/Object/Wasm.h"
|
2017-03-31 03:44:09 +08:00
|
|
|
#include "llvm/ObjectYAML/ObjectYAML.h"
|
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath
Reviewed By: rupprecht
Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65255
llvm-svn: 368119
2019-08-07 10:44:49 +08:00
|
|
|
#include "llvm/ObjectYAML/yaml2obj.h"
|
2017-03-31 03:44:09 +08:00
|
|
|
#include "llvm/Support/Endian.h"
|
|
|
|
#include "llvm/Support/LEB128.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath
Reviewed By: rupprecht
Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65255
llvm-svn: 368119
2019-08-07 10:44:49 +08:00
|
|
|
namespace {
|
2017-03-31 03:44:09 +08:00
|
|
|
/// This parses a yaml stream that represents a Wasm object file.
|
|
|
|
/// See docs/yaml2obj for the yaml scheema.
|
|
|
|
class WasmWriter {
|
|
|
|
public:
|
2019-09-14 00:00:16 +08:00
|
|
|
WasmWriter(WasmYAML::Object &Obj, yaml::ErrorHandler EH)
|
|
|
|
: Obj(Obj), ErrHandler(EH) {}
|
2019-09-13 17:12:38 +08:00
|
|
|
bool writeWasm(raw_ostream &OS);
|
2017-06-20 12:04:59 +08:00
|
|
|
|
|
|
|
private:
|
2019-09-14 00:00:16 +08:00
|
|
|
void writeRelocSection(raw_ostream &OS, WasmYAML::Section &Sec,
|
|
|
|
uint32_t SectionIndex);
|
|
|
|
|
|
|
|
void writeInitExpr(raw_ostream &OS, const wasm::WasmInitExpr &InitExpr);
|
|
|
|
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::CustomSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::TypeSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::ImportSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::FunctionSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::TableSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::MemorySection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::EventSection &Section);
|
2020-03-25 10:36:13 +08:00
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::GlobalSection &Section);
|
2019-09-14 00:00:16 +08:00
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::ExportSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::StartSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::ElemSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::CodeSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::DataSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::DataCountSection &Section);
|
2017-03-31 03:44:09 +08:00
|
|
|
|
2017-06-20 12:04:59 +08:00
|
|
|
// Custom section types
|
2019-09-14 00:00:16 +08:00
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::DylinkSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::NameSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::LinkingSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS, WasmYAML::ProducersSection &Section);
|
|
|
|
void writeSectionContent(raw_ostream &OS,
|
[WebAssembly] Target features section
Summary:
Implements a new target features section in assembly and object files
that records what features are used, required, and disallowed in
WebAssembly objects. The linker uses this information to ensure that
all objects participating in a link are feature-compatible and records
the set of used features in the output binary for use by optimizers
and other tools later in the toolchain.
The "atomics" feature is always required or disallowed to prevent
linking code with stripped atomics into multithreaded binaries. Other
features are marked used if they are enabled globally or on any
function in a module.
Future CLs will add linker flags for ignoring feature compatibility
checks and for specifying the set of allowed features, implement using
the presence of the "atomics" feature to control the type of memory
and segments in the linked binary, and add front-end flags for
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
WasmYAML::TargetFeaturesSection &Section);
|
2017-03-31 03:44:09 +08:00
|
|
|
WasmYAML::Object &Obj;
|
2018-01-10 05:38:53 +08:00
|
|
|
uint32_t NumImportedFunctions = 0;
|
|
|
|
uint32_t NumImportedGlobals = 0;
|
2018-11-14 10:46:21 +08:00
|
|
|
uint32_t NumImportedEvents = 0;
|
2019-09-14 00:00:16 +08:00
|
|
|
|
|
|
|
bool HasError = false;
|
|
|
|
yaml::ErrorHandler ErrHandler;
|
|
|
|
void reportError(const Twine &Msg);
|
2017-03-31 03:44:09 +08:00
|
|
|
};
|
|
|
|
|
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath
Reviewed By: rupprecht
Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65255
llvm-svn: 368119
2019-08-07 10:44:49 +08:00
|
|
|
class SubSectionWriter {
|
|
|
|
raw_ostream &OS;
|
|
|
|
std::string OutString;
|
|
|
|
raw_string_ostream StringStream;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SubSectionWriter(raw_ostream &OS) : OS(OS), StringStream(OutString) {}
|
|
|
|
|
|
|
|
void done() {
|
|
|
|
StringStream.flush();
|
|
|
|
encodeULEB128(OutString.size(), OS);
|
|
|
|
OS << OutString;
|
|
|
|
OutString.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
raw_ostream &getStream() { return StringStream; }
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
2017-03-31 03:44:09 +08:00
|
|
|
static int writeUint64(raw_ostream &OS, uint64_t Value) {
|
|
|
|
char Data[sizeof(Value)];
|
|
|
|
support::endian::write64le(Data, Value);
|
|
|
|
OS.write(Data, sizeof(Data));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int writeUint32(raw_ostream &OS, uint32_t Value) {
|
|
|
|
char Data[sizeof(Value)];
|
|
|
|
support::endian::write32le(Data, Value);
|
|
|
|
OS.write(Data, sizeof(Data));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int writeUint8(raw_ostream &OS, uint8_t Value) {
|
|
|
|
char Data[sizeof(Value)];
|
|
|
|
memcpy(Data, &Value, sizeof(Data));
|
|
|
|
OS.write(Data, sizeof(Data));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-06 02:12:34 +08:00
|
|
|
static int writeStringRef(const StringRef &Str, raw_ostream &OS) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Str.size(), OS);
|
|
|
|
OS << Str;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-06 02:12:34 +08:00
|
|
|
static int writeLimits(const WasmYAML::Limits &Lim, raw_ostream &OS) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Lim.Flags);
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Lim.Initial, OS);
|
|
|
|
if (Lim.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX)
|
|
|
|
encodeULEB128(Lim.Maximum, OS);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::reportError(const Twine &Msg) {
|
|
|
|
ErrHandler(Msg);
|
|
|
|
HasError = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WasmWriter::writeInitExpr(raw_ostream &OS,
|
|
|
|
const wasm::WasmInitExpr &InitExpr) {
|
2017-03-31 03:44:09 +08:00
|
|
|
writeUint8(OS, InitExpr.Opcode);
|
|
|
|
switch (InitExpr.Opcode) {
|
|
|
|
case wasm::WASM_OPCODE_I32_CONST:
|
|
|
|
encodeSLEB128(InitExpr.Value.Int32, OS);
|
|
|
|
break;
|
|
|
|
case wasm::WASM_OPCODE_I64_CONST:
|
|
|
|
encodeSLEB128(InitExpr.Value.Int64, OS);
|
|
|
|
break;
|
|
|
|
case wasm::WASM_OPCODE_F32_CONST:
|
|
|
|
writeUint32(OS, InitExpr.Value.Float32);
|
|
|
|
break;
|
|
|
|
case wasm::WASM_OPCODE_F64_CONST:
|
|
|
|
writeUint64(OS, InitExpr.Value.Float64);
|
|
|
|
break;
|
2019-01-08 14:25:55 +08:00
|
|
|
case wasm::WASM_OPCODE_GLOBAL_GET:
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(InitExpr.Value.Global, OS);
|
|
|
|
break;
|
|
|
|
default:
|
2019-09-14 00:00:16 +08:00
|
|
|
reportError("unknown opcode in init_expr: " + Twine(InitExpr.Opcode));
|
|
|
|
return;
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
writeUint8(OS, wasm::WASM_OPCODE_END);
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::DylinkSection &Section) {
|
2018-11-15 02:36:24 +08:00
|
|
|
writeStringRef(Section.Name, OS);
|
|
|
|
encodeULEB128(Section.MemorySize, OS);
|
|
|
|
encodeULEB128(Section.MemoryAlignment, OS);
|
|
|
|
encodeULEB128(Section.TableSize, OS);
|
|
|
|
encodeULEB128(Section.TableAlignment, OS);
|
2018-12-13 07:40:58 +08:00
|
|
|
encodeULEB128(Section.Needed.size(), OS);
|
2019-09-14 00:00:16 +08:00
|
|
|
for (StringRef Needed : Section.Needed)
|
2018-12-13 07:40:58 +08:00
|
|
|
writeStringRef(Needed, OS);
|
2018-11-15 02:36:24 +08:00
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::LinkingSection &Section) {
|
2017-06-20 12:04:59 +08:00
|
|
|
writeStringRef(Section.Name, OS);
|
2018-04-27 02:15:32 +08:00
|
|
|
encodeULEB128(Section.Version, OS);
|
2017-06-28 04:27:59 +08:00
|
|
|
|
|
|
|
SubSectionWriter SubSection(OS);
|
|
|
|
|
2018-02-23 13:08:34 +08:00
|
|
|
// SYMBOL_TABLE subsection
|
|
|
|
if (Section.SymbolTable.size()) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, wasm::WASM_SYMBOL_TABLE);
|
2018-02-23 13:08:34 +08:00
|
|
|
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Section.SymbolTable.size(), SubSection.getStream());
|
2018-02-23 20:20:18 +08:00
|
|
|
#ifndef NDEBUG
|
2018-02-23 13:08:34 +08:00
|
|
|
uint32_t SymbolIndex = 0;
|
|
|
|
#endif
|
|
|
|
for (const WasmYAML::SymbolInfo &Info : Section.SymbolTable) {
|
|
|
|
assert(Info.Index == SymbolIndex++);
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
writeUint8(SubSection.getStream(), Info.Kind);
|
|
|
|
encodeULEB128(Info.Flags, SubSection.getStream());
|
2018-02-23 13:08:34 +08:00
|
|
|
switch (Info.Kind) {
|
|
|
|
case wasm::WASM_SYMBOL_TYPE_FUNCTION:
|
|
|
|
case wasm::WASM_SYMBOL_TYPE_GLOBAL:
|
2018-11-14 10:46:21 +08:00
|
|
|
case wasm::WASM_SYMBOL_TYPE_EVENT:
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Info.ElementIndex, SubSection.getStream());
|
2019-02-08 06:03:32 +08:00
|
|
|
if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 ||
|
|
|
|
(Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0)
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
writeStringRef(Info.Name, SubSection.getStream());
|
2018-02-23 13:08:34 +08:00
|
|
|
break;
|
|
|
|
case wasm::WASM_SYMBOL_TYPE_DATA:
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
writeStringRef(Info.Name, SubSection.getStream());
|
2018-02-23 13:08:34 +08:00
|
|
|
if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) {
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Info.DataRef.Segment, SubSection.getStream());
|
|
|
|
encodeULEB128(Info.DataRef.Offset, SubSection.getStream());
|
|
|
|
encodeULEB128(Info.DataRef.Size, SubSection.getStream());
|
2018-02-23 13:08:34 +08:00
|
|
|
}
|
|
|
|
break;
|
2018-04-27 03:27:28 +08:00
|
|
|
case wasm::WASM_SYMBOL_TYPE_SECTION:
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Info.ElementIndex, SubSection.getStream());
|
2018-04-27 03:27:28 +08:00
|
|
|
break;
|
2018-02-23 13:08:34 +08:00
|
|
|
default:
|
|
|
|
llvm_unreachable("unexpected kind");
|
|
|
|
}
|
2017-06-20 12:04:59 +08:00
|
|
|
}
|
|
|
|
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
SubSection.done();
|
2017-06-20 12:04:59 +08:00
|
|
|
}
|
2017-09-21 03:03:35 +08:00
|
|
|
|
|
|
|
// SEGMENT_NAMES subsection
|
2017-09-30 00:50:08 +08:00
|
|
|
if (Section.SegmentInfos.size()) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, wasm::WASM_SEGMENT_INFO);
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Section.SegmentInfos.size(), SubSection.getStream());
|
2017-09-30 00:50:08 +08:00
|
|
|
for (const WasmYAML::SegmentInfo &SegmentInfo : Section.SegmentInfos) {
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
writeStringRef(SegmentInfo.Name, SubSection.getStream());
|
|
|
|
encodeULEB128(SegmentInfo.Alignment, SubSection.getStream());
|
|
|
|
encodeULEB128(SegmentInfo.Flags, SubSection.getStream());
|
2017-09-21 03:03:35 +08:00
|
|
|
}
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
SubSection.done();
|
2017-09-21 03:03:35 +08:00
|
|
|
}
|
2017-12-15 05:10:03 +08:00
|
|
|
|
|
|
|
// INIT_FUNCS subsection
|
|
|
|
if (Section.InitFunctions.size()) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, wasm::WASM_INIT_FUNCS);
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Section.InitFunctions.size(), SubSection.getStream());
|
2017-12-15 05:10:03 +08:00
|
|
|
for (const WasmYAML::InitFunction &Func : Section.InitFunctions) {
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Func.Priority, SubSection.getStream());
|
|
|
|
encodeULEB128(Func.Symbol, SubSection.getStream());
|
2017-12-15 05:10:03 +08:00
|
|
|
}
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
SubSection.done();
|
2017-12-15 05:10:03 +08:00
|
|
|
}
|
2018-01-10 07:43:14 +08:00
|
|
|
|
|
|
|
// COMDAT_INFO subsection
|
|
|
|
if (Section.Comdats.size()) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, wasm::WASM_COMDAT_INFO);
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Section.Comdats.size(), SubSection.getStream());
|
2018-01-10 07:43:14 +08:00
|
|
|
for (const auto &C : Section.Comdats) {
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
writeStringRef(C.Name, SubSection.getStream());
|
|
|
|
encodeULEB128(0, SubSection.getStream()); // flags for future use
|
|
|
|
encodeULEB128(C.Entries.size(), SubSection.getStream());
|
2018-01-10 07:43:14 +08:00
|
|
|
for (const WasmYAML::ComdatEntry &Entry : C.Entries) {
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
writeUint8(SubSection.getStream(), Entry.Kind);
|
|
|
|
encodeULEB128(Entry.Index, SubSection.getStream());
|
2018-01-10 07:43:14 +08:00
|
|
|
}
|
|
|
|
}
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
SubSection.done();
|
2018-01-10 07:43:14 +08:00
|
|
|
}
|
2017-06-20 12:04:59 +08:00
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::NameSection &Section) {
|
2017-05-06 02:12:34 +08:00
|
|
|
writeStringRef(Section.Name, OS);
|
|
|
|
if (Section.FunctionNames.size()) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, wasm::WASM_NAMES_FUNCTION);
|
2017-05-06 02:12:34 +08:00
|
|
|
|
2017-06-28 04:27:59 +08:00
|
|
|
SubSectionWriter SubSection(OS);
|
|
|
|
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(Section.FunctionNames.size(), SubSection.getStream());
|
2017-05-06 02:12:34 +08:00
|
|
|
for (const WasmYAML::NameEntry &NameEntry : Section.FunctionNames) {
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
encodeULEB128(NameEntry.Index, SubSection.getStream());
|
|
|
|
writeStringRef(NameEntry.Name, SubSection.getStream());
|
2017-05-06 02:12:34 +08:00
|
|
|
}
|
|
|
|
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
SubSection.done();
|
2017-05-06 02:12:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::ProducersSection &Section) {
|
2019-01-17 10:29:55 +08:00
|
|
|
writeStringRef(Section.Name, OS);
|
|
|
|
int Fields = int(!Section.Languages.empty()) + int(!Section.Tools.empty()) +
|
|
|
|
int(!Section.SDKs.empty());
|
|
|
|
if (Fields == 0)
|
2019-09-14 00:00:16 +08:00
|
|
|
return;
|
2019-01-17 10:29:55 +08:00
|
|
|
encodeULEB128(Fields, OS);
|
|
|
|
for (auto &Field : {std::make_pair(StringRef("language"), &Section.Languages),
|
|
|
|
std::make_pair(StringRef("processed-by"), &Section.Tools),
|
|
|
|
std::make_pair(StringRef("sdk"), &Section.SDKs)}) {
|
|
|
|
if (Field.second->empty())
|
|
|
|
continue;
|
|
|
|
writeStringRef(Field.first, OS);
|
|
|
|
encodeULEB128(Field.second->size(), OS);
|
|
|
|
for (auto &Entry : *Field.second) {
|
|
|
|
writeStringRef(Entry.Name, OS);
|
|
|
|
writeStringRef(Entry.Version, OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::TargetFeaturesSection &Section) {
|
[WebAssembly] Target features section
Summary:
Implements a new target features section in assembly and object files
that records what features are used, required, and disallowed in
WebAssembly objects. The linker uses this information to ensure that
all objects participating in a link are feature-compatible and records
the set of used features in the output binary for use by optimizers
and other tools later in the toolchain.
The "atomics" feature is always required or disallowed to prevent
linking code with stripped atomics into multithreaded binaries. Other
features are marked used if they are enabled globally or on any
function in a module.
Future CLs will add linker flags for ignoring feature compatibility
checks and for specifying the set of allowed features, implement using
the presence of the "atomics" feature to control the type of memory
and segments in the linked binary, and add front-end flags for
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
writeStringRef(Section.Name, OS);
|
|
|
|
encodeULEB128(Section.Features.size(), OS);
|
|
|
|
for (auto &E : Section.Features) {
|
|
|
|
writeUint8(OS, E.Prefix);
|
|
|
|
writeStringRef(E.Name, OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::CustomSection &Section) {
|
2018-11-15 02:36:24 +08:00
|
|
|
if (auto S = dyn_cast<WasmYAML::DylinkSection>(&Section)) {
|
2019-09-14 00:00:16 +08:00
|
|
|
writeSectionContent(OS, *S);
|
2018-11-15 02:36:24 +08:00
|
|
|
} else if (auto S = dyn_cast<WasmYAML::NameSection>(&Section)) {
|
2019-09-14 00:00:16 +08:00
|
|
|
writeSectionContent(OS, *S);
|
2017-06-20 12:04:59 +08:00
|
|
|
} else if (auto S = dyn_cast<WasmYAML::LinkingSection>(&Section)) {
|
2019-09-14 00:00:16 +08:00
|
|
|
writeSectionContent(OS, *S);
|
2019-01-17 10:29:55 +08:00
|
|
|
} else if (auto S = dyn_cast<WasmYAML::ProducersSection>(&Section)) {
|
2019-09-14 00:00:16 +08:00
|
|
|
writeSectionContent(OS, *S);
|
[WebAssembly] Target features section
Summary:
Implements a new target features section in assembly and object files
that records what features are used, required, and disallowed in
WebAssembly objects. The linker uses this information to ensure that
all objects participating in a link are feature-compatible and records
the set of used features in the output binary for use by optimizers
and other tools later in the toolchain.
The "atomics" feature is always required or disallowed to prevent
linking code with stripped atomics into multithreaded binaries. Other
features are marked used if they are enabled globally or on any
function in a module.
Future CLs will add linker flags for ignoring feature compatibility
checks and for specifying the set of allowed features, implement using
the presence of the "atomics" feature to control the type of memory
and segments in the linked binary, and add front-end flags for
relaxing the linkage policy for atomics.
Reviewers: aheejin, sbc100, dschuff
Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59173
llvm-svn: 356610
2019-03-21 04:26:45 +08:00
|
|
|
} else if (auto S = dyn_cast<WasmYAML::TargetFeaturesSection>(&Section)) {
|
2019-09-14 00:00:16 +08:00
|
|
|
writeSectionContent(OS, *S);
|
2017-05-06 02:12:34 +08:00
|
|
|
} else {
|
2018-04-13 04:31:12 +08:00
|
|
|
writeStringRef(Section.Name, OS);
|
2017-05-06 02:12:34 +08:00
|
|
|
Section.Payload.writeAsBinary(OS);
|
|
|
|
}
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
2017-03-31 03:44:09 +08:00
|
|
|
WasmYAML::TypeSection &Section) {
|
|
|
|
encodeULEB128(Section.Signatures.size(), OS);
|
2018-01-10 05:38:53 +08:00
|
|
|
uint32_t ExpectedIndex = 0;
|
2017-05-06 02:12:34 +08:00
|
|
|
for (const WasmYAML::Signature &Sig : Section.Signatures) {
|
2018-01-10 05:38:53 +08:00
|
|
|
if (Sig.Index != ExpectedIndex) {
|
2019-09-14 00:00:16 +08:00
|
|
|
reportError("unexpected type index: " + Twine(Sig.Index));
|
|
|
|
return;
|
2018-01-10 05:38:53 +08:00
|
|
|
}
|
|
|
|
++ExpectedIndex;
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Sig.Form);
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Sig.ParamTypes.size(), OS);
|
|
|
|
for (auto ParamType : Sig.ParamTypes)
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, ParamType);
|
2019-10-19 04:27:30 +08:00
|
|
|
encodeULEB128(Sig.ReturnTypes.size(), OS);
|
|
|
|
for (auto ReturnType : Sig.ReturnTypes)
|
|
|
|
writeUint8(OS, ReturnType);
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
2017-03-31 03:44:09 +08:00
|
|
|
WasmYAML::ImportSection &Section) {
|
|
|
|
encodeULEB128(Section.Imports.size(), OS);
|
2017-05-06 02:12:34 +08:00
|
|
|
for (const WasmYAML::Import &Import : Section.Imports) {
|
2017-03-31 03:44:09 +08:00
|
|
|
writeStringRef(Import.Module, OS);
|
|
|
|
writeStringRef(Import.Field, OS);
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Import.Kind);
|
2017-03-31 03:44:09 +08:00
|
|
|
switch (Import.Kind) {
|
|
|
|
case wasm::WASM_EXTERNAL_FUNCTION:
|
|
|
|
encodeULEB128(Import.SigIndex, OS);
|
2018-01-10 05:38:53 +08:00
|
|
|
NumImportedFunctions++;
|
2017-03-31 03:44:09 +08:00
|
|
|
break;
|
|
|
|
case wasm::WASM_EXTERNAL_GLOBAL:
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Import.GlobalImport.Type);
|
2017-05-10 08:14:04 +08:00
|
|
|
writeUint8(OS, Import.GlobalImport.Mutable);
|
2018-01-10 05:38:53 +08:00
|
|
|
NumImportedGlobals++;
|
2017-05-10 07:48:41 +08:00
|
|
|
break;
|
2018-11-14 10:46:21 +08:00
|
|
|
case wasm::WASM_EXTERNAL_EVENT:
|
|
|
|
writeUint32(OS, Import.EventImport.Attribute);
|
|
|
|
writeUint32(OS, Import.EventImport.SigIndex);
|
|
|
|
NumImportedGlobals++;
|
|
|
|
break;
|
2017-05-10 07:48:41 +08:00
|
|
|
case wasm::WASM_EXTERNAL_MEMORY:
|
|
|
|
writeLimits(Import.Memory, OS);
|
|
|
|
break;
|
|
|
|
case wasm::WASM_EXTERNAL_TABLE:
|
2018-09-05 09:27:38 +08:00
|
|
|
writeUint8(OS, Import.TableImport.ElemType);
|
2017-05-10 08:14:04 +08:00
|
|
|
writeLimits(Import.TableImport.TableLimits, OS);
|
2017-03-31 03:44:09 +08:00
|
|
|
break;
|
|
|
|
default:
|
2019-09-14 00:00:16 +08:00
|
|
|
reportError("unknown import type: " +Twine(Import.Kind));
|
|
|
|
return;
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::FunctionSection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.FunctionTypes.size(), OS);
|
2019-09-14 00:00:16 +08:00
|
|
|
for (uint32_t FuncType : Section.FunctionTypes)
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(FuncType, OS);
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
2017-03-31 03:44:09 +08:00
|
|
|
WasmYAML::ExportSection &Section) {
|
|
|
|
encodeULEB128(Section.Exports.size(), OS);
|
2017-05-06 02:12:34 +08:00
|
|
|
for (const WasmYAML::Export &Export : Section.Exports) {
|
2017-03-31 03:44:09 +08:00
|
|
|
writeStringRef(Export.Name, OS);
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Export.Kind);
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Export.Index, OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::StartSection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.StartFunction, OS);
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::TableSection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.Tables.size(), OS);
|
|
|
|
for (auto &Table : Section.Tables) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Table.ElemType);
|
2017-03-31 03:44:09 +08:00
|
|
|
writeLimits(Table.TableLimits, OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::MemorySection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.Memories.size(), OS);
|
2019-09-14 00:00:16 +08:00
|
|
|
for (const WasmYAML::Limits &Mem : Section.Memories)
|
2017-03-31 03:44:09 +08:00
|
|
|
writeLimits(Mem, OS);
|
|
|
|
}
|
|
|
|
|
2020-03-25 10:36:13 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::EventSection &Section) {
|
|
|
|
encodeULEB128(Section.Events.size(), OS);
|
|
|
|
uint32_t ExpectedIndex = NumImportedEvents;
|
|
|
|
for (auto &Event : Section.Events) {
|
|
|
|
if (Event.Index != ExpectedIndex) {
|
|
|
|
reportError("unexpected event index: " + Twine(Event.Index));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
++ExpectedIndex;
|
|
|
|
encodeULEB128(Event.Attribute, OS);
|
|
|
|
encodeULEB128(Event.SigIndex, OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::GlobalSection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.Globals.size(), OS);
|
2018-01-10 05:38:53 +08:00
|
|
|
uint32_t ExpectedIndex = NumImportedGlobals;
|
2017-03-31 03:44:09 +08:00
|
|
|
for (auto &Global : Section.Globals) {
|
2018-01-10 05:38:53 +08:00
|
|
|
if (Global.Index != ExpectedIndex) {
|
2019-09-14 00:00:16 +08:00
|
|
|
reportError("unexpected global index: " + Twine(Global.Index));
|
|
|
|
return;
|
2018-01-10 05:38:53 +08:00
|
|
|
}
|
|
|
|
++ExpectedIndex;
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Global.Type);
|
2017-03-31 03:44:09 +08:00
|
|
|
writeUint8(OS, Global.Mutable);
|
2019-09-14 00:00:16 +08:00
|
|
|
writeInitExpr(OS, Global.InitExpr);
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::ElemSection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.Segments.size(), OS);
|
|
|
|
for (auto &Segment : Section.Segments) {
|
|
|
|
encodeULEB128(Segment.TableIndex, OS);
|
2019-09-14 00:00:16 +08:00
|
|
|
writeInitExpr(OS, Segment.Offset);
|
2017-03-31 03:44:09 +08:00
|
|
|
|
|
|
|
encodeULEB128(Segment.Functions.size(), OS);
|
2019-09-14 00:00:16 +08:00
|
|
|
for (auto &Function : Segment.Functions)
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Function, OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
2017-03-31 03:44:09 +08:00
|
|
|
WasmYAML::CodeSection &Section) {
|
|
|
|
encodeULEB128(Section.Functions.size(), OS);
|
2018-01-10 05:38:53 +08:00
|
|
|
uint32_t ExpectedIndex = NumImportedFunctions;
|
2017-03-31 03:44:09 +08:00
|
|
|
for (auto &Func : Section.Functions) {
|
|
|
|
std::string OutString;
|
|
|
|
raw_string_ostream StringStream(OutString);
|
2018-01-10 05:38:53 +08:00
|
|
|
if (Func.Index != ExpectedIndex) {
|
2019-09-14 00:00:16 +08:00
|
|
|
reportError("unexpected function index: " + Twine(Func.Index));
|
|
|
|
return;
|
2018-01-10 05:38:53 +08:00
|
|
|
}
|
|
|
|
++ExpectedIndex;
|
2017-03-31 03:44:09 +08:00
|
|
|
|
|
|
|
encodeULEB128(Func.Locals.size(), StringStream);
|
|
|
|
for (auto &LocalDecl : Func.Locals) {
|
|
|
|
encodeULEB128(LocalDecl.Count, StringStream);
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(StringStream, LocalDecl.Type);
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Func.Body.writeAsBinary(StringStream);
|
|
|
|
|
|
|
|
// Write the section size followed by the content
|
|
|
|
StringStream.flush();
|
|
|
|
encodeULEB128(OutString.size(), OS);
|
|
|
|
OS << OutString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::DataSection &Section) {
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Section.Segments.size(), OS);
|
|
|
|
for (auto &Segment : Section.Segments) {
|
2019-02-20 06:56:19 +08:00
|
|
|
encodeULEB128(Segment.InitFlags, OS);
|
|
|
|
if (Segment.InitFlags & wasm::WASM_SEGMENT_HAS_MEMINDEX)
|
|
|
|
encodeULEB128(Segment.MemoryIndex, OS);
|
|
|
|
if ((Segment.InitFlags & wasm::WASM_SEGMENT_IS_PASSIVE) == 0)
|
2019-09-14 00:00:16 +08:00
|
|
|
writeInitExpr(OS, Segment.Offset);
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Segment.Content.binary_size(), OS);
|
|
|
|
Segment.Content.writeAsBinary(OS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeSectionContent(raw_ostream &OS,
|
|
|
|
WasmYAML::DataCountSection &Section) {
|
2019-04-13 06:27:48 +08:00
|
|
|
encodeULEB128(Section.Count, OS);
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
void WasmWriter::writeRelocSection(raw_ostream &OS, WasmYAML::Section &Sec,
|
2018-04-25 02:11:36 +08:00
|
|
|
uint32_t SectionIndex) {
|
2017-03-31 03:44:09 +08:00
|
|
|
switch (Sec.Type) {
|
2018-09-05 09:27:38 +08:00
|
|
|
case wasm::WASM_SEC_CODE:
|
|
|
|
writeStringRef("reloc.CODE", OS);
|
|
|
|
break;
|
|
|
|
case wasm::WASM_SEC_DATA:
|
|
|
|
writeStringRef("reloc.DATA", OS);
|
|
|
|
break;
|
|
|
|
case wasm::WASM_SEC_CUSTOM: {
|
2019-09-18 03:14:11 +08:00
|
|
|
auto *CustomSection = cast<WasmYAML::CustomSection>(&Sec);
|
2018-09-05 09:27:38 +08:00
|
|
|
writeStringRef(("reloc." + CustomSection->Name).str(), OS);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
llvm_unreachable("not yet implemented");
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
|
2018-04-25 02:11:36 +08:00
|
|
|
encodeULEB128(SectionIndex, OS);
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Sec.Relocations.size(), OS);
|
|
|
|
|
2018-09-05 09:27:38 +08:00
|
|
|
for (auto Reloc : Sec.Relocations) {
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, Reloc.Type);
|
2017-03-31 03:44:09 +08:00
|
|
|
encodeULEB128(Reloc.Offset, OS);
|
|
|
|
encodeULEB128(Reloc.Index, OS);
|
2020-04-17 08:22:38 +08:00
|
|
|
switch (Reloc.Type) {
|
|
|
|
case wasm::R_WASM_MEMORY_ADDR_LEB:
|
2020-06-06 00:03:12 +08:00
|
|
|
case wasm::R_WASM_MEMORY_ADDR_LEB64:
|
2020-04-17 08:22:38 +08:00
|
|
|
case wasm::R_WASM_MEMORY_ADDR_SLEB:
|
2020-06-06 00:03:12 +08:00
|
|
|
case wasm::R_WASM_MEMORY_ADDR_SLEB64:
|
2020-04-17 08:22:38 +08:00
|
|
|
case wasm::R_WASM_MEMORY_ADDR_I32:
|
2020-06-06 00:03:12 +08:00
|
|
|
case wasm::R_WASM_MEMORY_ADDR_I64:
|
2020-04-17 08:22:38 +08:00
|
|
|
case wasm::R_WASM_FUNCTION_OFFSET_I32:
|
|
|
|
case wasm::R_WASM_SECTION_OFFSET_I32:
|
2018-09-05 09:27:38 +08:00
|
|
|
encodeULEB128(Reloc.Addend, OS);
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-13 17:12:38 +08:00
|
|
|
bool WasmWriter::writeWasm(raw_ostream &OS) {
|
2017-03-31 03:44:09 +08:00
|
|
|
// Write headers
|
|
|
|
OS.write(wasm::WasmMagic, sizeof(wasm::WasmMagic));
|
|
|
|
writeUint32(OS, Obj.Header.Version);
|
|
|
|
|
|
|
|
// Write each section
|
2018-12-15 08:58:12 +08:00
|
|
|
llvm::object::WasmSectionOrderChecker Checker;
|
2017-03-31 03:44:09 +08:00
|
|
|
for (const std::unique_ptr<WasmYAML::Section> &Sec : Obj.Sections) {
|
2018-12-15 08:58:12 +08:00
|
|
|
StringRef SecName = "";
|
|
|
|
if (auto S = dyn_cast<WasmYAML::CustomSection>(Sec.get()))
|
|
|
|
SecName = S->Name;
|
|
|
|
if (!Checker.isValidSectionOrder(Sec->Type, SecName)) {
|
2019-09-14 00:00:16 +08:00
|
|
|
reportError("out of order section type: " + Twine(Sec->Type));
|
2019-09-13 17:12:38 +08:00
|
|
|
return false;
|
2018-12-15 08:58:12 +08:00
|
|
|
}
|
2018-01-10 05:38:53 +08:00
|
|
|
encodeULEB128(Sec->Type, OS);
|
2017-03-31 03:44:09 +08:00
|
|
|
std::string OutString;
|
|
|
|
raw_string_ostream StringStream(OutString);
|
2019-09-14 00:00:16 +08:00
|
|
|
if (auto S = dyn_cast<WasmYAML::CustomSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::TypeSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::ImportSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::FunctionSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::TableSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::MemorySection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::EventSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
2020-03-25 10:36:13 +08:00
|
|
|
else if (auto S = dyn_cast<WasmYAML::GlobalSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
2019-09-14 00:00:16 +08:00
|
|
|
else if (auto S = dyn_cast<WasmYAML::ExportSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::StartSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::ElemSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::CodeSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::DataSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else if (auto S = dyn_cast<WasmYAML::DataCountSection>(Sec.get()))
|
|
|
|
writeSectionContent(StringStream, *S);
|
|
|
|
else
|
|
|
|
reportError("unknown section type: " + Twine(Sec->Type));
|
|
|
|
|
|
|
|
if (HasError)
|
2019-09-13 17:12:38 +08:00
|
|
|
return false;
|
2019-09-14 00:00:16 +08:00
|
|
|
|
2017-03-31 03:44:09 +08:00
|
|
|
StringStream.flush();
|
|
|
|
|
|
|
|
// Write the section size followed by the content
|
|
|
|
encodeULEB128(OutString.size(), OS);
|
|
|
|
OS << OutString;
|
|
|
|
}
|
|
|
|
|
|
|
|
// write reloc sections for any section that have relocations
|
2018-04-25 02:11:36 +08:00
|
|
|
uint32_t SectionIndex = 0;
|
2017-03-31 03:44:09 +08:00
|
|
|
for (const std::unique_ptr<WasmYAML::Section> &Sec : Obj.Sections) {
|
2018-04-25 02:11:36 +08:00
|
|
|
if (Sec->Relocations.empty()) {
|
|
|
|
SectionIndex++;
|
2017-03-31 03:44:09 +08:00
|
|
|
continue;
|
2018-04-25 02:11:36 +08:00
|
|
|
}
|
2017-03-31 03:44:09 +08:00
|
|
|
|
2018-03-02 02:06:21 +08:00
|
|
|
writeUint8(OS, wasm::WASM_SEC_CUSTOM);
|
2017-03-31 03:44:09 +08:00
|
|
|
std::string OutString;
|
|
|
|
raw_string_ostream StringStream(OutString);
|
2018-04-25 02:11:36 +08:00
|
|
|
writeRelocSection(StringStream, *Sec, SectionIndex++);
|
2017-03-31 03:44:09 +08:00
|
|
|
StringStream.flush();
|
|
|
|
|
|
|
|
encodeULEB128(OutString.size(), OS);
|
|
|
|
OS << OutString;
|
|
|
|
}
|
|
|
|
|
2019-09-13 17:12:38 +08:00
|
|
|
return true;
|
2017-03-31 03:44:09 +08:00
|
|
|
}
|
|
|
|
|
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath
Reviewed By: rupprecht
Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65255
llvm-svn: 368119
2019-08-07 10:44:49 +08:00
|
|
|
namespace llvm {
|
|
|
|
namespace yaml {
|
|
|
|
|
2019-09-14 00:00:16 +08:00
|
|
|
bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH) {
|
|
|
|
WasmWriter Writer(Doc, EH);
|
2017-03-31 03:44:09 +08:00
|
|
|
return Writer.writeWasm(Out);
|
|
|
|
}
|
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath
Reviewed By: rupprecht
Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65255
llvm-svn: 368119
2019-08-07 10:44:49 +08:00
|
|
|
|
|
|
|
} // namespace yaml
|
|
|
|
} // namespace llvm
|