LLVM 19.0.0git
Macros | Functions
WasmObjectFile.cpp File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/Wasm.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/Format.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/TargetParser/SubtargetFeature.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <limits>
#include "llvm/BinaryFormat/WasmRelocs.def"

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 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 wasm::ValType parseValType (WasmObjectFile::ReadContext &Ctx, uint32_t Code)
 
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.

◆ VARINT7_MAX

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

Definition at line 78 of file WasmObjectFile.cpp.

◆ VARINT7_MIN

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

Definition at line 79 of file WasmObjectFile.cpp.

◆ VARUINT1_MAX

#define VARUINT1_MAX   (1)

Definition at line 81 of file WasmObjectFile.cpp.

◆ VARUINT7_MAX

#define VARUINT7_MAX   (1 << 7)

Definition at line 80 of file WasmObjectFile.cpp.

◆ WASM_RELOC

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

Function Documentation

◆ parseValType()

static wasm::ValType parseValType ( WasmObjectFile::ReadContext Ctx,
uint32_t  Code 
)
static

◆ readFloat32()

static int32_t readFloat32 ( WasmObjectFile::ReadContext Ctx)
static

◆ readFloat64()

static int64_t readFloat64 ( WasmObjectFile::ReadContext Ctx)
static

◆ readInitExpr()

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

◆ readLEB128()

static int64_t readLEB128 ( WasmObjectFile::ReadContext Ctx)
static

◆ readLimits()

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

Definition at line 290 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 174 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

◆ 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

◆ readULEB128()

static uint64_t readULEB128 ( WasmObjectFile::ReadContext Ctx)
static

◆ readVarint32()

static int32_t readVarint32 ( WasmObjectFile::ReadContext Ctx)
static

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

References readLEB128().

Referenced by parseValType(), and readInitExpr().

◆ readVaruint1()

static uint8_t readVaruint1 ( WasmObjectFile::ReadContext Ctx)
static

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

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

Referenced by readInitExpr(), readLimits(), readSection(), and readTableType().

◆ readVaruint64()

static uint64_t readVaruint64 ( WasmObjectFile::ReadContext Ctx)
static

Definition at line 170 of file WasmObjectFile.cpp.

References readULEB128().

Referenced by readLimits().