LLVM  9.0.0svn
Macros | Functions
WasmObjectFile.cpp File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Triple.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/SymbolicFile.h"
#include "llvm/Object/Wasm.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/ScopedPrinter.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <system_error>
#include "llvm/BinaryFormat/WasmRelocs.def"
Include dependency graph for WasmObjectFile.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "wasm-object"
 
#define VARINT7_MAX   ((1 << 7) - 1)
 
#define VARINT7_MIN   (-(1 << 7))
 
#define VARUINT7_MAX   (1 << 7)
 
#define VARUINT1_MAX   (1)
 
#define ECase(X)
 
#define WASM_RELOC(name, value)
 

Functions

static uint8_t readUint8 (WasmObjectFile::ReadContext &Ctx)
 
static uint32_t readUint32 (WasmObjectFile::ReadContext &Ctx)
 
static int32_t readFloat32 (WasmObjectFile::ReadContext &Ctx)
 
static int64_t readFloat64 (WasmObjectFile::ReadContext &Ctx)
 
static uint64_t readULEB128 (WasmObjectFile::ReadContext &Ctx)
 
static StringRef readString (WasmObjectFile::ReadContext &Ctx)
 
static int64_t readLEB128 (WasmObjectFile::ReadContext &Ctx)
 
static uint8_t readVaruint1 (WasmObjectFile::ReadContext &Ctx)
 
static int32_t readVarint32 (WasmObjectFile::ReadContext &Ctx)
 
static uint32_t readVaruint32 (WasmObjectFile::ReadContext &Ctx)
 
static int64_t readVarint64 (WasmObjectFile::ReadContext &Ctx)
 
static uint8_t readOpcode (WasmObjectFile::ReadContext &Ctx)
 
static Error readInitExpr (wasm::WasmInitExpr &Expr, WasmObjectFile::ReadContext &Ctx)
 
static wasm::WasmLimits readLimits (WasmObjectFile::ReadContext &Ctx)
 
static wasm::WasmTable readTable (WasmObjectFile::ReadContext &Ctx)
 
static Error readSection (WasmSection &Section, WasmObjectFile::ReadContext &Ctx, WasmSectionOrderChecker &Checker)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "wasm-object"

Definition at line 34 of file WasmObjectFile.cpp.

◆ ECase

#define ECase (   X)
Value:
case wasm::WASM_SEC_##X: \
return #X;
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")

Referenced by llvm::object::WasmObjectFile::getSectionName().

◆ VARINT7_MAX

#define VARINT7_MAX   ((1 << 7) - 1)

Definition at line 66 of file WasmObjectFile.cpp.

◆ VARINT7_MIN

#define VARINT7_MIN   (-(1 << 7))

Definition at line 67 of file WasmObjectFile.cpp.

◆ VARUINT1_MAX

#define VARUINT1_MAX   (1)

Definition at line 69 of file WasmObjectFile.cpp.

Referenced by readVaruint1().

◆ VARUINT7_MAX

#define VARUINT7_MAX   (1 << 7)

Definition at line 68 of file WasmObjectFile.cpp.

◆ WASM_RELOC

#define WASM_RELOC (   name,
  value 
)
Value:
case wasm::name: \
Res = #name; \
break;
static const char * name

Function Documentation

◆ readFloat32()

static int32_t readFloat32 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 85 of file WasmObjectFile.cpp.

References llvm::report_fatal_error().

Referenced by readInitExpr().

◆ readFloat64()

static int64_t readFloat64 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 94 of file WasmObjectFile.cpp.

References llvm::report_fatal_error().

Referenced by readInitExpr().

◆ readInitExpr()

static Error readInitExpr ( wasm::WasmInitExpr Expr,
WasmObjectFile::ReadContext &  Ctx 
)
static

◆ readLEB128()

static int64_t readLEB128 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 123 of file WasmObjectFile.cpp.

References llvm::decodeSLEB128(), and llvm::report_fatal_error().

Referenced by readVarint32(), readVarint64(), and readVaruint1().

◆ readLimits()

static wasm::WasmLimits readLimits ( WasmObjectFile::ReadContext &  Ctx)
static

◆ readOpcode()

static uint8_t readOpcode ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 158 of file WasmObjectFile.cpp.

References readUint8().

Referenced by readInitExpr().

◆ readSection()

static Error readSection ( WasmSection &  Section,
WasmObjectFile::ReadContext &  Ctx,
WasmSectionOrderChecker &  Checker 
)
static

◆ readString()

static StringRef readString ( WasmObjectFile::ReadContext &  Ctx)
static

◆ readTable()

static wasm::WasmTable readTable ( WasmObjectFile::ReadContext &  Ctx)
static

◆ readUint32()

static uint32_t readUint32 ( WasmObjectFile::ReadContext &  Ctx)
static

◆ readUint8()

static uint8_t readUint8 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 71 of file WasmObjectFile.cpp.

References llvm::report_fatal_error().

Referenced by readOpcode(), readSection(), and readTable().

◆ readULEB128()

static uint64_t readULEB128 ( WasmObjectFile::ReadContext &  Ctx)
static

◆ readVarint32()

static int32_t readVarint32 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 140 of file WasmObjectFile.cpp.

References readLEB128(), and llvm::report_fatal_error().

Referenced by readInitExpr().

◆ readVarint64()

static int64_t readVarint64 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 154 of file WasmObjectFile.cpp.

References readLEB128().

Referenced by readInitExpr().

◆ readVaruint1()

static uint8_t readVaruint1 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 133 of file WasmObjectFile.cpp.

References readLEB128(), llvm::report_fatal_error(), and VARUINT1_MAX.

◆ readVaruint32()

static uint32_t readVaruint32 ( WasmObjectFile::ReadContext &  Ctx)
static

Definition at line 147 of file WasmObjectFile.cpp.

References readULEB128(), and llvm::report_fatal_error().

Referenced by readLimits(), and readSection().