39 #define DEBUG_TYPE "mc"
46 struct SectionBookkeeping {
50 uint64_t ContentsOffset;
55 struct WasmFunctionType {
57 enum { Plain,
Empty, Tombstone } State;
65 WasmFunctionType() : State(Plain) {}
68 return State == Other.State && Returns == Other.Returns &&
69 Params == Other.Params;
74 struct WasmFunctionTypeDenseMapInfo {
75 static WasmFunctionType getEmptyKey() {
76 WasmFunctionType FuncTy;
80 static WasmFunctionType getTombstoneKey() {
81 WasmFunctionType FuncTy;
82 FuncTy.State = WasmFunctionType::Tombstone;
85 static unsigned getHashValue(
const WasmFunctionType &FuncTy) {
86 uintptr_t
Value = FuncTy.State;
93 static bool isEqual(
const WasmFunctionType &LHS,
94 const WasmFunctionType &RHS) {
108 struct WasmFunction {
125 uint64_t InitialValue;
130 struct WasmRelocationEntry {
138 int64_t Addend,
unsigned Type,
141 FixupSection(FixupSection) {}
143 bool hasAddend()
const {
145 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_LEB:
146 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_SLEB:
147 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_I32:
155 Out <<
"Off=" << Offset <<
", Sym=" << *Symbol <<
", Addend=" << Addend
156 <<
", Type=" << Type <<
", FixupSection=" << FixupSection;
159 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
173 struct WasmSymbolData {
178 bool operator<(
const WasmSymbolData &RHS)
const {
return Name < RHS.Name; }
182 std::unique_ptr<MCWasmObjectTargetWriter> TargetObjectWriter;
185 std::vector<WasmRelocationEntry> CodeRelocations;
188 std::vector<WasmRelocationEntry> DataRelocations;
204 bool is64Bit()
const {
return TargetObjectWriter->is64Bit(); }
206 return TargetObjectWriter->getRelocType(Target, Fixup);
209 void startSection(SectionBookkeeping &
Section,
unsigned SectionId,
210 const char *
Name =
nullptr);
211 void endSection(SectionBookkeeping &Section);
218 ~WasmObjectWriter()
override;
220 void reset()
override {
221 CodeRelocations.clear();
222 DataRelocations.clear();
224 SymbolIndices.clear();
225 IndirectSymbolIndices.clear();
226 FunctionTypeIndices.clear();
227 FunctionTypes.clear();
235 MCValue Target, uint64_t &FixedValue)
override;
254 void writeTableSection(
uint32_t NumElements);
266 void writeCodeRelocSection();
267 void writeDataRelocSection(uint64_t DataSectionHeaderSize);
270 bool HasStackPointer,
274 uint64_t ContentsOffset);
277 uint64_t HeaderSize);
278 uint32_t getRelocationIndexValue(
const WasmRelocationEntry &RelEntry);
285 WasmObjectWriter::~WasmObjectWriter() {}
298 void WasmObjectWriter::startSection(SectionBookkeeping &
Section,
302 "Only custom sections can have names");
304 DEBUG(
dbgs() <<
"startSection " << SectionId <<
": " << Name <<
"\n");
307 Section.SizeOffset = getStream().tell();
314 Section.ContentsOffset = getStream().tell();
325 void WasmObjectWriter::endSection(SectionBookkeeping &Section) {
326 uint64_t
Size = getStream().tell() - Section.ContentsOffset;
330 DEBUG(
dbgs() <<
"endSection size=" << Size <<
"\n");
338 getStream().pwrite((
char *)Buffer, SizeLen, Section.SizeOffset);
347 void WasmObjectWriter::executePostLayoutBinding(
MCAssembler &Asm,
351 void WasmObjectWriter::recordRelocation(
MCAssembler &Asm,
355 uint64_t &FixedValue) {
359 const auto &FixupSection = cast<MCSectionWasm>(*Fragment->
getParent());
366 "Should not have constructed this");
378 "No relocation available to represent this relative expression");
382 const auto &SymB = cast<MCSymbolWasm>(RefB->getSymbol());
384 if (SymB.isUndefined()) {
386 Twine(
"symbol '") + SymB.getName() +
387 "' can not be undefined in a subtraction expression");
391 assert(!SymB.isAbsolute() &&
"Should have been folded");
392 const MCSection &SecB = SymB.getSection();
393 if (&SecB != &FixupSection) {
395 "Cannot represent a difference across sections");
400 uint64_t K = SymBOffset - FixupOffset;
407 const auto *SymA = RefA ? cast<MCSymbolWasm>(&RefA->
getSymbol()) :
nullptr;
409 if (SymA && SymA->isVariable()) {
410 const MCExpr *Expr = SymA->getVariableValue();
411 const auto *Inner = cast<MCSymbolRefExpr>(Expr);
422 SymA->setUsedInReloc();
429 WasmRelocationEntry Rec(FixupOffset, SymA, C, Type, &FixupSection);
430 DEBUG(
dbgs() <<
"WasmReloc: " << Rec <<
"\n");
432 if (FixupSection.hasInstructions())
433 CodeRelocations.push_back(Rec);
435 DataRelocations.push_back(Rec);
446 Stream.
pwrite((
char *)Buffer, SizeLen, Offset);
457 Stream.
pwrite((
char *)Buffer, SizeLen, Offset);
464 Stream.
pwrite((
char *)Buffer,
sizeof(Buffer), Offset);
478 const auto &Section = cast<MCSectionWasm>(RelEntry.Symbol->getSection(
false));
479 uint64_t
Address = Section.getSectionOffset() + RelEntry.Addend;
487 uint32_t WasmObjectWriter::getRelocationIndexValue(
488 const WasmRelocationEntry &RelEntry) {
489 switch (RelEntry.Type) {
490 case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
491 case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
492 if (!IndirectSymbolIndices.count(RelEntry.Symbol))
494 RelEntry.Symbol->getName());
495 return IndirectSymbolIndices[RelEntry.Symbol];
496 case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
497 case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
498 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_LEB:
499 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_SLEB:
500 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_I32:
501 if (!SymbolIndices.count(RelEntry.Symbol))
503 RelEntry.Symbol->getName());
504 return SymbolIndices[RelEntry.Symbol];
505 case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
506 if (!TypeIndices.count(RelEntry.Symbol))
508 RelEntry.Symbol->getName());
509 return TypeIndices[RelEntry.Symbol];
517 void WasmObjectWriter::applyRelocations(
520 for (
const WasmRelocationEntry &RelEntry : Relocations) {
521 uint64_t
Offset = ContentsOffset +
522 RelEntry.FixupSection->getSectionOffset() +
525 DEBUG(
dbgs() <<
"applyRelocation: " << RelEntry <<
"\n");
526 switch (RelEntry.Type) {
527 case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
528 case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
529 case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
530 case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB: {
531 uint32_t Index = getRelocationIndexValue(RelEntry);
535 case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32: {
536 uint32_t Index = getRelocationIndexValue(RelEntry);
540 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_SLEB: {
545 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_LEB: {
550 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_I32: {
563 void WasmObjectWriter::writeRelocations(
566 for (
const WasmRelocationEntry& RelEntry : Relocations) {
568 uint64_t Offset = RelEntry.Offset +
569 RelEntry.FixupSection->getSectionOffset() + HeaderSize;
570 uint32_t Index = getRelocationIndexValue(RelEntry);
575 if (RelEntry.hasAddend())
580 void WasmObjectWriter::writeTypeSection(
582 if (FunctionTypes.
empty())
590 for (
const WasmFunctionType &FuncTy : FunctionTypes) {
604 void WasmObjectWriter::writeImportSection(
613 for (
const WasmImport &Import : Imports) {
614 writeString(
Import.ModuleName);
615 writeString(
Import.FieldName);
635 void WasmObjectWriter::writeFunctionSection(
637 if (Functions.
empty())
644 for (
const WasmFunction &Func : Functions)
650 void WasmObjectWriter::writeTableSection(
uint32_t NumElements) {
667 void WasmObjectWriter::writeMemorySection(
685 void WasmObjectWriter::writeGlobalSection(
694 for (
const WasmGlobal &Global : Globals) {
695 writeValueType(
Global.Type);
713 void WasmObjectWriter::writeExportSection(
722 for (
const WasmExport &Export : Exports) {
723 writeString(
Export.FieldName);
731 void WasmObjectWriter::writeElemSection(
733 if (TableElems.
empty())
754 void WasmObjectWriter::writeCodeSection(
757 if (Functions.
empty())
765 for (
const WasmFunction &Func : Functions) {
766 auto &FuncSection =
static_cast<MCSectionWasm &
>(Func.Sym->getSection());
769 if (!Func.Sym->getSize()->evaluateAsAbsolute(Size, Layout))
774 FuncSection.setSectionOffset(getStream().tell() - Section.ContentsOffset);
780 applyRelocations(CodeRelocations, Section.ContentsOffset);
785 uint64_t WasmObjectWriter::writeDataSection(
787 if (DataBytes.
empty())
799 uint32_t HeaderSize = getStream().tell() - Section.ContentsOffset;
800 writeBytes(DataBytes);
803 applyRelocations(DataRelocations, Section.ContentsOffset + HeaderSize);
809 void WasmObjectWriter::writeNameSection(
812 unsigned NumFuncImports) {
813 uint32_t TotalFunctions = NumFuncImports + Functions.
size();
814 if (TotalFunctions == 0)
819 SectionBookkeeping SubSection;
824 for (
const WasmImport &Import : Imports) {
827 writeString(
Import.FieldName);
831 for (
const WasmFunction &Func : Functions) {
833 writeString(Func.Sym->getName());
837 endSection(SubSection);
841 void WasmObjectWriter::writeCodeRelocSection() {
845 if (CodeRelocations.empty())
854 writeRelocations(CodeRelocations, 0);
859 void WasmObjectWriter::writeDataRelocSection(uint64_t DataSectionHeaderSize) {
863 if (DataRelocations.empty())
872 writeRelocations(DataRelocations, DataSectionHeaderSize);
877 void WasmObjectWriter::writeLinkingMetaDataSection(
879 bool HasStackPointer,
uint32_t StackPointerGlobal) {
882 SectionBookkeeping SubSection;
884 if (HasStackPointer) {
887 endSection(SubSection);
890 if (WeakSymbols.
size() != 0) {
893 for (
const StringRef Export: WeakSymbols) {
897 endSection(SubSection);
903 endSection(SubSection);
907 endSection(SubSection);
915 assert(TypeIndices.count(&Symbol));
916 return TypeIndices[&
Symbol];
925 auto *Inner = cast<MCSymbolRefExpr>(Expr);
926 const auto *ResolvedSym = cast<MCSymbolWasm>(&Inner->getSymbol());
927 F.Returns = ResolvedSym->getReturns();
928 F.Params = ResolvedSym->getParams();
935 FunctionTypeIndices.
insert(std::make_pair(F, FunctionTypes.size()));
937 FunctionTypes.push_back(F);
938 TypeIndices[&
Symbol] = Pair.first->second;
940 DEBUG(
dbgs() <<
"registerFunctionType: " << Symbol <<
" new:" << Pair.second <<
"\n");
941 DEBUG(
dbgs() <<
" -> type index: " << Pair.first->second <<
"\n");
942 return Pair.first->second;
945 void WasmObjectWriter::writeObject(
MCAssembler &Asm,
947 DEBUG(
dbgs() <<
"WasmObjectWriter::writeObject\n");
959 unsigned NumFuncImports = 0;
960 unsigned NumGlobalImports = 0;
964 bool HasStackPointer =
false;
967 for (
const WasmRelocationEntry &RelEntry : CodeRelocations) {
968 switch (RelEntry.Type) {
969 case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
970 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_SLEB:
971 IsAddressTaken.
insert(RelEntry.Symbol);
977 for (
const WasmRelocationEntry &RelEntry : DataRelocations) {
978 switch (RelEntry.Type) {
979 case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
980 case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_I32:
981 IsAddressTaken.
insert(RelEntry.Symbol);
992 if (WS.isTemporary())
996 registerFunctionType(WS);
999 if (!WS.isDefined(
false) || WS.isVariable()) {
1001 Import.ModuleName = WS.getModuleName();
1002 Import.FieldName = WS.getName();
1004 if (WS.isFunction()) {
1006 Import.Type = getFunctionType(WS);
1007 SymbolIndices[&WS] = NumFuncImports;
1011 Import.Type = int32_t(PtrType);
1012 SymbolIndices[&WS] = NumGlobalImports;
1030 const auto &DataFrag = cast<MCDataFragment>(Frag);
1031 if (!DataFrag.getFixups().empty())
1034 for (
const uint8_t *p = (
const uint8_t *)Contents.
data(),
1035 *
end = (
const uint8_t *)Contents.
data() + Contents.
size();
1041 G.IsMutable =
bool(*p++);
1042 G.HasImport =
bool(*p++);
1047 Import.ModuleName = (
const char *)p;
1048 const uint8_t *nul = (
const uint8_t *)memchr(p,
'\0',
end - p);
1052 nul = (
const uint8_t *)memchr(p,
'\0',
end - p);
1055 Import.FieldName = (
const char *)p;
1059 Import.Type = int32_t(G.Type);
1061 G.ImportIndex = NumGlobalImports;
1086 const auto &DataFrag = cast<MCDataFragment>(Frag);
1087 if (!DataFrag.getFixups().empty())
1090 if (Contents.
size() != 4)
1092 HasStackPointer =
true;
1093 StackPointerGlobal = NumGlobalImports + *(
const int32_t *)Contents.
data();
1100 if (S.isTemporary() && S.getName().empty())
1104 DEBUG(
dbgs() <<
"MCSymbol: '" << S <<
"'"
1105 <<
" isDefined=" << S.isDefined() <<
" isExternal="
1106 << S.isExternal() <<
" isTemporary=" << S.isTemporary()
1107 <<
" isFunction=" << WS.isFunction()
1108 <<
" isWeak=" << WS.isWeak()
1109 <<
" isVariable=" << WS.isVariable() <<
"\n");
1114 if (WS.isVariable())
1119 if (WS.isFunction()) {
1120 if (WS.isDefined(
false)) {
1121 if (WS.getOffset() != 0)
1123 "function sections must contain one function each");
1125 if (WS.getSize() == 0)
1127 "function symbols must have a size set with .size");
1130 Index = NumFuncImports + Functions.
size();
1134 Func.Type = getFunctionType(WS);
1136 SymbolIndices[&WS] = Index;
1140 Index = SymbolIndices.find(&WS)->second;
1143 DEBUG(
dbgs() <<
" -> function index: " << Index <<
"\n");
1146 if (IsAddressTaken.
count(&WS) != 0) {
1147 IndirectSymbolIndices[&WS] = TableElems.
size();
1148 DEBUG(
dbgs() <<
" -> adding to table: " << TableElems.
size() <<
"\n");
1152 if (WS.isTemporary() && !WS.getSize())
1155 if (!WS.isDefined(
false))
1158 if (WS.getOffset() != 0)
1166 if (!WS.getSize()->evaluateAsAbsolute(Size, Layout))
1169 auto &DataSection =
static_cast<MCSectionWasm &
>(WS.getSection());
1175 DataAlignment =
std::max(DataAlignment, DataSection.getAlignment());
1177 DataSection.setSectionOffset(DataBytes.
size());
1183 if (
auto *
Align = dyn_cast<MCAlignFragment>(&Frag)) {
1184 if (
Align->getValueSize() != 1)
1188 uint64_t Size = std::min<uint64_t>(
alignTo(DataBytes.
size(),
1189 Align->getAlignment()),
1191 Align->getMaxBytesToEmit());
1192 DataBytes.
resize(Size, Value);
1193 }
else if (
auto *Fill = dyn_cast<MCFillFragment>(&Frag)) {
1194 DataBytes.
insert(DataBytes.
end(), Fill->getSize(), Fill->getValue());
1196 const auto &DataFrag = cast<MCDataFragment>(Frag);
1199 DataBytes.
insert(DataBytes.
end(), Contents.begin(), Contents.end());
1205 Index = NumGlobalImports + Globals.
size();
1208 Global.Type = PtrType;
1209 Global.IsMutable =
false;
1210 Global.HasImport =
false;
1211 Global.InitialValue = DataSection.getSectionOffset();
1212 Global.ImportIndex = 0;
1213 SymbolIndices[&WS] = Index;
1214 DEBUG(
dbgs() <<
" -> global index: " << Index <<
"\n");
1219 if ((WS.isExternal() && WS.isDefined(
false))) {
1221 Export.FieldName = WS.getName();
1222 Export.Index = Index;
1223 if (WS.isFunction())
1236 if (!S.isVariable())
1238 assert(S.isDefined(
false));
1242 const MCExpr *Expr = WS.getVariableValue();
1243 auto *Inner = cast<MCSymbolRefExpr>(Expr);
1244 const auto *ResolvedSym = cast<MCSymbolWasm>(&Inner->getSymbol());
1245 DEBUG(
dbgs() << WS.getName() <<
": weak alias of '" << *ResolvedSym <<
"'\n");
1246 assert(SymbolIndices.count(ResolvedSym) > 0);
1247 uint32_t Index = SymbolIndices.find(ResolvedSym)->second;
1248 DEBUG(
dbgs() <<
" -> index:" << Index <<
"\n");
1251 Export.FieldName = WS.getName();
1252 Export.Index = Index;
1253 if (WS.isFunction())
1262 for (
const WasmRelocationEntry &Fixup : CodeRelocations) {
1263 if (Fixup.Type != wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB)
1266 registerFunctionType(*Fixup.Symbol);
1272 writeTypeSection(FunctionTypes);
1273 writeImportSection(Imports);
1274 writeFunctionSection(Functions);
1275 writeTableSection(TableElems.
size());
1276 writeMemorySection(DataBytes);
1277 writeGlobalSection(Globals);
1278 writeExportSection(Exports);
1280 writeElemSection(TableElems);
1281 writeCodeSection(Asm, Layout, Functions);
1282 uint64_t DataSectionHeaderSize = writeDataSection(DataBytes);
1283 writeNameSection(Functions, Imports, NumFuncImports);
1284 writeCodeRelocSection();
1285 writeDataRelocSection(DataSectionHeaderSize);
1286 writeLinkingMetaDataSection(DataBytes.
size(), DataAlignment, WeakSymbols, HasStackPointer, StackPointerGlobal);
1294 return new WasmObjectWriter(MOTW, OS);
MCObjectWriter * createWasmObjectWriter(MCWasmObjectTargetWriter *MOTW, raw_pwrite_stream &OS)
Construct a new Wasm writer instance.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static unsigned PaddingFor5ByteULEB128(uint32_t X)
MCSectionWasm * getWasmSection(const Twine &Section, unsigned Type, unsigned Flags)
const MCSymbol & getSymbol() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static void WriteI32(raw_pwrite_stream &Stream, uint32_t X, uint64_t Offset)
const SmallVector< wasm::ValType, 4 > & getParams() const
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
void write32le(void *P, uint32_t V)
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
MCContext & getContext() const
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Export information to summary.
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
static void WritePatchableSLEB(raw_pwrite_stream &Stream, int32_t X, uint64_t Offset)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Encapsulates the layout of an assembly file at a particular point in time.
int64_t decodeSLEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a SLEB128 value.
Base class for the full range of assembler expressions which are needed for parsing.
Represent a reference to a symbol from inside an expression.
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
const uint32_t WasmVersion
LLVM_NODISCARD bool empty() const
Context object for machine code objects.
static bool isEqual(const Function &Caller, const Function &Callee)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
uint32_t getOffset() const
size_t size() const
size - Get the array size.
bool hasInstructions() const
Does this fragment have instructions emitted into it? By default this is false, but specific fragment...
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Import information from summary.
void writeSectionData(const MCSection *Section, const MCAsmLayout &Layout) const
Emit the section contents using the given object writer.
The instances of the Type class are immutable: once they are created, they are never changed...
This represents a section on wasm.
static bool is64Bit(const char *name)
FragmentType getKind() const
virtual void reset()
lifetime management
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
void pwrite(const char *Ptr, size_t Size, uint64_t Offset)
static unsigned PaddingFor5ByteSLEB128(int32_t X)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
void reportError(SMLoc L, const Twine &Msg)
MCFixupKind getKind() const
const MCSymbolRefExpr * getSymB() const
static uint32_t ProvisionalValue(const WasmRelocationEntry &RelEntry)
PowerPC TLS Dynamic Call Fixup
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
const MCSymbolRefExpr * getSymA() const
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
MCSection * getParent() const
bool isDefined(bool SetUsed=true) const
isDefined - Check if this symbol is defined (i.e., it has an address).
const SmallVector< wasm::ValType, 1 > & getReturns() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target - Wrapper for Target specific information.
const MCExpr * getVariableValue(bool SetUsed=true) const
getVariableValue - Get the value for variable symbols.
iterator insert(iterator I, T &&Elt)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
static std::vector< std::string > Flags
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
pointer data()
Return a pointer to the vector's buffer, even if empty().
MCAsmBackend & getBackend() const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
unsigned getSLEB128Size(int64_t Value)
Utility function to get the size of the SLEB128-encoded value.
void encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a SLEB128 value to an output stream.
bool isVariable() const
isVariable - Check if this is a variable symbol.
An abstract base class for streams implementations that also support a pwrite operation.
static void WritePatchableLEB(raw_pwrite_stream &Stream, uint32_t X, uint64_t Offset)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
int64_t getConstant() const
bool operator<(int64_t V1, const APSInt &V2)
LLVM Value Representation.
Generic interface to target specific assembler backends.
This class implements an extremely fast bulk output stream that can only output to a stream...
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output stream.
uint64_t getSectionFileSize(const MCSection *Sec) const
Get the data size of the given section, as emitted to the object file.
const uint32_t WasmPageSize
StringRef - Represent a constant reference to a string, i.e.
bool operator==(uint64_t V1, const APInt &V2)
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
MCSection::FragmentListType & getFragmentList()