LLVM  8.0.1
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 623 of file WasmObjectWriter.cpp.

References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::alignTo(), assert(), B, llvm::SmallVectorTemplateCommon< T, typename >::begin(), C, llvm::dbgs(), llvm::ArrayRef< T >::empty(), llvm::encodeSLEB128(), llvm::encodeULEB128(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::errs(), llvm::Export, llvm::MCSection::getAlignment(), llvm::MCSectionWasm::getSectionName(), llvm::MCSymbolWasm::getSignature(), llvm::Import, llvm::SmallVectorImpl< T >::insert(), llvm::MCSymbolWasm::isEvent(), llvm::MCSymbolWasm::isFunction(), LLVM_DEBUG, llvm_unreachable, llvm::report_fatal_error(), llvm::SmallVectorImpl< T >::resize(), ResolveSymbol(), llvm::ARMBuildAttrs::Section, Size, llvm::SmallVectorBase::size(), llvm::ArrayRef< T >::size(), llvm::StringRef::str(), llvm::ARMBuildAttrs::Symbol, llvm::RISCVFenceField::W, llvm::wasm::WASM_COMDAT_INFO, llvm::wasm::WASM_EXTERNAL_EVENT, 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_EVENT, 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_EXPLICIT_NAME, llvm::wasm::WASM_SYMBOL_TABLE, llvm::wasm::WASM_SYMBOL_TYPE_DATA, llvm::wasm::WASM_SYMBOL_TYPE_EVENT, 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 1129 of file WasmObjectWriter.cpp.

References addData(), llvm::alignTo(), assert(), llvm::wasm::WasmEventType::Attribute, 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::Event, llvm::wasm::WasmImport::Field, llvm::wasm::WasmSymbolInfo::Flags, llvm::MCFragment::FT_Align, llvm::MCFragment::FT_Data, llvm::MCAssembler::getContext(), llvm::MCSymbolWasm::getImportModule(), llvm::MCSymbolWasm::getImportName(), llvm::MCFragment::getKind(), llvm::MCFixup::getKind(), llvm::MCFixup::getKindForSize(), 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, Info, 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::Log2_32(), llvm::wasm::WasmImport::Module, llvm::wasm::WasmSymbolInfo::Name, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Ref, llvm::report_fatal_error(), ResolveSymbol(), llvm::ARMBuildAttrs::Section, AMDGPU::ElfNote::SectionName, llvm::MCSymbol::setIndex(), llvm::wasm::WasmEventType::SigIndex, llvm::wasm::WasmImport::SigIndex, Size, llvm::SmallVectorBase::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_EVENT_ATTRIBUTE_EXCEPTION, llvm::wasm::WASM_EXTERNAL_EVENT, 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_EXPLICIT_NAME, llvm::wasm::WASM_SYMBOL_UNDEFINED, llvm::wasm::WASM_SYMBOL_VISIBILITY_HIDDEN, and llvm::wasm::WASM_TYPE_FUNCREF.

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 559 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 540 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 550 of file WasmObjectWriter.cpp.

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

Referenced by addData().