LLVM  14.0.0git
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/StringSwitch.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 uint64_t readVaruint64 (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::WasmTableType readTableType (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 35 of file WasmObjectFile.cpp.

◆ ECase

#define ECase (   X)
Value:
case wasm::WASM_SEC_##X: \
return #X;

◆ VARINT7_MAX

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

Definition at line 67 of file WasmObjectFile.cpp.

◆ VARINT7_MIN

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

Definition at line 68 of file WasmObjectFile.cpp.

◆ VARUINT1_MAX

#define VARUINT1_MAX   (1)

Definition at line 70 of file WasmObjectFile.cpp.

◆ VARUINT7_MAX

#define VARUINT7_MAX   (1 << 7)

Definition at line 69 of file WasmObjectFile.cpp.

◆ WASM_RELOC

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

Function Documentation

◆ readFloat32()

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

Definition at line 86 of file WasmObjectFile.cpp.

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

Referenced by readInitExpr().

◆ readFloat64()

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

Definition at line 95 of file WasmObjectFile.cpp.

References memcpy(), and 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 124 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

Definition at line 208 of file WasmObjectFile.cpp.

References readVaruint32(), readVaruint64(), and llvm::wasm::WASM_LIMITS_FLAG_HAS_MAX.

Referenced by readTableType().

◆ readOpcode()

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

Definition at line 163 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

Definition at line 114 of file WasmObjectFile.cpp.

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

Referenced by readSection().

◆ readTableType()

static wasm::WasmTableType readTableType ( 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 72 of file WasmObjectFile.cpp.

References llvm::report_fatal_error().

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

◆ readULEB128()

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

◆ readVarint32()

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

Definition at line 141 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 155 of file WasmObjectFile.cpp.

References readLEB128().

Referenced by readInitExpr().

◆ readVaruint1()

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

Definition at line 134 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 148 of file WasmObjectFile.cpp.

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

Referenced by readLimits(), and readSection().

◆ readVaruint64()

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

Definition at line 159 of file WasmObjectFile.cpp.

References readULEB128().

Referenced by readLimits().

X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78