LLVM  7.0.0svn
Macros | Functions
WasmObjectWriter.cpp File Reference
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixupKindInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionWasm.h"
#include "llvm/MC/MCSymbolWasm.h"
#include "llvm/MC/MCValue.h"
#include "llvm/MC/MCWasmObjectWriter.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/StringSaver.h"
#include <vector>
Include dependency graph for WasmObjectWriter.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "mc"
 

Functions

static void WritePatchableLEB (raw_pwrite_stream &Stream, uint32_t X, uint64_t Offset)
 
static void WritePatchableSLEB (raw_pwrite_stream &Stream, int32_t X, uint64_t Offset)
 
static void WriteI32 (raw_pwrite_stream &Stream, uint32_t X, uint64_t Offset)
 
static const MCSymbolWasmResolveSymbol (const MCSymbolWasm &Symbol)
 
static void addData (SmallVectorImpl< char > &DataBytes, MCSectionWasm &DataSection)
 
static bool isInSymtab (const MCSymbolWasm &Sym)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mc"

Definition at line 38 of file WasmObjectWriter.cpp.

Function Documentation

◆ addData()

static void addData ( SmallVectorImpl< char > &  DataBytes,
MCSectionWasm DataSection 
)
static

Definition at line 614 of file WasmObjectWriter.cpp.

