Update clang to r339409b.
Change-Id: Ied8a188bb072c40035320acedc86164b66d920af
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.def b/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.def
index 944c5dd..6b7a741 100644
--- a/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.def
+++ b/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.def
@@ -20,7 +20,8 @@
defined HANDLE_DW_LNCT || defined HANDLE_DW_MACRO || \
defined HANDLE_DW_RLE || defined HANDLE_DW_CFA || \
defined HANDLE_DW_APPLE_PROPERTY || defined HANDLE_DW_UT || \
- defined HANDLE_DWARF_SECTION || defined HANDLE_DW_IDX)
+ defined HANDLE_DWARF_SECTION || defined HANDLE_DW_IDX || \
+ defined HANDLE_DW_END)
#error "Missing macro definition of HANDLE_DW*"
#endif
@@ -100,6 +101,10 @@
#define HANDLE_DW_IDX(ID, NAME)
#endif
+#ifndef HANDLE_DW_END
+#define HANDLE_DW_END(ID, NAME)
+#endif
+
HANDLE_DW_TAG(0x0000, null, 2, DWARF)
HANDLE_DW_TAG(0x0001, array_type, 2, DWARF)
HANDLE_DW_TAG(0x0002, class_type, 2, DWARF)
@@ -690,6 +695,11 @@
HANDLE_DW_ATE(0x11, UCS, 5, DWARF)
HANDLE_DW_ATE(0x12, ASCII, 5, DWARF)
+// DWARF attribute endianity
+HANDLE_DW_END(0x00, default)
+HANDLE_DW_END(0x01, big)
+HANDLE_DW_END(0x02, little)
+
// DWARF virtuality codes.
HANDLE_DW_VIRTUALITY(0x00, none)
HANDLE_DW_VIRTUALITY(0x01, virtual)
@@ -909,3 +919,4 @@
#undef HANDLE_DW_UT
#undef HANDLE_DWARF_SECTION
#undef HANDLE_DW_IDX
+#undef HANDLE_DW_END
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.h b/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.h
index 9036f40..330e31c 100644
--- a/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.h
+++ b/linux-x64/clang/include/llvm/BinaryFormat/Dwarf.h
@@ -150,9 +150,8 @@
enum EndianityEncoding {
// Endianity attribute values
- DW_END_default = 0x00,
- DW_END_big = 0x01,
- DW_END_little = 0x02,
+#define HANDLE_DW_END(ID, NAME) DW_END_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
DW_END_lo_user = 0x40,
DW_END_hi_user = 0xff
};
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/MsgPack.def b/linux-x64/clang/include/llvm/BinaryFormat/MsgPack.def
new file mode 100644
index 0000000..781b49f
--- /dev/null
+++ b/linux-x64/clang/include/llvm/BinaryFormat/MsgPack.def
@@ -0,0 +1,108 @@
+//===- MsgPack.def - MessagePack definitions --------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Macros for running through MessagePack enumerators.
+///
+//===----------------------------------------------------------------------===//
+
+#if !( \
+ defined HANDLE_MP_FIRST_BYTE || defined HANDLE_MP_FIX_BITS || \
+ defined HANDLE_MP_FIX_BITS_MASK || defined HANDLE_MP_FIX_MAX || \
+ defined HANDLE_MP_FIX_LEN || defined HANDLE_MP_FIX_MIN)
+#error "Missing macro definition of HANDLE_MP*"
+#endif
+
+#ifndef HANDLE_MP_FIRST_BYTE
+#define HANDLE_MP_FIRST_BYTE(ID, NAME)
+#endif
+
+#ifndef HANDLE_MP_FIX_BITS
+#define HANDLE_MP_FIX_BITS(ID, NAME)
+#endif
+
+#ifndef HANDLE_MP_FIX_BITS_MASK
+#define HANDLE_MP_FIX_BITS_MASK(ID, NAME)
+#endif
+
+#ifndef HANDLE_MP_FIX_MAX
+#define HANDLE_MP_FIX_MAX(ID, NAME)
+#endif
+
+#ifndef HANDLE_MP_FIX_LEN
+#define HANDLE_MP_FIX_LEN(ID, NAME)
+#endif
+
+#ifndef HANDLE_MP_FIX_MIN
+#define HANDLE_MP_FIX_MIN(ID, NAME)
+#endif
+
+HANDLE_MP_FIRST_BYTE(0xc0, Nil)
+HANDLE_MP_FIRST_BYTE(0xc2, False)
+HANDLE_MP_FIRST_BYTE(0xc3, True)
+HANDLE_MP_FIRST_BYTE(0xc4, Bin8)
+HANDLE_MP_FIRST_BYTE(0xc5, Bin16)
+HANDLE_MP_FIRST_BYTE(0xc6, Bin32)
+HANDLE_MP_FIRST_BYTE(0xc7, Ext8)
+HANDLE_MP_FIRST_BYTE(0xc8, Ext16)
+HANDLE_MP_FIRST_BYTE(0xc9, Ext32)
+HANDLE_MP_FIRST_BYTE(0xca, Float32)
+HANDLE_MP_FIRST_BYTE(0xcb, Float64)
+HANDLE_MP_FIRST_BYTE(0xcc, UInt8)
+HANDLE_MP_FIRST_BYTE(0xcd, UInt16)
+HANDLE_MP_FIRST_BYTE(0xce, UInt32)
+HANDLE_MP_FIRST_BYTE(0xcf, UInt64)
+HANDLE_MP_FIRST_BYTE(0xd0, Int8)
+HANDLE_MP_FIRST_BYTE(0xd1, Int16)
+HANDLE_MP_FIRST_BYTE(0xd2, Int32)
+HANDLE_MP_FIRST_BYTE(0xd3, Int64)
+HANDLE_MP_FIRST_BYTE(0xd4, FixExt1)
+HANDLE_MP_FIRST_BYTE(0xd5, FixExt2)
+HANDLE_MP_FIRST_BYTE(0xd6, FixExt4)
+HANDLE_MP_FIRST_BYTE(0xd7, FixExt8)
+HANDLE_MP_FIRST_BYTE(0xd8, FixExt16)
+HANDLE_MP_FIRST_BYTE(0xd9, Str8)
+HANDLE_MP_FIRST_BYTE(0xda, Str16)
+HANDLE_MP_FIRST_BYTE(0xdb, Str32)
+HANDLE_MP_FIRST_BYTE(0xdc, Array16)
+HANDLE_MP_FIRST_BYTE(0xdd, Array32)
+HANDLE_MP_FIRST_BYTE(0xde, Map16)
+HANDLE_MP_FIRST_BYTE(0xdf, Map32)
+
+HANDLE_MP_FIX_BITS(0x00, PositiveInt)
+HANDLE_MP_FIX_BITS(0x80, Map)
+HANDLE_MP_FIX_BITS(0x90, Array)
+HANDLE_MP_FIX_BITS(0xa0, String)
+HANDLE_MP_FIX_BITS(0xe0, NegativeInt)
+
+HANDLE_MP_FIX_BITS_MASK(0x80, PositiveInt)
+HANDLE_MP_FIX_BITS_MASK(0xf0, Map)
+HANDLE_MP_FIX_BITS_MASK(0xf0, Array)
+HANDLE_MP_FIX_BITS_MASK(0xe0, String)
+HANDLE_MP_FIX_BITS_MASK(0xe0, NegativeInt)
+
+HANDLE_MP_FIX_MAX(0x7f, PositiveInt)
+HANDLE_MP_FIX_MAX(0x0f, Map)
+HANDLE_MP_FIX_MAX(0x0f, Array)
+HANDLE_MP_FIX_MAX(0x1f, String)
+
+HANDLE_MP_FIX_LEN(0x01, Ext1)
+HANDLE_MP_FIX_LEN(0x02, Ext2)
+HANDLE_MP_FIX_LEN(0x04, Ext4)
+HANDLE_MP_FIX_LEN(0x08, Ext8)
+HANDLE_MP_FIX_LEN(0x10, Ext16)
+
+HANDLE_MP_FIX_MIN(-0x20, NegativeInt)
+
+#undef HANDLE_MP_FIRST_BYTE
+#undef HANDLE_MP_FIX_BITS
+#undef HANDLE_MP_FIX_BITS_MASK
+#undef HANDLE_MP_FIX_MAX
+#undef HANDLE_MP_FIX_LEN
+#undef HANDLE_MP_FIX_MIN
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/MsgPack.h b/linux-x64/clang/include/llvm/BinaryFormat/MsgPack.h
new file mode 100644
index 0000000..d431912
--- /dev/null
+++ b/linux-x64/clang/include/llvm/BinaryFormat/MsgPack.h
@@ -0,0 +1,93 @@
+//===-- MsgPack.h - MessagePack Constants -----------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains constants used for implementing MessagePack support.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_MSGPACK_H
+#define LLVM_BINARYFORMAT_MSGPACK_H
+
+#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/Endian.h"
+
+namespace llvm {
+namespace msgpack {
+
+/// The endianness of all multi-byte encoded values in MessagePack.
+constexpr support::endianness Endianness = support::big;
+
+/// The first byte identifiers of MessagePack object formats.
+namespace FirstByte {
+#define HANDLE_MP_FIRST_BYTE(ID, NAME) constexpr uint8_t NAME = ID;
+#include "llvm/BinaryFormat/MsgPack.def"
+}
+
+/// Most significant bits used to identify "Fix" variants in MessagePack.
+///
+/// For example, FixStr objects encode their size in the five least significant
+/// bits of their first byte, which is identified by the bit pattern "101" in
+/// the three most significant bits. So FixBits::String contains 0b10100000.
+///
+/// A corresponding mask of the bit pattern is found in \c FixBitsMask.
+namespace FixBits {
+#define HANDLE_MP_FIX_BITS(ID, NAME) constexpr uint8_t NAME = ID;
+#include "llvm/BinaryFormat/MsgPack.def"
+}
+
+/// Mask of bits used to identify "Fix" variants in MessagePack.
+///
+/// For example, FixStr objects encode their size in the five least significant
+/// bits of their first byte, which is identified by the bit pattern "101" in
+/// the three most significant bits. So FixBitsMask::String contains
+/// 0b11100000.
+///
+/// The corresponding bit pattern to mask for is found in FixBits.
+namespace FixBitsMask {
+#define HANDLE_MP_FIX_BITS_MASK(ID, NAME) constexpr uint8_t NAME = ID;
+#include "llvm/BinaryFormat/MsgPack.def"
+}
+
+/// The maximum value or size encodable in "Fix" variants of formats.
+///
+/// For example, FixStr objects encode their size in the five least significant
+/// bits of their first byte, so the largest encodable size is 0b00011111.
+namespace FixMax {
+#define HANDLE_MP_FIX_MAX(ID, NAME) constexpr uint8_t NAME = ID;
+#include "llvm/BinaryFormat/MsgPack.def"
+}
+
+/// The exact size encodable in "Fix" variants of formats.
+///
+/// The only objects for which an exact size makes sense are of Extension type.
+///
+/// For example, FixExt4 stores an extension type containing exactly four bytes.
+namespace FixLen {
+#define HANDLE_MP_FIX_LEN(ID, NAME) constexpr uint8_t NAME = ID;
+#include "llvm/BinaryFormat/MsgPack.def"
+}
+
+/// The minimum value or size encodable in "Fix" variants of formats.
+///
+/// The only object for which a minimum makes sense is a negative FixNum.
+///
+/// Negative FixNum objects encode their signed integer value in one byte, but
+/// they must have the pattern "111" as their three most significant bits. This
+/// means all values are negative, and the smallest representable value is
+/// 0b11100000.
+namespace FixMin {
+#define HANDLE_MP_FIX_MIN(ID, NAME) constexpr int8_t NAME = ID;
+#include "llvm/BinaryFormat/MsgPack.def"
+}
+
+} // end namespace msgpack
+} // end namespace llvm
+
+#endif // LLVM_BINARYFORMAT_MSGPACK_H
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/MsgPackReader.h b/linux-x64/clang/include/llvm/BinaryFormat/MsgPackReader.h
new file mode 100644
index 0000000..511c314
--- /dev/null
+++ b/linux-x64/clang/include/llvm/BinaryFormat/MsgPackReader.h
@@ -0,0 +1,148 @@
+//===- MsgPackReader.h - Simple MsgPack reader ------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This is a MessagePack reader.
+///
+/// See https://github.com/msgpack/msgpack/blob/master/spec.md for the full
+/// standard.
+///
+/// Typical usage:
+/// \code
+/// StringRef input = GetInput();
+/// msgpack::Reader MPReader(input);
+/// msgpack::Object Obj;
+///
+/// while (MPReader.read(Obj)) {
+/// switch (Obj.Kind) {
+/// case msgpack::Type::Int:
+// // Use Obj.Int
+/// break;
+/// // ...
+/// }
+/// }
+/// \endcode
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_MSGPACKREADER_H
+#define LLVM_SUPPORT_MSGPACKREADER_H
+
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdint>
+
+namespace llvm {
+namespace msgpack {
+
+/// MessagePack types as defined in the standard, with the exception of Integer
+/// being divided into a signed Int and unsigned UInt variant in order to map
+/// directly to C++ types.
+///
+/// The types map onto corresponding union members of the \c Object struct.
+enum class Type : uint8_t {
+ Int,
+ UInt,
+ Nil,
+ Boolean,
+ Float,
+ String,
+ Binary,
+ Array,
+ Map,
+ Extension,
+};
+
+/// Extension types are composed of a user-defined type ID and an uninterpreted
+/// sequence of bytes.
+struct ExtensionType {
+ /// User-defined extension type.
+ int8_t Type;
+ /// Raw bytes of the extension object.
+ StringRef Bytes;
+};
+
+/// MessagePack object, represented as a tagged union of C++ types.
+///
+/// All types except \c Type::Nil (which has only one value, and so is
+/// completely represented by the \c Kind itself) map to a exactly one union
+/// member.
+struct Object {
+ Type Kind;
+ union {
+ /// Value for \c Type::Int.
+ int64_t Int;
+ /// Value for \c Type::Uint.
+ uint64_t UInt;
+ /// Value for \c Type::Boolean.
+ bool Bool;
+ /// Value for \c Type::Float.
+ double Float;
+ /// Value for \c Type::String and \c Type::Binary.
+ StringRef Raw;
+ /// Value for \c Type::Array and \c Type::Map.
+ size_t Length;
+ /// Value for \c Type::Extension.
+ ExtensionType Extension;
+ };
+
+ Object() : Kind(Type::Int), Int(0) {}
+};
+
+/// Reads MessagePack objects from memory, one at a time.
+class Reader {
+public:
+ /// Construct a reader, keeping a reference to the \p InputBuffer.
+ Reader(MemoryBufferRef InputBuffer);
+ /// Construct a reader, keeping a reference to the \p Input.
+ Reader(StringRef Input);
+
+ Reader(const Reader &) = delete;
+ Reader &operator=(const Reader &) = delete;
+
+ /// Read one object from the input buffer, advancing past it.
+ ///
+ /// The \p Obj is updated with the kind of the object read, and the
+ /// corresponding union member is updated.
+ ///
+ /// For the collection objects (Array and Map), only the length is read, and
+ /// the caller must make and additional \c N calls (in the case of Array) or
+ /// \c N*2 calls (in the case of Map) to \c Read to retrieve the collection
+ /// elements.
+ ///
+ /// \param [out] Obj filled with next object on success.
+ ///
+ /// \returns true when object successfully read, false when at end of
+ /// input (and so \p Obj was not updated), otherwise an error.
+ Expected<bool> read(Object &Obj);
+
+private:
+ MemoryBufferRef InputBuffer;
+ StringRef::iterator Current;
+ StringRef::iterator End;
+
+ size_t remainingSpace() {
+ // The rest of the code maintains the invariant that End >= Current, so
+ // that this cast is always defined behavior.
+ return static_cast<size_t>(End - Current);
+ }
+
+ template <class T> Expected<bool> readRaw(Object &Obj);
+ template <class T> Expected<bool> readInt(Object &Obj);
+ template <class T> Expected<bool> readUInt(Object &Obj);
+ template <class T> Expected<bool> readLength(Object &Obj);
+ template <class T> Expected<bool> readExt(Object &Obj);
+ Expected<bool> createRaw(Object &Obj, uint32_t Size);
+ Expected<bool> createExt(Object &Obj, uint32_t Size);
+};
+
+} // end namespace msgpack
+} // end namespace llvm
+
+#endif // LLVM_SUPPORT_MSGPACKREADER_H
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/MsgPackWriter.h b/linux-x64/clang/include/llvm/BinaryFormat/MsgPackWriter.h
new file mode 100644
index 0000000..98af422
--- /dev/null
+++ b/linux-x64/clang/include/llvm/BinaryFormat/MsgPackWriter.h
@@ -0,0 +1,131 @@
+//===- MsgPackWriter.h - Simple MsgPack writer ------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains a MessagePack writer.
+///
+/// See https://github.com/msgpack/msgpack/blob/master/spec.md for the full
+/// specification.
+///
+/// Typical usage:
+/// \code
+/// raw_ostream output = GetOutputStream();
+/// msgpack::Writer MPWriter(output);
+/// MPWriter.writeNil();
+/// MPWriter.write(false);
+/// MPWriter.write("string");
+/// // ...
+/// \endcode
+///
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_MSGPACKPARSER_H
+#define LLVM_SUPPORT_MSGPACKPARSER_H
+
+#include "llvm/BinaryFormat/MsgPack.h"
+#include "llvm/Support/EndianStream.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
+
+namespace llvm {
+namespace msgpack {
+
+/// Writes MessagePack objects to an output stream, one at a time.
+class Writer {
+public:
+ /// Construct a writer, optionally enabling "Compatibility Mode" as defined
+ /// in the MessagePack specification.
+ ///
+ /// When in \p Compatible mode, the writer will write \c Str16 formats
+ /// instead of \c Str8 formats, and will refuse to write any \c Bin formats.
+ ///
+ /// \param OS stream to output MessagePack objects to.
+ /// \param Compatible when set, write in "Compatibility Mode".
+ Writer(raw_ostream &OS, bool Compatible = false);
+
+ Writer(const Writer &) = delete;
+ Writer &operator=(const Writer &) = delete;
+
+ /// Write a \em Nil to the output stream.
+ ///
+ /// The output will be the \em nil format.
+ void writeNil();
+
+ /// Write a \em Boolean to the output stream.
+ ///
+ /// The output will be a \em bool format.
+ void write(bool b);
+
+ /// Write a signed integer to the output stream.
+ ///
+ /// The output will be in the smallest possible \em int format.
+ ///
+ /// The format chosen may be for an unsigned integer.
+ void write(int64_t i);
+
+ /// Write an unsigned integer to the output stream.
+ ///
+ /// The output will be in the smallest possible \em int format.
+ void write(uint64_t u);
+
+ /// Write a floating point number to the output stream.
+ ///
+ /// The output will be in the smallest possible \em float format.
+ void write(double d);
+
+ /// Write a string to the output stream.
+ ///
+ /// The output will be in the smallest possible \em str format.
+ void write(StringRef s);
+
+ /// Write a memory buffer to the output stream.
+ ///
+ /// The output will be in the smallest possible \em bin format.
+ ///
+ /// \warning Do not use this overload if in \c Compatible mode.
+ void write(MemoryBufferRef Buffer);
+
+ /// Write the header for an \em Array of the given size.
+ ///
+ /// The output will be in the smallest possible \em array format.
+ //
+ /// The header contains an identifier for the \em array format used, as well
+ /// as an encoding of the size of the array.
+ ///
+ /// N.B. The caller must subsequently call \c Write an additional \p Size
+ /// times to complete the array.
+ void writeArraySize(uint32_t Size);
+
+ /// Write the header for a \em Map of the given size.
+ ///
+ /// The output will be in the smallest possible \em map format.
+ //
+ /// The header contains an identifier for the \em map format used, as well
+ /// as an encoding of the size of the map.
+ ///
+ /// N.B. The caller must subsequently call \c Write and additional \c Size*2
+ /// times to complete the map. Each even numbered call to \c Write defines a
+ /// new key, and each odd numbered call defines the previous key's value.
+ void writeMapSize(uint32_t Size);
+
+ /// Write a typed memory buffer (an extension type) to the output stream.
+ ///
+ /// The output will be in the smallest possible \em ext format.
+ void writeExt(int8_t Type, MemoryBufferRef Buffer);
+
+private:
+ support::endian::Writer EW;
+ bool Compatible;
+};
+
+} // end namespace msgpack
+} // end namespace llvm
+
+#endif // LLVM_SUPPORT_MSGPACKPARSER_H
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h b/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h
index fa5448d..44dd92e 100644
--- a/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h
+++ b/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h
@@ -16,6 +16,7 @@
#define LLVM_BINARYFORMAT_WASM_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
namespace llvm {
namespace wasm {
@@ -34,11 +35,6 @@
uint32_t Version;
};
-struct WasmSignature {
- std::vector<uint8_t> ParamTypes;
- uint8_t ReturnType;
-};
-
struct WasmExport {
StringRef Name;
uint8_t Kind;
@@ -104,8 +100,8 @@
uint32_t Size;
uint32_t CodeOffset; // start of Locals and Body
StringRef SymbolName; // from the "linking" section
- StringRef DebugName; // from the "name" section
- uint32_t Comdat; // from the "comdat info" section
+ StringRef DebugName; // from the "name" section
+ uint32_t Comdat; // from the "comdat info" section
};
struct WasmDataSegment {
@@ -191,6 +187,7 @@
WASM_TYPE_I64 = 0x7E,
WASM_TYPE_F32 = 0x7D,
WASM_TYPE_F64 = 0x7C,
+ WASM_TYPE_V128 = 0x7B,
WASM_TYPE_ANYFUNC = 0x70,
WASM_TYPE_EXCEPT_REF = 0x68,
WASM_TYPE_FUNC = 0x60,
@@ -219,33 +216,24 @@
WASM_LIMITS_FLAG_HAS_MAX = 0x1,
};
-// Subset of types that a value can have
-enum class ValType {
- I32 = WASM_TYPE_I32,
- I64 = WASM_TYPE_I64,
- F32 = WASM_TYPE_F32,
- F64 = WASM_TYPE_F64,
- EXCEPT_REF = WASM_TYPE_EXCEPT_REF,
-};
-
// Kind codes used in the custom "name" section
enum : unsigned {
WASM_NAMES_FUNCTION = 0x1,
- WASM_NAMES_LOCAL = 0x2,
+ WASM_NAMES_LOCAL = 0x2,
};
// Kind codes used in the custom "linking" section
enum : unsigned {
- WASM_SEGMENT_INFO = 0x5,
- WASM_INIT_FUNCS = 0x6,
- WASM_COMDAT_INFO = 0x7,
- WASM_SYMBOL_TABLE = 0x8,
+ WASM_SEGMENT_INFO = 0x5,
+ WASM_INIT_FUNCS = 0x6,
+ WASM_COMDAT_INFO = 0x7,
+ WASM_SYMBOL_TABLE = 0x8,
};
// Kind codes used in the custom "linking" section in the WASM_COMDAT_INFO
enum : unsigned {
- WASM_COMDAT_DATA = 0x0,
- WASM_COMDAT_FUNCTION = 0x1,
+ WASM_COMDAT_DATA = 0x0,
+ WASM_COMDAT_FUNCTION = 0x1,
};
// Kind codes used in the custom "linking" section in the WASM_SYMBOL_TABLE
@@ -256,15 +244,15 @@
WASM_SYMBOL_TYPE_SECTION = 0x3,
};
-const unsigned WASM_SYMBOL_BINDING_MASK = 0x3;
-const unsigned WASM_SYMBOL_VISIBILITY_MASK = 0xc;
+const unsigned WASM_SYMBOL_BINDING_MASK = 0x3;
+const unsigned WASM_SYMBOL_VISIBILITY_MASK = 0xc;
-const unsigned WASM_SYMBOL_BINDING_GLOBAL = 0x0;
-const unsigned WASM_SYMBOL_BINDING_WEAK = 0x1;
-const unsigned WASM_SYMBOL_BINDING_LOCAL = 0x2;
+const unsigned WASM_SYMBOL_BINDING_GLOBAL = 0x0;
+const unsigned WASM_SYMBOL_BINDING_WEAK = 0x1;
+const unsigned WASM_SYMBOL_BINDING_LOCAL = 0x2;
const unsigned WASM_SYMBOL_VISIBILITY_DEFAULT = 0x0;
-const unsigned WASM_SYMBOL_VISIBILITY_HIDDEN = 0x4;
-const unsigned WASM_SYMBOL_UNDEFINED = 0x10;
+const unsigned WASM_SYMBOL_VISIBILITY_HIDDEN = 0x4;
+const unsigned WASM_SYMBOL_UNDEFINED = 0x10;
#define WASM_RELOC(name, value) name = value,
@@ -274,9 +262,32 @@
#undef WASM_RELOC
+// Subset of types that a value can have
+enum class ValType {
+ I32 = WASM_TYPE_I32,
+ I64 = WASM_TYPE_I64,
+ F32 = WASM_TYPE_F32,
+ F64 = WASM_TYPE_F64,
+ V128 = WASM_TYPE_V128,
+ EXCEPT_REF = WASM_TYPE_EXCEPT_REF,
+};
+
+struct WasmSignature {
+ SmallVector<wasm::ValType, 1> Returns;
+ SmallVector<wasm::ValType, 4> Params;
+ // Support empty and tombstone instances, needed by DenseMap.
+ enum { Plain, Empty, Tombstone } State = Plain;
+
+ WasmSignature(SmallVector<wasm::ValType, 1> &&InReturns,
+ SmallVector<wasm::ValType, 4> &&InParams)
+ : Returns(InReturns), Params(InParams) {}
+ WasmSignature() = default;
+};
+
// Useful comparison operators
inline bool operator==(const WasmSignature &LHS, const WasmSignature &RHS) {
- return LHS.ReturnType == RHS.ReturnType && LHS.ParamTypes == RHS.ParamTypes;
+ return LHS.State == RHS.State && LHS.Returns == RHS.Returns &&
+ LHS.Params == RHS.Params;
}
inline bool operator!=(const WasmSignature &LHS, const WasmSignature &RHS) {