References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::alignTo(), assert(), C, llvm::dbgs(), llvm::ArrayRef< T >::empty(), llvm::encodeSLEB128(), llvm::encodeULEB128(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::errs(), llvm::Export, F(), llvm::MCSection::getAlignment(), llvm::MCSymbolWasm::getParams(), llvm::MCSymbolWasm::getReturns(), llvm::MCSectionWasm::getSectionName(), llvm::Import, llvm::SmallVectorImpl< T >::insert(), llvm::MCSymbolWasm::isFunction(), LLVM_DEBUG, llvm_unreachable, llvm::report_fatal_error(), llvm::SmallVectorImpl< T >::resize(), ResolveSymbol(), llvm::ARMBuildAttrs::Section, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::ArrayRef< T >::size(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Size, llvm::StringRef::str(), llvm::ARMBuildAttrs::Symbol, llvm::RISCVFenceField::W, llvm::wasm::WASM_COMDAT_INFO, llvm::wasm::WASM_EXTERNAL_FUNCTION, llvm::wasm::WASM_EXTERNAL_GLOBAL, llvm::wasm::WASM_EXTERNAL_MEMORY, llvm::wasm::WASM_EXTERNAL_TABLE, llvm::wasm::WASM_INIT_FUNCS, llvm::wasm::WASM_OPCODE_END, llvm::wasm::WASM_OPCODE_I32_CONST, llvm::wasm::WASM_SEC_CODE, llvm::wasm::WASM_SEC_DATA, llvm::wasm::WASM_SEC_ELEM, llvm::wasm::WASM_SEC_EXPORT, llvm::wasm::WASM_SEC_FUNCTION, llvm::wasm::WASM_SEC_GLOBAL, llvm::wasm::WASM_SEC_IMPORT, llvm::wasm::WASM_SEC_TYPE, llvm::wasm::WASM_SEGMENT_INFO, llvm::wasm::WASM_SYMBOL_TABLE, llvm::wasm::WASM_SYMBOL_TYPE_DATA, llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION, llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL, llvm::wasm::WASM_SYMBOL_TYPE_SECTION, llvm::wasm::WASM_SYMBOL_UNDEFINED, llvm::wasm::WASM_TYPE_FUNC, llvm::wasm::WasmMetadataVersion, llvm::wasm::WasmPageSize, WriteI32(), WritePatchableLEB(), WritePatchableSLEB(), and llvm::MCAssembler::writeSectionData().

Referenced by isInSymtab().

◆ isInSymtab()

static bool isInSymtab ( const MCSymbolWasm Sym)
static

Definition at line 1058 of file WasmObjectWriter.cpp.

References addData(), llvm::alignTo(), assert(), C, llvm::wasm::WasmSymbolInfo::DataRef, llvm::dbgs(), llvm::dyn_cast(), llvm::wasm::WasmSymbolInfo::ElementIndex, llvm::SmallVectorImpl< T >::emplace_back(), llvm::StringRef::empty(), llvm::sys::path::end(), llvm::wasm::WasmImport::Field, llvm::wasm::WasmSymbolInfo::Flags, llvm::MCFragment::FT_Align, llvm::MCFragment::FT_Data, llvm::MCAssembler::getContext(), llvm::MCFragment::getKind(), llvm::MCFixup::getKind(), llvm::MCFixup::getKindForSize(), llvm::MCSymbolWasm::getModuleName(), llvm::MCSymbol::getName(), llvm::Value::getName(), llvm::MCContext::getOrCreateSymbol(), llvm::MCSymbolWasm::getSize(), llvm::MCAsmLayout::getSymbolOffset(), llvm::MCFixup::getValue(), llvm::wasm::WasmImport::Global, llvm::MCFragment::hasInstructions(), llvm::Import, is64Bit(), llvm::MCSymbolWasm::isComdat(), llvm::MCSymbolWasm::isData(), llvm::MCSymbol::isDefined(), llvm::MCSymbolWasm::isSection(), llvm::MCSymbol::isTemporary(), llvm::MCSymbol::isUsedInReloc(), IT, llvm::wasm::WasmImport::Kind, llvm::wasm::WasmSymbolInfo::Kind, LLVM_DEBUG, llvm::wasm::WasmImport::Module, llvm::wasm::WasmSymbolInfo::Name, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::Ref, llvm::report_fatal_error(), ResolveSymbol(), llvm::ARMBuildAttrs::Section, AMDGPU::ElfNote::SectionName, llvm::MCSymbol::setIndex(), llvm::wasm::WasmImport::SigIndex, llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Size, llvm::StringRef::startswith(), llvm::MCAssembler::symbols(), llvm::toString(), llvm::MCSymbolRefExpr::VK_WebAssembly_FUNCTION, llvm::RISCVFenceField::W, llvm::wasm::WASM_COMDAT_DATA, llvm::wasm::WASM_COMDAT_FUNCTION, llvm::wasm::WASM_EXTERNAL_FUNCTION, llvm::wasm::WASM_EXTERNAL_GLOBAL, llvm::wasm::WASM_EXTERNAL_MEMORY, llvm::wasm::WASM_EXTERNAL_TABLE, llvm::wasm::WASM_SYMBOL_BINDING_LOCAL, llvm::wasm::WASM_SYMBOL_BINDING_WEAK, llvm::wasm::WASM_SYMBOL_UNDEFINED, llvm::wasm::WASM_SYMBOL_VISIBILITY_HIDDEN, and llvm::wasm::WASM_TYPE_ANYFUNC.

Referenced by isWeak().

◆ ResolveSymbol()

static const MCSymbolWasm* ResolveSymbol ( const MCSymbolWasm Symbol)
static

◆ WriteI32()

static void WriteI32 ( raw_pwrite_stream Stream,
uint32_t  X,
uint64_t  Offset 
)
static

Definition at line 551 of file WasmObjectWriter.cpp.

References llvm::raw_pwrite_stream::pwrite(), and llvm::support::endian::write32le().

Referenced by addData().

◆ WritePatchableLEB()

static void WritePatchableLEB ( raw_pwrite_stream Stream,
uint32_t  X,
uint64_t  Offset 
)
static

Definition at line 533 of file WasmObjectWriter.cpp.

References assert(), llvm::encodeULEB128(), and llvm::raw_pwrite_stream::pwrite().

Referenced by addData().

◆ WritePatchableSLEB()

static void WritePatchableSLEB ( raw_pwrite_stream Stream,
int32_t  X,
uint64_t  Offset 
)
static

Definition at line 543 of file WasmObjectWriter.cpp.

References assert(), llvm::encodeSLEB128(), and llvm::raw_pwrite_stream::pwrite().

Referenced by addData().