mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex}
This commit is contained in:
parent
c66b5fa601
commit
13339a0dea
@ -190,7 +190,7 @@ public:
|
|||||||
uint64_t getValue() const { return Integer; }
|
uint64_t getValue() const { return Integer; }
|
||||||
void setValue(uint64_t Val) { Integer = Val; }
|
void setValue(uint64_t Val) { Integer = Val; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -207,7 +207,7 @@ public:
|
|||||||
/// Get MCExpr.
|
/// Get MCExpr.
|
||||||
const MCExpr *getValue() const { return Expr; }
|
const MCExpr *getValue() const { return Expr; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -224,7 +224,7 @@ public:
|
|||||||
/// Get MCSymbol.
|
/// Get MCSymbol.
|
||||||
const MCSymbol *getValue() const { return Label; }
|
const MCSymbol *getValue() const { return Label; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -242,7 +242,7 @@ public:
|
|||||||
: CU(TheCU), Index(Idx) {}
|
: CU(TheCU), Index(Idx) {}
|
||||||
|
|
||||||
/// EmitValue - Emit base type reference.
|
/// EmitValue - Emit base type reference.
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
/// SizeOf - Determine size of the base type reference in bytes.
|
/// SizeOf - Determine size of the base type reference in bytes.
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ class DIEDelta {
|
|||||||
public:
|
public:
|
||||||
DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo) : LabelHi(Hi), LabelLo(Lo) {}
|
DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo) : LabelHi(Hi), LabelLo(Lo) {}
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -278,7 +278,7 @@ public:
|
|||||||
/// Grab the string out of the object.
|
/// Grab the string out of the object.
|
||||||
StringRef getString() const { return S.getString(); }
|
StringRef getString() const { return S.getString(); }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -300,7 +300,7 @@ public:
|
|||||||
/// Grab the string out of the object.
|
/// Grab the string out of the object.
|
||||||
StringRef getString() const { return S; }
|
StringRef getString() const { return S; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -319,7 +319,7 @@ public:
|
|||||||
|
|
||||||
DIE &getEntry() const { return *Entry; }
|
DIE &getEntry() const { return *Entry; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -338,7 +338,7 @@ public:
|
|||||||
/// Grab the current index out.
|
/// Grab the current index out.
|
||||||
size_t getValue() const { return Index; }
|
size_t getValue() const { return Index; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -485,7 +485,7 @@ public:
|
|||||||
#include "llvm/CodeGen/DIEValue.def"
|
#include "llvm/CodeGen/DIEValue.def"
|
||||||
|
|
||||||
/// Emit value via the Dwarf writer.
|
/// Emit value via the Dwarf writer.
|
||||||
void EmitValue(const AsmPrinter *AP) const;
|
void emitValue(const AsmPrinter *AP) const;
|
||||||
|
|
||||||
/// Return the size of a value in bytes.
|
/// Return the size of a value in bytes.
|
||||||
unsigned SizeOf(const AsmPrinter *AP) const;
|
unsigned SizeOf(const AsmPrinter *AP) const;
|
||||||
@ -928,7 +928,7 @@ public:
|
|||||||
return dwarf::DW_FORM_block;
|
return dwarf::DW_FORM_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
@ -962,7 +962,7 @@ public:
|
|||||||
return dwarf::DW_FORM_block;
|
return dwarf::DW_FORM_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
|
void emitValue(const AsmPrinter *Asm, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
|
||||||
void print(raw_ostream &O) const;
|
void print(raw_ostream &O) const;
|
||||||
|
@ -30,7 +30,7 @@ namespace codeview {
|
|||||||
class CodeViewRecordStreamer {
|
class CodeViewRecordStreamer {
|
||||||
public:
|
public:
|
||||||
virtual void emitBytes(StringRef Data) = 0;
|
virtual void emitBytes(StringRef Data) = 0;
|
||||||
virtual void EmitIntValue(uint64_t Value, unsigned Size) = 0;
|
virtual void emitIntValue(uint64_t Value, unsigned Size) = 0;
|
||||||
virtual void emitBinaryData(StringRef Data) = 0;
|
virtual void emitBinaryData(StringRef Data) = 0;
|
||||||
virtual void AddComment(const Twine &T) = 0;
|
virtual void AddComment(const Twine &T) = 0;
|
||||||
virtual void AddRawComment(const Twine &T) = 0;
|
virtual void AddRawComment(const Twine &T) = 0;
|
||||||
@ -99,7 +99,7 @@ public:
|
|||||||
template <typename T> Error mapInteger(T &Value, const Twine &Comment = "") {
|
template <typename T> Error mapInteger(T &Value, const Twine &Comment = "") {
|
||||||
if (isStreaming()) {
|
if (isStreaming()) {
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue((int)Value, sizeof(T));
|
Streamer->emitIntValue((int)Value, sizeof(T));
|
||||||
incrStreamedLen(sizeof(T));
|
incrStreamedLen(sizeof(T));
|
||||||
return Error::success();
|
return Error::success();
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public:
|
|||||||
if (isStreaming()) {
|
if (isStreaming()) {
|
||||||
Size = static_cast<SizeType>(Items.size());
|
Size = static_cast<SizeType>(Items.size());
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Size, sizeof(Size));
|
Streamer->emitIntValue(Size, sizeof(Size));
|
||||||
incrStreamedLen(sizeof(Size)); // add 1 for the delimiter
|
incrStreamedLen(sizeof(Size)); // add 1 for the delimiter
|
||||||
|
|
||||||
for (auto &X : Items) {
|
for (auto &X : Items) {
|
||||||
|
@ -650,24 +650,24 @@ public:
|
|||||||
virtual void emitValueImpl(const MCExpr *Value, unsigned Size,
|
virtual void emitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
SMLoc Loc = SMLoc());
|
SMLoc Loc = SMLoc());
|
||||||
|
|
||||||
void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc = SMLoc());
|
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc = SMLoc());
|
||||||
|
|
||||||
/// Special case of EmitValue that avoids the client having
|
/// Special case of EmitValue that avoids the client having
|
||||||
/// to pass in a MCExpr for constant integers.
|
/// to pass in a MCExpr for constant integers.
|
||||||
virtual void EmitIntValue(uint64_t Value, unsigned Size);
|
virtual void emitIntValue(uint64_t Value, unsigned Size);
|
||||||
|
|
||||||
/// Special case of EmitValue that avoids the client having to pass
|
/// Special case of EmitValue that avoids the client having to pass
|
||||||
/// in a MCExpr for constant integers & prints in Hex format for certain
|
/// in a MCExpr for constant integers & prints in Hex format for certain
|
||||||
/// modes.
|
/// modes.
|
||||||
virtual void EmitIntValueInHex(uint64_t Value, unsigned Size) {
|
virtual void emitIntValueInHex(uint64_t Value, unsigned Size) {
|
||||||
EmitIntValue(Value, Size);
|
emitIntValue(Value, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Special case of EmitValue that avoids the client having to pass
|
/// Special case of EmitValue that avoids the client having to pass
|
||||||
/// in a MCExpr for constant integers & prints in Hex format for certain
|
/// in a MCExpr for constant integers & prints in Hex format for certain
|
||||||
/// modes, pads the field with leading zeros to Size width
|
/// modes, pads the field with leading zeros to Size width
|
||||||
virtual void EmitIntValueInHexWithPadding(uint64_t Value, unsigned Size) {
|
virtual void emitIntValueInHexWithPadding(uint64_t Value, unsigned Size) {
|
||||||
EmitIntValue(Value, Size);
|
emitIntValue(Value, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void emitULEB128Value(const MCExpr *Value);
|
virtual void emitULEB128Value(const MCExpr *Value);
|
||||||
|
@ -484,7 +484,7 @@ void Dwarf5AccelTableWriter<DataT>::emitEntry(const DataT &Entry) const {
|
|||||||
switch (AttrEnc.Index) {
|
switch (AttrEnc.Index) {
|
||||||
case dwarf::DW_IDX_compile_unit: {
|
case dwarf::DW_IDX_compile_unit: {
|
||||||
DIEInteger ID(getCUIndexForEntry(Entry));
|
DIEInteger ID(getCUIndexForEntry(Entry));
|
||||||
ID.EmitValue(Asm, AttrEnc.Form);
|
ID.emitValue(Asm, AttrEnc.Form);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case dwarf::DW_IDX_die_offset:
|
case dwarf::DW_IDX_die_offset:
|
||||||
|
@ -70,7 +70,7 @@ void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
|
|||||||
: MCSymbolRefExpr::create(I.first, Asm.OutContext);
|
: MCSymbolRefExpr::create(I.first, Asm.OutContext);
|
||||||
|
|
||||||
for (const MCExpr *Entry : Entries)
|
for (const MCExpr *Entry : Entries)
|
||||||
Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
|
Asm.OutStreamer->emitValue(Entry, Asm.getDataLayout().getPointerSize());
|
||||||
|
|
||||||
if (EndLabel)
|
if (EndLabel)
|
||||||
Asm.OutStreamer->emitLabel(EndLabel);
|
Asm.OutStreamer->emitLabel(EndLabel);
|
||||||
|
@ -631,7 +631,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
unsigned PtrSize = DL.getPointerTypeSize(GV->getType());
|
unsigned PtrSize = DL.getPointerTypeSize(GV->getType());
|
||||||
OutStreamer->emitSymbolValue(GetExternalSymbolSymbol("_tlv_bootstrap"),
|
OutStreamer->emitSymbolValue(GetExternalSymbolSymbol("_tlv_bootstrap"),
|
||||||
PtrSize);
|
PtrSize);
|
||||||
OutStreamer->EmitIntValue(0, PtrSize);
|
OutStreamer->emitIntValue(0, PtrSize);
|
||||||
OutStreamer->emitSymbolValue(MangSym, PtrSize);
|
OutStreamer->emitSymbolValue(MangSym, PtrSize);
|
||||||
|
|
||||||
OutStreamer->AddBlankLine();
|
OutStreamer->AddBlankLine();
|
||||||
@ -665,7 +665,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
/// \p Value - The value to emit.
|
/// \p Value - The value to emit.
|
||||||
/// \p Size - The size of the integer (in bytes) to emit.
|
/// \p Size - The size of the integer (in bytes) to emit.
|
||||||
void AsmPrinter::emitDebugValue(const MCExpr *Value, unsigned Size) const {
|
void AsmPrinter::emitDebugValue(const MCExpr *Value, unsigned Size) const {
|
||||||
OutStreamer->EmitValue(Value, Size);
|
OutStreamer->emitValue(Value, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitFunctionHeader - This method emits the header for the current
|
/// EmitFunctionHeader - This method emits the header for the current
|
||||||
@ -1675,7 +1675,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
"", ++UniqueID, nullptr));
|
"", ++UniqueID, nullptr));
|
||||||
OutStreamer->emitBytes(GV.getPartition());
|
OutStreamer->emitBytes(GV.getPartition());
|
||||||
OutStreamer->EmitZeros(1);
|
OutStreamer->EmitZeros(1);
|
||||||
OutStreamer->EmitValue(
|
OutStreamer->emitValue(
|
||||||
MCSymbolRefExpr::create(getSymbol(&GV), OutContext),
|
MCSymbolRefExpr::create(getSymbol(&GV), OutContext),
|
||||||
MAI->getCodePointerSize());
|
MAI->getCodePointerSize());
|
||||||
}
|
}
|
||||||
@ -1990,7 +1990,7 @@ void AsmPrinter::emitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
|||||||
assert(Value && "Unknown entry kind!");
|
assert(Value && "Unknown entry kind!");
|
||||||
|
|
||||||
unsigned EntrySize = MJTI->getEntrySize(getDataLayout());
|
unsigned EntrySize = MJTI->getEntrySize(getDataLayout());
|
||||||
OutStreamer->EmitValue(Value, EntrySize);
|
OutStreamer->emitValue(Value, EntrySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitSpecialLLVMGlobal - Check to see if the specified global is a
|
/// EmitSpecialLLVMGlobal - Check to see if the specified global is a
|
||||||
@ -2163,22 +2163,22 @@ void AsmPrinter::emitModuleCommandLines(Module &M) {
|
|||||||
/// Emit a byte directive and value.
|
/// Emit a byte directive and value.
|
||||||
///
|
///
|
||||||
void AsmPrinter::emitInt8(int Value) const {
|
void AsmPrinter::emitInt8(int Value) const {
|
||||||
OutStreamer->EmitIntValue(Value, 1);
|
OutStreamer->emitIntValue(Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit a short directive and value.
|
/// Emit a short directive and value.
|
||||||
void AsmPrinter::emitInt16(int Value) const {
|
void AsmPrinter::emitInt16(int Value) const {
|
||||||
OutStreamer->EmitIntValue(Value, 2);
|
OutStreamer->emitIntValue(Value, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit a long directive and value.
|
/// Emit a long directive and value.
|
||||||
void AsmPrinter::emitInt32(int Value) const {
|
void AsmPrinter::emitInt32(int Value) const {
|
||||||
OutStreamer->EmitIntValue(Value, 4);
|
OutStreamer->emitIntValue(Value, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit a long long directive and value.
|
/// Emit a long long directive and value.
|
||||||
void AsmPrinter::emitInt64(uint64_t Value) const {
|
void AsmPrinter::emitInt64(uint64_t Value) const {
|
||||||
OutStreamer->EmitIntValue(Value, 8);
|
OutStreamer->emitIntValue(Value, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit something like ".long Hi-Lo" where the size in bytes of the directive
|
/// Emit something like ".long Hi-Lo" where the size in bytes of the directive
|
||||||
@ -2208,7 +2208,7 @@ void AsmPrinter::emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
|||||||
Expr = MCBinaryExpr::createAdd(
|
Expr = MCBinaryExpr::createAdd(
|
||||||
Expr, MCConstantExpr::create(Offset, OutContext), OutContext);
|
Expr, MCConstantExpr::create(Offset, OutContext), OutContext);
|
||||||
|
|
||||||
OutStreamer->EmitValue(Expr, Size);
|
OutStreamer->emitValue(Expr, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -2466,7 +2466,7 @@ static void emitGlobalConstantDataSequential(const DataLayout &DL,
|
|||||||
if (AP.isVerbose())
|
if (AP.isVerbose())
|
||||||
AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
|
AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
|
||||||
CDS->getElementAsInteger(i));
|
CDS->getElementAsInteger(i));
|
||||||
AP.OutStreamer->EmitIntValue(CDS->getElementAsInteger(i),
|
AP.OutStreamer->emitIntValue(CDS->getElementAsInteger(i),
|
||||||
ElementByteSize);
|
ElementByteSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2568,17 +2568,17 @@ static void emitGlobalConstantFP(APFloat APF, Type *ET, AsmPrinter &AP) {
|
|||||||
int Chunk = API.getNumWords() - 1;
|
int Chunk = API.getNumWords() - 1;
|
||||||
|
|
||||||
if (TrailingBytes)
|
if (TrailingBytes)
|
||||||
AP.OutStreamer->EmitIntValueInHexWithPadding(p[Chunk--], TrailingBytes);
|
AP.OutStreamer->emitIntValueInHexWithPadding(p[Chunk--], TrailingBytes);
|
||||||
|
|
||||||
for (; Chunk >= 0; --Chunk)
|
for (; Chunk >= 0; --Chunk)
|
||||||
AP.OutStreamer->EmitIntValueInHexWithPadding(p[Chunk], sizeof(uint64_t));
|
AP.OutStreamer->emitIntValueInHexWithPadding(p[Chunk], sizeof(uint64_t));
|
||||||
} else {
|
} else {
|
||||||
unsigned Chunk;
|
unsigned Chunk;
|
||||||
for (Chunk = 0; Chunk < NumBytes / sizeof(uint64_t); ++Chunk)
|
for (Chunk = 0; Chunk < NumBytes / sizeof(uint64_t); ++Chunk)
|
||||||
AP.OutStreamer->EmitIntValueInHexWithPadding(p[Chunk], sizeof(uint64_t));
|
AP.OutStreamer->emitIntValueInHexWithPadding(p[Chunk], sizeof(uint64_t));
|
||||||
|
|
||||||
if (TrailingBytes)
|
if (TrailingBytes)
|
||||||
AP.OutStreamer->EmitIntValueInHexWithPadding(p[Chunk], TrailingBytes);
|
AP.OutStreamer->emitIntValueInHexWithPadding(p[Chunk], TrailingBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the tail padding for the long double.
|
// Emit the tail padding for the long double.
|
||||||
@ -2630,7 +2630,7 @@ static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP) {
|
|||||||
const uint64_t *RawData = Realigned.getRawData();
|
const uint64_t *RawData = Realigned.getRawData();
|
||||||
for (unsigned i = 0, e = BitWidth / 64; i != e; ++i) {
|
for (unsigned i = 0, e = BitWidth / 64; i != e; ++i) {
|
||||||
uint64_t Val = DL.isBigEndian() ? RawData[e - i - 1] : RawData[i];
|
uint64_t Val = DL.isBigEndian() ? RawData[e - i - 1] : RawData[i];
|
||||||
AP.OutStreamer->EmitIntValue(Val, 8);
|
AP.OutStreamer->emitIntValue(Val, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExtraBitsSize) {
|
if (ExtraBitsSize) {
|
||||||
@ -2642,7 +2642,7 @@ static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP) {
|
|||||||
assert(Size && Size * 8 >= ExtraBitsSize &&
|
assert(Size && Size * 8 >= ExtraBitsSize &&
|
||||||
(ExtraBits & (((uint64_t)-1) >> (64 - ExtraBitsSize)))
|
(ExtraBits & (((uint64_t)-1) >> (64 - ExtraBitsSize)))
|
||||||
== ExtraBits && "Directive too small for extra bits.");
|
== ExtraBits && "Directive too small for extra bits.");
|
||||||
AP.OutStreamer->EmitIntValue(ExtraBits, Size);
|
AP.OutStreamer->emitIntValue(ExtraBits, Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2760,7 +2760,7 @@ static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *CV,
|
|||||||
if (AP.isVerbose())
|
if (AP.isVerbose())
|
||||||
AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
|
AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
|
||||||
CI->getZExtValue());
|
CI->getZExtValue());
|
||||||
AP.OutStreamer->EmitIntValue(CI->getZExtValue(), Size);
|
AP.OutStreamer->emitIntValue(CI->getZExtValue(), Size);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
emitGlobalConstantLargeInt(CI, AP);
|
emitGlobalConstantLargeInt(CI, AP);
|
||||||
@ -2772,7 +2772,7 @@ static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *CV,
|
|||||||
return emitGlobalConstantFP(CFP, AP);
|
return emitGlobalConstantFP(CFP, AP);
|
||||||
|
|
||||||
if (isa<ConstantPointerNull>(CV)) {
|
if (isa<ConstantPointerNull>(CV)) {
|
||||||
AP.OutStreamer->EmitIntValue(0, Size);
|
AP.OutStreamer->emitIntValue(0, Size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2814,7 +2814,7 @@ static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *CV,
|
|||||||
if (AP.getObjFileLowering().supportIndirectSymViaGOTPCRel())
|
if (AP.getObjFileLowering().supportIndirectSymViaGOTPCRel())
|
||||||
handleIndirectSymViaGOTPCRel(AP, &ME, BaseCV, Offset);
|
handleIndirectSymViaGOTPCRel(AP, &ME, BaseCV, Offset);
|
||||||
|
|
||||||
AP.OutStreamer->EmitValue(ME, Size);
|
AP.OutStreamer->emitValue(ME, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
|
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
|
||||||
@ -2825,7 +2825,7 @@ void AsmPrinter::emitGlobalConstant(const DataLayout &DL, const Constant *CV) {
|
|||||||
else if (MAI->hasSubsectionsViaSymbols()) {
|
else if (MAI->hasSubsectionsViaSymbols()) {
|
||||||
// If the global has zero size, emit a single byte so that two labels don't
|
// If the global has zero size, emit a single byte so that two labels don't
|
||||||
// look like they are at the same location.
|
// look like they are at the same location.
|
||||||
OutStreamer->EmitIntValue(0, 1);
|
OutStreamer->emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void AsmPrinter::emitEncodingByte(unsigned Val, const char *Desc) const {
|
|||||||
OutStreamer->AddComment(Twine("Encoding = ") + DecodeDWARFEncoding(Val));
|
OutStreamer->AddComment(Twine("Encoding = ") + DecodeDWARFEncoding(Val));
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStreamer->EmitIntValue(Val, 1);
|
OutStreamer->emitIntValue(Val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
|
/// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
|
||||||
@ -144,9 +144,9 @@ void AsmPrinter::emitTTypeReference(const GlobalValue *GV,
|
|||||||
|
|
||||||
const MCExpr *Exp =
|
const MCExpr *Exp =
|
||||||
TLOF.getTTypeGlobalReference(GV, Encoding, TM, MMI, *OutStreamer);
|
TLOF.getTTypeGlobalReference(GV, Encoding, TM, MMI, *OutStreamer);
|
||||||
OutStreamer->EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
|
OutStreamer->emitValue(Exp, GetSizeOfEncodedValue(Encoding));
|
||||||
} else
|
} else
|
||||||
OutStreamer->EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
|
OutStreamer->emitIntValue(0, GetSizeOfEncodedValue(Encoding));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::emitDwarfSymbolReference(const MCSymbol *Label,
|
void AsmPrinter::emitDwarfSymbolReference(const MCSymbol *Label,
|
||||||
@ -198,7 +198,7 @@ void AsmPrinter::emitCallSiteValue(uint64_t Value, unsigned Encoding) const {
|
|||||||
if ((Encoding & 0x7) == dwarf::DW_EH_PE_uleb128)
|
if ((Encoding & 0x7) == dwarf::DW_EH_PE_uleb128)
|
||||||
emitULEB128(Value);
|
emitULEB128(Value);
|
||||||
else
|
else
|
||||||
OutStreamer->EmitIntValue(Value, GetSizeOfEncodedValue(Encoding));
|
OutStreamer->emitIntValue(Value, GetSizeOfEncodedValue(Encoding));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -270,7 +270,7 @@ void AsmPrinter::emitDwarfDIE(const DIE &Die) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit an attribute using the defined form.
|
// Emit an attribute using the defined form.
|
||||||
V.EmitValue(this);
|
V.emitValue(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the DIE children if any.
|
// Emit the DIE children if any.
|
||||||
|
@ -103,8 +103,8 @@ public:
|
|||||||
|
|
||||||
void emitBytes(StringRef Data) { OS->emitBytes(Data); }
|
void emitBytes(StringRef Data) { OS->emitBytes(Data); }
|
||||||
|
|
||||||
void EmitIntValue(uint64_t Value, unsigned Size) {
|
void emitIntValue(uint64_t Value, unsigned Size) {
|
||||||
OS->EmitIntValueInHex(Value, Size);
|
OS->emitIntValueInHex(Value, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitBinaryData(StringRef Data) { OS->emitBinaryData(Data); }
|
void emitBinaryData(StringRef Data) { OS->emitBinaryData(Data); }
|
||||||
@ -551,7 +551,7 @@ void CodeViewDebug::maybeRecordLocation(const DebugLoc &DL,
|
|||||||
void CodeViewDebug::emitCodeViewMagicVersion() {
|
void CodeViewDebug::emitCodeViewMagicVersion() {
|
||||||
OS.emitValueToAlignment(4);
|
OS.emitValueToAlignment(4);
|
||||||
OS.AddComment("Debug section magic");
|
OS.AddComment("Debug section magic");
|
||||||
OS.EmitIntValue(COFF::DEBUG_SECTION_MAGIC, 4);
|
OS.emitIntValue(COFF::DEBUG_SECTION_MAGIC, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeViewDebug::endModule() {
|
void CodeViewDebug::endModule() {
|
||||||
@ -676,11 +676,11 @@ void CodeViewDebug::emitTypeGlobalHashes() {
|
|||||||
|
|
||||||
OS.emitValueToAlignment(4);
|
OS.emitValueToAlignment(4);
|
||||||
OS.AddComment("Magic");
|
OS.AddComment("Magic");
|
||||||
OS.EmitIntValue(COFF::DEBUG_HASHES_SECTION_MAGIC, 4);
|
OS.emitIntValue(COFF::DEBUG_HASHES_SECTION_MAGIC, 4);
|
||||||
OS.AddComment("Section Version");
|
OS.AddComment("Section Version");
|
||||||
OS.EmitIntValue(0, 2);
|
OS.emitIntValue(0, 2);
|
||||||
OS.AddComment("Hash Algorithm");
|
OS.AddComment("Hash Algorithm");
|
||||||
OS.EmitIntValue(uint16_t(GlobalTypeHashAlg::SHA1_8), 2);
|
OS.emitIntValue(uint16_t(GlobalTypeHashAlg::SHA1_8), 2);
|
||||||
|
|
||||||
TypeIndex TI(TypeIndex::FirstNonSimpleIndex);
|
TypeIndex TI(TypeIndex::FirstNonSimpleIndex);
|
||||||
for (const auto &GHR : TypeTable.hashes()) {
|
for (const auto &GHR : TypeTable.hashes()) {
|
||||||
@ -775,16 +775,16 @@ void CodeViewDebug::emitCompilerInformation() {
|
|||||||
// TODO: Figure out which other flags need to be set.
|
// TODO: Figure out which other flags need to be set.
|
||||||
|
|
||||||
OS.AddComment("Flags and language");
|
OS.AddComment("Flags and language");
|
||||||
OS.EmitIntValue(Flags, 4);
|
OS.emitIntValue(Flags, 4);
|
||||||
|
|
||||||
OS.AddComment("CPUType");
|
OS.AddComment("CPUType");
|
||||||
OS.EmitIntValue(static_cast<uint64_t>(TheCPU), 2);
|
OS.emitIntValue(static_cast<uint64_t>(TheCPU), 2);
|
||||||
|
|
||||||
StringRef CompilerVersion = CU->getProducer();
|
StringRef CompilerVersion = CU->getProducer();
|
||||||
Version FrontVer = parseVersion(CompilerVersion);
|
Version FrontVer = parseVersion(CompilerVersion);
|
||||||
OS.AddComment("Frontend version");
|
OS.AddComment("Frontend version");
|
||||||
for (int N = 0; N < 4; ++N)
|
for (int N = 0; N < 4; ++N)
|
||||||
OS.EmitIntValue(FrontVer.Part[N], 2);
|
OS.emitIntValue(FrontVer.Part[N], 2);
|
||||||
|
|
||||||
// Some Microsoft tools, like Binscope, expect a backend version number of at
|
// Some Microsoft tools, like Binscope, expect a backend version number of at
|
||||||
// least 8.something, so we'll coerce the LLVM version into a form that
|
// least 8.something, so we'll coerce the LLVM version into a form that
|
||||||
@ -797,7 +797,7 @@ void CodeViewDebug::emitCompilerInformation() {
|
|||||||
Version BackVer = {{ Major, 0, 0, 0 }};
|
Version BackVer = {{ Major, 0, 0, 0 }};
|
||||||
OS.AddComment("Backend version");
|
OS.AddComment("Backend version");
|
||||||
for (int N = 0; N < 4; ++N)
|
for (int N = 0; N < 4; ++N)
|
||||||
OS.EmitIntValue(BackVer.Part[N], 2);
|
OS.emitIntValue(BackVer.Part[N], 2);
|
||||||
|
|
||||||
OS.AddComment("Null-terminated compiler version string");
|
OS.AddComment("Null-terminated compiler version string");
|
||||||
emitNullTerminatedSymbolName(OS, CompilerVersion);
|
emitNullTerminatedSymbolName(OS, CompilerVersion);
|
||||||
@ -841,7 +841,7 @@ void CodeViewDebug::emitBuildInfo() {
|
|||||||
MCSymbol *BISubsecEnd = beginCVSubsection(DebugSubsectionKind::Symbols);
|
MCSymbol *BISubsecEnd = beginCVSubsection(DebugSubsectionKind::Symbols);
|
||||||
MCSymbol *BIEnd = beginSymbolRecord(SymbolKind::S_BUILDINFO);
|
MCSymbol *BIEnd = beginSymbolRecord(SymbolKind::S_BUILDINFO);
|
||||||
OS.AddComment("LF_BUILDINFO index");
|
OS.AddComment("LF_BUILDINFO index");
|
||||||
OS.EmitIntValue(BuildInfoIndex.getIndex(), 4);
|
OS.emitIntValue(BuildInfoIndex.getIndex(), 4);
|
||||||
endSymbolRecord(BIEnd);
|
endSymbolRecord(BIEnd);
|
||||||
endCVSubsection(BISubsecEnd);
|
endCVSubsection(BISubsecEnd);
|
||||||
}
|
}
|
||||||
@ -858,7 +858,7 @@ void CodeViewDebug::emitInlineeLinesSubsection() {
|
|||||||
// for instance, will display a warning that the breakpoints are not valid if
|
// for instance, will display a warning that the breakpoints are not valid if
|
||||||
// the pdb does not match the source.
|
// the pdb does not match the source.
|
||||||
OS.AddComment("Inlinee lines signature");
|
OS.AddComment("Inlinee lines signature");
|
||||||
OS.EmitIntValue(unsigned(InlineeLinesSignature::Normal), 4);
|
OS.emitIntValue(unsigned(InlineeLinesSignature::Normal), 4);
|
||||||
|
|
||||||
for (const DISubprogram *SP : InlinedSubprograms) {
|
for (const DISubprogram *SP : InlinedSubprograms) {
|
||||||
assert(TypeIndices.count({SP, nullptr}));
|
assert(TypeIndices.count({SP, nullptr}));
|
||||||
@ -870,11 +870,11 @@ void CodeViewDebug::emitInlineeLinesSubsection() {
|
|||||||
SP->getFilename() + Twine(':') + Twine(SP->getLine()));
|
SP->getFilename() + Twine(':') + Twine(SP->getLine()));
|
||||||
OS.AddBlankLine();
|
OS.AddBlankLine();
|
||||||
OS.AddComment("Type index of inlined function");
|
OS.AddComment("Type index of inlined function");
|
||||||
OS.EmitIntValue(InlineeIdx.getIndex(), 4);
|
OS.emitIntValue(InlineeIdx.getIndex(), 4);
|
||||||
OS.AddComment("Offset into filechecksum table");
|
OS.AddComment("Offset into filechecksum table");
|
||||||
OS.EmitCVFileChecksumOffsetDirective(FileId);
|
OS.EmitCVFileChecksumOffsetDirective(FileId);
|
||||||
OS.AddComment("Starting line number");
|
OS.AddComment("Starting line number");
|
||||||
OS.EmitIntValue(SP->getLine(), 4);
|
OS.emitIntValue(SP->getLine(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
endCVSubsection(InlineEnd);
|
endCVSubsection(InlineEnd);
|
||||||
@ -890,11 +890,11 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI,
|
|||||||
MCSymbol *InlineEnd = beginSymbolRecord(SymbolKind::S_INLINESITE);
|
MCSymbol *InlineEnd = beginSymbolRecord(SymbolKind::S_INLINESITE);
|
||||||
|
|
||||||
OS.AddComment("PtrParent");
|
OS.AddComment("PtrParent");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("PtrEnd");
|
OS.AddComment("PtrEnd");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Inlinee type index");
|
OS.AddComment("Inlinee type index");
|
||||||
OS.EmitIntValue(InlineeIdx.getIndex(), 4);
|
OS.emitIntValue(InlineeIdx.getIndex(), 4);
|
||||||
|
|
||||||
unsigned FileId = maybeRecordFile(Site.Inlinee->getFile());
|
unsigned FileId = maybeRecordFile(Site.Inlinee->getFile());
|
||||||
unsigned StartLineNum = Site.Inlinee->getLine();
|
unsigned StartLineNum = Site.Inlinee->getLine();
|
||||||
@ -953,11 +953,11 @@ void CodeViewDebug::emitDebugInfoForThunk(const Function *GV,
|
|||||||
// Emit S_THUNK32
|
// Emit S_THUNK32
|
||||||
MCSymbol *ThunkRecordEnd = beginSymbolRecord(SymbolKind::S_THUNK32);
|
MCSymbol *ThunkRecordEnd = beginSymbolRecord(SymbolKind::S_THUNK32);
|
||||||
OS.AddComment("PtrParent");
|
OS.AddComment("PtrParent");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("PtrEnd");
|
OS.AddComment("PtrEnd");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("PtrNext");
|
OS.AddComment("PtrNext");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Thunk section relative address");
|
OS.AddComment("Thunk section relative address");
|
||||||
OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
|
OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
|
||||||
OS.AddComment("Thunk section index");
|
OS.AddComment("Thunk section index");
|
||||||
@ -965,7 +965,7 @@ void CodeViewDebug::emitDebugInfoForThunk(const Function *GV,
|
|||||||
OS.AddComment("Code size");
|
OS.AddComment("Code size");
|
||||||
OS.emitAbsoluteSymbolDiff(FI.End, Fn, 2);
|
OS.emitAbsoluteSymbolDiff(FI.End, Fn, 2);
|
||||||
OS.AddComment("Ordinal");
|
OS.AddComment("Ordinal");
|
||||||
OS.EmitIntValue(unsigned(ordinal), 1);
|
OS.emitIntValue(unsigned(ordinal), 1);
|
||||||
OS.AddComment("Function name");
|
OS.AddComment("Function name");
|
||||||
emitNullTerminatedSymbolName(OS, FuncName);
|
emitNullTerminatedSymbolName(OS, FuncName);
|
||||||
// Additional fields specific to the thunk ordinal would go here.
|
// Additional fields specific to the thunk ordinal would go here.
|
||||||
@ -1023,27 +1023,27 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
|
|||||||
|
|
||||||
// These fields are filled in by tools like CVPACK which run after the fact.
|
// These fields are filled in by tools like CVPACK which run after the fact.
|
||||||
OS.AddComment("PtrParent");
|
OS.AddComment("PtrParent");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("PtrEnd");
|
OS.AddComment("PtrEnd");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("PtrNext");
|
OS.AddComment("PtrNext");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
// This is the important bit that tells the debugger where the function
|
// This is the important bit that tells the debugger where the function
|
||||||
// code is located and what's its size:
|
// code is located and what's its size:
|
||||||
OS.AddComment("Code size");
|
OS.AddComment("Code size");
|
||||||
OS.emitAbsoluteSymbolDiff(FI.End, Fn, 4);
|
OS.emitAbsoluteSymbolDiff(FI.End, Fn, 4);
|
||||||
OS.AddComment("Offset after prologue");
|
OS.AddComment("Offset after prologue");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Offset before epilogue");
|
OS.AddComment("Offset before epilogue");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Function type index");
|
OS.AddComment("Function type index");
|
||||||
OS.EmitIntValue(getFuncIdForSubprogram(GV->getSubprogram()).getIndex(), 4);
|
OS.emitIntValue(getFuncIdForSubprogram(GV->getSubprogram()).getIndex(), 4);
|
||||||
OS.AddComment("Function section relative address");
|
OS.AddComment("Function section relative address");
|
||||||
OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
|
OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
|
||||||
OS.AddComment("Function section index");
|
OS.AddComment("Function section index");
|
||||||
OS.EmitCOFFSectionIndex(Fn);
|
OS.EmitCOFFSectionIndex(Fn);
|
||||||
OS.AddComment("Flags");
|
OS.AddComment("Flags");
|
||||||
OS.EmitIntValue(0, 1);
|
OS.emitIntValue(0, 1);
|
||||||
// Emit the function display name as a null-terminated string.
|
// Emit the function display name as a null-terminated string.
|
||||||
OS.AddComment("Function name");
|
OS.AddComment("Function name");
|
||||||
// Truncate the name so we won't overflow the record length field.
|
// Truncate the name so we won't overflow the record length field.
|
||||||
@ -1053,19 +1053,19 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
|
|||||||
MCSymbol *FrameProcEnd = beginSymbolRecord(SymbolKind::S_FRAMEPROC);
|
MCSymbol *FrameProcEnd = beginSymbolRecord(SymbolKind::S_FRAMEPROC);
|
||||||
// Subtract out the CSR size since MSVC excludes that and we include it.
|
// Subtract out the CSR size since MSVC excludes that and we include it.
|
||||||
OS.AddComment("FrameSize");
|
OS.AddComment("FrameSize");
|
||||||
OS.EmitIntValue(FI.FrameSize - FI.CSRSize, 4);
|
OS.emitIntValue(FI.FrameSize - FI.CSRSize, 4);
|
||||||
OS.AddComment("Padding");
|
OS.AddComment("Padding");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Offset of padding");
|
OS.AddComment("Offset of padding");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Bytes of callee saved registers");
|
OS.AddComment("Bytes of callee saved registers");
|
||||||
OS.EmitIntValue(FI.CSRSize, 4);
|
OS.emitIntValue(FI.CSRSize, 4);
|
||||||
OS.AddComment("Exception handler offset");
|
OS.AddComment("Exception handler offset");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.AddComment("Exception handler section");
|
OS.AddComment("Exception handler section");
|
||||||
OS.EmitIntValue(0, 2);
|
OS.emitIntValue(0, 2);
|
||||||
OS.AddComment("Flags (defines frame register)");
|
OS.AddComment("Flags (defines frame register)");
|
||||||
OS.EmitIntValue(uint32_t(FI.FrameProcOpts), 4);
|
OS.emitIntValue(uint32_t(FI.FrameProcOpts), 4);
|
||||||
endSymbolRecord(FrameProcEnd);
|
endSymbolRecord(FrameProcEnd);
|
||||||
|
|
||||||
emitLocalVariableList(FI, FI.Locals);
|
emitLocalVariableList(FI, FI.Locals);
|
||||||
@ -1089,7 +1089,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
|
|||||||
OS.EmitCOFFSecRel32(Label, /*Offset=*/0);
|
OS.EmitCOFFSecRel32(Label, /*Offset=*/0);
|
||||||
// FIXME: Make sure we don't overflow the max record size.
|
// FIXME: Make sure we don't overflow the max record size.
|
||||||
OS.EmitCOFFSectionIndex(Label);
|
OS.EmitCOFFSectionIndex(Label);
|
||||||
OS.EmitIntValue(Strs->getNumOperands(), 2);
|
OS.emitIntValue(Strs->getNumOperands(), 2);
|
||||||
for (Metadata *MD : Strs->operands()) {
|
for (Metadata *MD : Strs->operands()) {
|
||||||
// MDStrings are null terminated, so we can do EmitBytes and get the
|
// MDStrings are null terminated, so we can do EmitBytes and get the
|
||||||
// nice .asciz directive.
|
// nice .asciz directive.
|
||||||
@ -1112,7 +1112,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
|
|||||||
OS.AddComment("Call instruction length");
|
OS.AddComment("Call instruction length");
|
||||||
OS.emitAbsoluteSymbolDiff(EndLabel, BeginLabel, 2);
|
OS.emitAbsoluteSymbolDiff(EndLabel, BeginLabel, 2);
|
||||||
OS.AddComment("Type index");
|
OS.AddComment("Type index");
|
||||||
OS.EmitIntValue(getCompleteTypeIndex(DITy).getIndex(), 4);
|
OS.emitIntValue(getCompleteTypeIndex(DITy).getIndex(), 4);
|
||||||
endSymbolRecord(HeapAllocEnd);
|
endSymbolRecord(HeapAllocEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2626,9 +2626,9 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI,
|
|||||||
TypeIndex TI = Var.UseReferenceType
|
TypeIndex TI = Var.UseReferenceType
|
||||||
? getTypeIndexForReferenceTo(Var.DIVar->getType())
|
? getTypeIndexForReferenceTo(Var.DIVar->getType())
|
||||||
: getCompleteTypeIndex(Var.DIVar->getType());
|
: getCompleteTypeIndex(Var.DIVar->getType());
|
||||||
OS.EmitIntValue(TI.getIndex(), 4);
|
OS.emitIntValue(TI.getIndex(), 4);
|
||||||
OS.AddComment("Flags");
|
OS.AddComment("Flags");
|
||||||
OS.EmitIntValue(static_cast<uint16_t>(Flags), 2);
|
OS.emitIntValue(static_cast<uint16_t>(Flags), 2);
|
||||||
// Truncate the name so we won't overflow the record length field.
|
// Truncate the name so we won't overflow the record length field.
|
||||||
emitNullTerminatedSymbolName(OS, Var.DIVar->getName());
|
emitNullTerminatedSymbolName(OS, Var.DIVar->getName());
|
||||||
endSymbolRecord(LocalEnd);
|
endSymbolRecord(LocalEnd);
|
||||||
@ -2705,9 +2705,9 @@ void CodeViewDebug::emitLexicalBlock(const LexicalBlock &Block,
|
|||||||
const FunctionInfo& FI) {
|
const FunctionInfo& FI) {
|
||||||
MCSymbol *RecordEnd = beginSymbolRecord(SymbolKind::S_BLOCK32);
|
MCSymbol *RecordEnd = beginSymbolRecord(SymbolKind::S_BLOCK32);
|
||||||
OS.AddComment("PtrParent");
|
OS.AddComment("PtrParent");
|
||||||
OS.EmitIntValue(0, 4); // PtrParent
|
OS.emitIntValue(0, 4); // PtrParent
|
||||||
OS.AddComment("PtrEnd");
|
OS.AddComment("PtrEnd");
|
||||||
OS.EmitIntValue(0, 4); // PtrEnd
|
OS.emitIntValue(0, 4); // PtrEnd
|
||||||
OS.AddComment("Code size");
|
OS.AddComment("Code size");
|
||||||
OS.emitAbsoluteSymbolDiff(Block.End, Block.Begin, 4); // Code Size
|
OS.emitAbsoluteSymbolDiff(Block.End, Block.Begin, 4); // Code Size
|
||||||
OS.AddComment("Function section relative address");
|
OS.AddComment("Function section relative address");
|
||||||
@ -2915,7 +2915,7 @@ void CodeViewDebug::beginInstruction(const MachineInstr *MI) {
|
|||||||
MCSymbol *CodeViewDebug::beginCVSubsection(DebugSubsectionKind Kind) {
|
MCSymbol *CodeViewDebug::beginCVSubsection(DebugSubsectionKind Kind) {
|
||||||
MCSymbol *BeginLabel = MMI->getContext().createTempSymbol(),
|
MCSymbol *BeginLabel = MMI->getContext().createTempSymbol(),
|
||||||
*EndLabel = MMI->getContext().createTempSymbol();
|
*EndLabel = MMI->getContext().createTempSymbol();
|
||||||
OS.EmitIntValue(unsigned(Kind), 4);
|
OS.emitIntValue(unsigned(Kind), 4);
|
||||||
OS.AddComment("Subsection size");
|
OS.AddComment("Subsection size");
|
||||||
OS.emitAbsoluteSymbolDiff(EndLabel, BeginLabel, 4);
|
OS.emitAbsoluteSymbolDiff(EndLabel, BeginLabel, 4);
|
||||||
OS.emitLabel(BeginLabel);
|
OS.emitLabel(BeginLabel);
|
||||||
@ -2943,7 +2943,7 @@ MCSymbol *CodeViewDebug::beginSymbolRecord(SymbolKind SymKind) {
|
|||||||
OS.emitLabel(BeginLabel);
|
OS.emitLabel(BeginLabel);
|
||||||
if (OS.isVerboseAsm())
|
if (OS.isVerboseAsm())
|
||||||
OS.AddComment("Record kind: " + getSymbolName(SymKind));
|
OS.AddComment("Record kind: " + getSymbolName(SymKind));
|
||||||
OS.EmitIntValue(unsigned(SymKind), 2);
|
OS.emitIntValue(unsigned(SymKind), 2);
|
||||||
return EndLabel;
|
return EndLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2958,10 +2958,10 @@ void CodeViewDebug::endSymbolRecord(MCSymbol *SymEnd) {
|
|||||||
|
|
||||||
void CodeViewDebug::emitEndSymbolRecord(SymbolKind EndKind) {
|
void CodeViewDebug::emitEndSymbolRecord(SymbolKind EndKind) {
|
||||||
OS.AddComment("Record length");
|
OS.AddComment("Record length");
|
||||||
OS.EmitIntValue(2, 2);
|
OS.emitIntValue(2, 2);
|
||||||
if (OS.isVerboseAsm())
|
if (OS.isVerboseAsm())
|
||||||
OS.AddComment("Record kind: " + getSymbolName(EndKind));
|
OS.AddComment("Record kind: " + getSymbolName(EndKind));
|
||||||
OS.EmitIntValue(unsigned(EndKind), 2); // Record Kind
|
OS.emitIntValue(unsigned(EndKind), 2); // Record Kind
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeViewDebug::emitDebugInfoForUDTs(
|
void CodeViewDebug::emitDebugInfoForUDTs(
|
||||||
@ -2972,7 +2972,7 @@ void CodeViewDebug::emitDebugInfoForUDTs(
|
|||||||
|
|
||||||
MCSymbol *UDTRecordEnd = beginSymbolRecord(SymbolKind::S_UDT);
|
MCSymbol *UDTRecordEnd = beginSymbolRecord(SymbolKind::S_UDT);
|
||||||
OS.AddComment("Type");
|
OS.AddComment("Type");
|
||||||
OS.EmitIntValue(getCompleteTypeIndex(T).getIndex(), 4);
|
OS.emitIntValue(getCompleteTypeIndex(T).getIndex(), 4);
|
||||||
emitNullTerminatedSymbolName(OS, UDT.first);
|
emitNullTerminatedSymbolName(OS, UDT.first);
|
||||||
endSymbolRecord(UDTRecordEnd);
|
endSymbolRecord(UDTRecordEnd);
|
||||||
}
|
}
|
||||||
@ -3088,7 +3088,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
|
|||||||
: SymbolKind::S_GDATA32);
|
: SymbolKind::S_GDATA32);
|
||||||
MCSymbol *DataEnd = beginSymbolRecord(DataSym);
|
MCSymbol *DataEnd = beginSymbolRecord(DataSym);
|
||||||
OS.AddComment("Type");
|
OS.AddComment("Type");
|
||||||
OS.EmitIntValue(getCompleteTypeIndex(DIGV->getType()).getIndex(), 4);
|
OS.emitIntValue(getCompleteTypeIndex(DIGV->getType()).getIndex(), 4);
|
||||||
OS.AddComment("DataOffset");
|
OS.AddComment("DataOffset");
|
||||||
OS.EmitCOFFSecRel32(GVSym, /*Offset=*/0);
|
OS.EmitCOFFSecRel32(GVSym, /*Offset=*/0);
|
||||||
OS.AddComment("Segment");
|
OS.AddComment("Segment");
|
||||||
@ -3107,7 +3107,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
|
|||||||
|
|
||||||
MCSymbol *SConstantEnd = beginSymbolRecord(SymbolKind::S_CONSTANT);
|
MCSymbol *SConstantEnd = beginSymbolRecord(SymbolKind::S_CONSTANT);
|
||||||
OS.AddComment("Type");
|
OS.AddComment("Type");
|
||||||
OS.EmitIntValue(getTypeIndex(DIGV->getType()).getIndex(), 4);
|
OS.emitIntValue(getTypeIndex(DIGV->getType()).getIndex(), 4);
|
||||||
OS.AddComment("Value");
|
OS.AddComment("Value");
|
||||||
|
|
||||||
// Encoded integers shouldn't need more than 10 bytes.
|
// Encoded integers shouldn't need more than 10 bytes.
|
||||||
|
@ -325,13 +325,13 @@ DIEUnit::DIEUnit(uint16_t V, uint8_t A, dwarf::Tag UnitTag)
|
|||||||
"expected a unit TAG");
|
"expected a unit TAG");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DIEValue::EmitValue(const AsmPrinter *AP) const {
|
void DIEValue::emitValue(const AsmPrinter *AP) const {
|
||||||
switch (Ty) {
|
switch (Ty) {
|
||||||
case isNone:
|
case isNone:
|
||||||
llvm_unreachable("Expected valid DIEValue");
|
llvm_unreachable("Expected valid DIEValue");
|
||||||
#define HANDLE_DIEVALUE(T) \
|
#define HANDLE_DIEVALUE(T) \
|
||||||
case is##T: \
|
case is##T: \
|
||||||
getDIE##T().EmitValue(AP, Form); \
|
getDIE##T().emitValue(AP, Form); \
|
||||||
break;
|
break;
|
||||||
#include "llvm/CodeGen/DIEValue.def"
|
#include "llvm/CodeGen/DIEValue.def"
|
||||||
}
|
}
|
||||||
@ -374,7 +374,7 @@ LLVM_DUMP_METHOD void DIEValue::dump() const {
|
|||||||
|
|
||||||
/// EmitValue - Emit integer of appropriate size.
|
/// EmitValue - Emit integer of appropriate size.
|
||||||
///
|
///
|
||||||
void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
void DIEInteger::emitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
case dwarf::DW_FORM_implicit_const:
|
case dwarf::DW_FORM_implicit_const:
|
||||||
case dwarf::DW_FORM_flag_present:
|
case dwarf::DW_FORM_flag_present:
|
||||||
@ -409,7 +409,7 @@ void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
|||||||
case dwarf::DW_FORM_strp_sup:
|
case dwarf::DW_FORM_strp_sup:
|
||||||
case dwarf::DW_FORM_addr:
|
case dwarf::DW_FORM_addr:
|
||||||
case dwarf::DW_FORM_ref_addr:
|
case dwarf::DW_FORM_ref_addr:
|
||||||
Asm->OutStreamer->EmitIntValue(Integer, SizeOf(Asm, Form));
|
Asm->OutStreamer->emitIntValue(Integer, SizeOf(Asm, Form));
|
||||||
return;
|
return;
|
||||||
case dwarf::DW_FORM_GNU_str_index:
|
case dwarf::DW_FORM_GNU_str_index:
|
||||||
case dwarf::DW_FORM_GNU_addr_index:
|
case dwarf::DW_FORM_GNU_addr_index:
|
||||||
@ -465,7 +465,7 @@ void DIEInteger::print(raw_ostream &O) const {
|
|||||||
|
|
||||||
/// EmitValue - Emit expression value.
|
/// EmitValue - Emit expression value.
|
||||||
///
|
///
|
||||||
void DIEExpr::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIEExpr::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
AP->emitDebugValue(Expr, SizeOf(AP, Form));
|
AP->emitDebugValue(Expr, SizeOf(AP, Form));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ void DIEExpr::print(raw_ostream &O) const { O << "Expr: " << *Expr; }
|
|||||||
|
|
||||||
/// EmitValue - Emit label value.
|
/// EmitValue - Emit label value.
|
||||||
///
|
///
|
||||||
void DIELabel::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIELabel::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
AP->emitLabelReference(
|
AP->emitLabelReference(
|
||||||
Label, SizeOf(AP, Form),
|
Label, SizeOf(AP, Form),
|
||||||
Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_sec_offset ||
|
Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_sec_offset ||
|
||||||
@ -510,7 +510,7 @@ void DIELabel::print(raw_ostream &O) const { O << "Lbl: " << Label->getName(); }
|
|||||||
// DIEBaseTypeRef Implementation
|
// DIEBaseTypeRef Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void DIEBaseTypeRef::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIEBaseTypeRef::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
uint64_t Offset = CU->ExprRefedBaseTypes[Index].Die->getOffset();
|
uint64_t Offset = CU->ExprRefedBaseTypes[Index].Die->getOffset();
|
||||||
assert(Offset < (1ULL << (ULEB128PadSize * 7)) && "Offset wont fit");
|
assert(Offset < (1ULL << (ULEB128PadSize * 7)) && "Offset wont fit");
|
||||||
AP->emitULEB128(Offset, nullptr, ULEB128PadSize);
|
AP->emitULEB128(Offset, nullptr, ULEB128PadSize);
|
||||||
@ -529,7 +529,7 @@ void DIEBaseTypeRef::print(raw_ostream &O) const { O << "BaseTypeRef: " << Index
|
|||||||
|
|
||||||
/// EmitValue - Emit delta value.
|
/// EmitValue - Emit delta value.
|
||||||
///
|
///
|
||||||
void DIEDelta::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIEDelta::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
AP->emitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
|
AP->emitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ void DIEDelta::print(raw_ostream &O) const {
|
|||||||
|
|
||||||
/// EmitValue - Emit string value.
|
/// EmitValue - Emit string value.
|
||||||
///
|
///
|
||||||
void DIEString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIEString::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
// Index of string in symbol table.
|
// Index of string in symbol table.
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
case dwarf::DW_FORM_GNU_str_index:
|
case dwarf::DW_FORM_GNU_str_index:
|
||||||
@ -562,13 +562,13 @@ void DIEString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
|||||||
case dwarf::DW_FORM_strx2:
|
case dwarf::DW_FORM_strx2:
|
||||||
case dwarf::DW_FORM_strx3:
|
case dwarf::DW_FORM_strx3:
|
||||||
case dwarf::DW_FORM_strx4:
|
case dwarf::DW_FORM_strx4:
|
||||||
DIEInteger(S.getIndex()).EmitValue(AP, Form);
|
DIEInteger(S.getIndex()).emitValue(AP, Form);
|
||||||
return;
|
return;
|
||||||
case dwarf::DW_FORM_strp:
|
case dwarf::DW_FORM_strp:
|
||||||
if (AP->MAI->doesDwarfUseRelocationsAcrossSections())
|
if (AP->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||||
DIELabel(S.getSymbol()).EmitValue(AP, Form);
|
DIELabel(S.getSymbol()).emitValue(AP, Form);
|
||||||
else
|
else
|
||||||
DIEInteger(S.getOffset()).EmitValue(AP, Form);
|
DIEInteger(S.getOffset()).emitValue(AP, Form);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Expected valid string form");
|
llvm_unreachable("Expected valid string form");
|
||||||
@ -604,7 +604,7 @@ void DIEString::print(raw_ostream &O) const {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// DIEInlineString Implementation
|
// DIEInlineString Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
void DIEInlineString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIEInlineString::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
if (Form == dwarf::DW_FORM_string) {
|
if (Form == dwarf::DW_FORM_string) {
|
||||||
AP->OutStreamer->emitBytes(S);
|
AP->OutStreamer->emitBytes(S);
|
||||||
AP->emitInt8(0);
|
AP->emitInt8(0);
|
||||||
@ -629,14 +629,14 @@ void DIEInlineString::print(raw_ostream &O) const {
|
|||||||
|
|
||||||
/// EmitValue - Emit debug information entry offset.
|
/// EmitValue - Emit debug information entry offset.
|
||||||
///
|
///
|
||||||
void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIEEntry::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
|
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
case dwarf::DW_FORM_ref1:
|
case dwarf::DW_FORM_ref1:
|
||||||
case dwarf::DW_FORM_ref2:
|
case dwarf::DW_FORM_ref2:
|
||||||
case dwarf::DW_FORM_ref4:
|
case dwarf::DW_FORM_ref4:
|
||||||
case dwarf::DW_FORM_ref8:
|
case dwarf::DW_FORM_ref8:
|
||||||
AP->OutStreamer->EmitIntValue(Entry->getOffset(), SizeOf(AP, Form));
|
AP->OutStreamer->emitIntValue(Entry->getOffset(), SizeOf(AP, Form));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case dwarf::DW_FORM_ref_udata:
|
case dwarf::DW_FORM_ref_udata:
|
||||||
@ -652,7 +652,7 @@ void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AP->OutStreamer->EmitIntValue(Addr, SizeOf(AP, Form));
|
AP->OutStreamer->emitIntValue(Addr, SizeOf(AP, Form));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -710,7 +710,7 @@ unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
|
|||||||
|
|
||||||
/// EmitValue - Emit location data.
|
/// EmitValue - Emit location data.
|
||||||
///
|
///
|
||||||
void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
void DIELoc::emitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
default: llvm_unreachable("Improper form for block");
|
default: llvm_unreachable("Improper form for block");
|
||||||
case dwarf::DW_FORM_block1: Asm->emitInt8(Size); break;
|
case dwarf::DW_FORM_block1: Asm->emitInt8(Size); break;
|
||||||
@ -723,7 +723,7 @@ void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &V : values())
|
for (const auto &V : values())
|
||||||
V.EmitValue(Asm);
|
V.emitValue(Asm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SizeOf - Determine size of location data in bytes.
|
/// SizeOf - Determine size of location data in bytes.
|
||||||
@ -762,7 +762,7 @@ unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
|
|||||||
|
|
||||||
/// EmitValue - Emit block data.
|
/// EmitValue - Emit block data.
|
||||||
///
|
///
|
||||||
void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
void DIEBlock::emitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
default: llvm_unreachable("Improper form for block");
|
default: llvm_unreachable("Improper form for block");
|
||||||
case dwarf::DW_FORM_block1: Asm->emitInt8(Size); break;
|
case dwarf::DW_FORM_block1: Asm->emitInt8(Size); break;
|
||||||
@ -776,7 +776,7 @@ void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &V : values())
|
for (const auto &V : values())
|
||||||
V.EmitValue(Asm);
|
V.emitValue(Asm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SizeOf - Determine size of block data in bytes.
|
/// SizeOf - Determine size of block data in bytes.
|
||||||
@ -813,7 +813,7 @@ unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
|
|||||||
|
|
||||||
/// EmitValue - Emit label value.
|
/// EmitValue - Emit label value.
|
||||||
///
|
///
|
||||||
void DIELocList::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
void DIELocList::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||||
if (Form == dwarf::DW_FORM_loclistx) {
|
if (Form == dwarf::DW_FORM_loclistx) {
|
||||||
AP->emitULEB128(Index);
|
AP->emitULEB128(Index);
|
||||||
return;
|
return;
|
||||||
|
@ -2448,7 +2448,7 @@ static void emitRangeList(
|
|||||||
if (!UseDwarf5) {
|
if (!UseDwarf5) {
|
||||||
Base = NewBase;
|
Base = NewBase;
|
||||||
BaseIsSet = true;
|
BaseIsSet = true;
|
||||||
Asm->OutStreamer->EmitIntValue(-1, Size);
|
Asm->OutStreamer->emitIntValue(-1, Size);
|
||||||
Asm->OutStreamer->AddComment(" base address");
|
Asm->OutStreamer->AddComment(" base address");
|
||||||
Asm->OutStreamer->emitSymbolValue(Base, Size);
|
Asm->OutStreamer->emitSymbolValue(Base, Size);
|
||||||
} else if (NewBase != Begin || P.second.size() > 1) {
|
} else if (NewBase != Begin || P.second.size() > 1) {
|
||||||
@ -2465,8 +2465,8 @@ static void emitRangeList(
|
|||||||
} else if (BaseIsSet && !UseDwarf5) {
|
} else if (BaseIsSet && !UseDwarf5) {
|
||||||
BaseIsSet = false;
|
BaseIsSet = false;
|
||||||
assert(!Base);
|
assert(!Base);
|
||||||
Asm->OutStreamer->EmitIntValue(-1, Size);
|
Asm->OutStreamer->emitIntValue(-1, Size);
|
||||||
Asm->OutStreamer->EmitIntValue(0, Size);
|
Asm->OutStreamer->emitIntValue(0, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto *RS : P.second) {
|
for (const auto *RS : P.second) {
|
||||||
@ -2507,8 +2507,8 @@ static void emitRangeList(
|
|||||||
Asm->emitInt8(EndOfList);
|
Asm->emitInt8(EndOfList);
|
||||||
} else {
|
} else {
|
||||||
// Terminate the list with two 0 values.
|
// Terminate the list with two 0 values.
|
||||||
Asm->OutStreamer->EmitIntValue(0, Size);
|
Asm->OutStreamer->emitIntValue(0, Size);
|
||||||
Asm->OutStreamer->EmitIntValue(0, Size);
|
Asm->OutStreamer->emitIntValue(0, Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2734,13 +2734,13 @@ void DwarfDebug::emitDebugARanges() {
|
|||||||
if (Size == 0)
|
if (Size == 0)
|
||||||
Size = 1;
|
Size = 1;
|
||||||
|
|
||||||
Asm->OutStreamer->EmitIntValue(Size, PtrSize);
|
Asm->OutStreamer->emitIntValue(Size, PtrSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("ARange terminator");
|
Asm->OutStreamer->AddComment("ARange terminator");
|
||||||
Asm->OutStreamer->EmitIntValue(0, PtrSize);
|
Asm->OutStreamer->emitIntValue(0, PtrSize);
|
||||||
Asm->OutStreamer->EmitIntValue(0, PtrSize);
|
Asm->OutStreamer->emitIntValue(0, PtrSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,6 @@ void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
|
|||||||
if (UseRelativeOffsets)
|
if (UseRelativeOffsets)
|
||||||
Asm.emitDwarfStringOffset(Entry->getValue());
|
Asm.emitDwarfStringOffset(Entry->getValue());
|
||||||
else
|
else
|
||||||
Asm.OutStreamer->EmitIntValue(Entry->getValue().Offset, size);
|
Asm.OutStreamer->emitIntValue(Entry->getValue().Offset, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1667,10 +1667,10 @@ void DwarfTypeUnit::emitHeader(bool UseOffsets) {
|
|||||||
DD->useSplitDwarf() ? dwarf::DW_UT_split_type
|
DD->useSplitDwarf() ? dwarf::DW_UT_split_type
|
||||||
: dwarf::DW_UT_type);
|
: dwarf::DW_UT_type);
|
||||||
Asm->OutStreamer->AddComment("Type Signature");
|
Asm->OutStreamer->AddComment("Type Signature");
|
||||||
Asm->OutStreamer->EmitIntValue(TypeSignature, sizeof(TypeSignature));
|
Asm->OutStreamer->emitIntValue(TypeSignature, sizeof(TypeSignature));
|
||||||
Asm->OutStreamer->AddComment("Type DIE Offset");
|
Asm->OutStreamer->AddComment("Type DIE Offset");
|
||||||
// In a skeleton type unit there is no type DIE so emit a zero offset.
|
// In a skeleton type unit there is no type DIE so emit a zero offset.
|
||||||
Asm->OutStreamer->EmitIntValue(Ty ? Ty->getOffset() : 0,
|
Asm->OutStreamer->emitIntValue(Ty ? Ty->getOffset() : 0,
|
||||||
sizeof(Ty->getOffset()));
|
sizeof(Ty->getOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ void OcamlGCMetadataPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
|
|||||||
EmitCamlGlobal(M, AP, "data_end");
|
EmitCamlGlobal(M, AP, "data_end");
|
||||||
|
|
||||||
// FIXME: Why does ocaml emit this??
|
// FIXME: Why does ocaml emit this??
|
||||||
AP.OutStreamer->EmitIntValue(0, IntPtrSize);
|
AP.OutStreamer->emitIntValue(0, IntPtrSize);
|
||||||
|
|
||||||
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
|
AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
|
||||||
EmitCamlGlobal(M, AP, "frametable");
|
EmitCamlGlobal(M, AP, "frametable");
|
||||||
|
@ -276,7 +276,7 @@ void WinException::endFuncletImpl() {
|
|||||||
StringRef FuncLinkageName = GlobalValue::dropLLVMManglingEscape(F.getName());
|
StringRef FuncLinkageName = GlobalValue::dropLLVMManglingEscape(F.getName());
|
||||||
MCSymbol *FuncInfoXData = Asm->OutContext.getOrCreateSymbol(
|
MCSymbol *FuncInfoXData = Asm->OutContext.getOrCreateSymbol(
|
||||||
Twine("$cppxdata$", FuncLinkageName));
|
Twine("$cppxdata$", FuncLinkageName));
|
||||||
Asm->OutStreamer->EmitValue(create32bitRef(FuncInfoXData), 4);
|
Asm->OutStreamer->emitValue(create32bitRef(FuncInfoXData), 4);
|
||||||
} else if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets() &&
|
} else if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets() &&
|
||||||
!CurrentFuncletEntry->isEHFuncletEntry()) {
|
!CurrentFuncletEntry->isEHFuncletEntry()) {
|
||||||
// If this is the parent function in Win64 SEH, emit the LSDA immediately
|
// If this is the parent function in Win64 SEH, emit the LSDA immediately
|
||||||
@ -579,7 +579,7 @@ void WinException::emitCSpecificHandlerTable(const MachineFunction *MF) {
|
|||||||
const MCExpr *EntrySize = MCConstantExpr::create(16, Ctx);
|
const MCExpr *EntrySize = MCConstantExpr::create(16, Ctx);
|
||||||
const MCExpr *EntryCount = MCBinaryExpr::createDiv(LabelDiff, EntrySize, Ctx);
|
const MCExpr *EntryCount = MCBinaryExpr::createDiv(LabelDiff, EntrySize, Ctx);
|
||||||
AddComment("Number of call sites");
|
AddComment("Number of call sites");
|
||||||
OS.EmitValue(EntryCount, 4);
|
OS.emitValue(EntryCount, 4);
|
||||||
|
|
||||||
OS.emitLabel(TableBegin);
|
OS.emitLabel(TableBegin);
|
||||||
|
|
||||||
@ -641,14 +641,14 @@ void WinException::emitSEHActionsForRange(const WinEHFuncInfo &FuncInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddComment("LabelStart");
|
AddComment("LabelStart");
|
||||||
OS.EmitValue(getLabel(BeginLabel), 4);
|
OS.emitValue(getLabel(BeginLabel), 4);
|
||||||
AddComment("LabelEnd");
|
AddComment("LabelEnd");
|
||||||
OS.EmitValue(getLabel(EndLabel), 4);
|
OS.emitValue(getLabel(EndLabel), 4);
|
||||||
AddComment(UME.IsFinally ? "FinallyFunclet" : UME.Filter ? "FilterFunction"
|
AddComment(UME.IsFinally ? "FinallyFunclet" : UME.Filter ? "FilterFunction"
|
||||||
: "CatchAll");
|
: "CatchAll");
|
||||||
OS.EmitValue(FilterOrFinally, 4);
|
OS.emitValue(FilterOrFinally, 4);
|
||||||
AddComment(UME.IsFinally ? "Null" : "ExceptionHandler");
|
AddComment(UME.IsFinally ? "Null" : "ExceptionHandler");
|
||||||
OS.EmitValue(ExceptOrNull, 4);
|
OS.emitValue(ExceptOrNull, 4);
|
||||||
|
|
||||||
assert(UME.ToState < State && "states should decrease");
|
assert(UME.ToState < State && "states should decrease");
|
||||||
State = UME.ToState;
|
State = UME.ToState;
|
||||||
@ -717,36 +717,36 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
|||||||
OS.emitLabel(FuncInfoXData);
|
OS.emitLabel(FuncInfoXData);
|
||||||
|
|
||||||
AddComment("MagicNumber");
|
AddComment("MagicNumber");
|
||||||
OS.EmitIntValue(0x19930522, 4);
|
OS.emitIntValue(0x19930522, 4);
|
||||||
|
|
||||||
AddComment("MaxState");
|
AddComment("MaxState");
|
||||||
OS.EmitIntValue(FuncInfo.CxxUnwindMap.size(), 4);
|
OS.emitIntValue(FuncInfo.CxxUnwindMap.size(), 4);
|
||||||
|
|
||||||
AddComment("UnwindMap");
|
AddComment("UnwindMap");
|
||||||
OS.EmitValue(create32bitRef(UnwindMapXData), 4);
|
OS.emitValue(create32bitRef(UnwindMapXData), 4);
|
||||||
|
|
||||||
AddComment("NumTryBlocks");
|
AddComment("NumTryBlocks");
|
||||||
OS.EmitIntValue(FuncInfo.TryBlockMap.size(), 4);
|
OS.emitIntValue(FuncInfo.TryBlockMap.size(), 4);
|
||||||
|
|
||||||
AddComment("TryBlockMap");
|
AddComment("TryBlockMap");
|
||||||
OS.EmitValue(create32bitRef(TryBlockMapXData), 4);
|
OS.emitValue(create32bitRef(TryBlockMapXData), 4);
|
||||||
|
|
||||||
AddComment("IPMapEntries");
|
AddComment("IPMapEntries");
|
||||||
OS.EmitIntValue(IPToStateTable.size(), 4);
|
OS.emitIntValue(IPToStateTable.size(), 4);
|
||||||
|
|
||||||
AddComment("IPToStateXData");
|
AddComment("IPToStateXData");
|
||||||
OS.EmitValue(create32bitRef(IPToStateXData), 4);
|
OS.emitValue(create32bitRef(IPToStateXData), 4);
|
||||||
|
|
||||||
if (Asm->MAI->usesWindowsCFI()) {
|
if (Asm->MAI->usesWindowsCFI()) {
|
||||||
AddComment("UnwindHelp");
|
AddComment("UnwindHelp");
|
||||||
OS.EmitIntValue(UnwindHelpOffset, 4);
|
OS.emitIntValue(UnwindHelpOffset, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddComment("ESTypeList");
|
AddComment("ESTypeList");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
|
|
||||||
AddComment("EHFlags");
|
AddComment("EHFlags");
|
||||||
OS.EmitIntValue(1, 4);
|
OS.emitIntValue(1, 4);
|
||||||
|
|
||||||
// UnwindMapEntry {
|
// UnwindMapEntry {
|
||||||
// int32_t ToState;
|
// int32_t ToState;
|
||||||
@ -758,10 +758,10 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
|||||||
MCSymbol *CleanupSym =
|
MCSymbol *CleanupSym =
|
||||||
getMCSymbolForMBB(Asm, UME.Cleanup.dyn_cast<MachineBasicBlock *>());
|
getMCSymbolForMBB(Asm, UME.Cleanup.dyn_cast<MachineBasicBlock *>());
|
||||||
AddComment("ToState");
|
AddComment("ToState");
|
||||||
OS.EmitIntValue(UME.ToState, 4);
|
OS.emitIntValue(UME.ToState, 4);
|
||||||
|
|
||||||
AddComment("Action");
|
AddComment("Action");
|
||||||
OS.EmitValue(create32bitRef(CleanupSym), 4);
|
OS.emitValue(create32bitRef(CleanupSym), 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,19 +795,19 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
|||||||
"bad trymap interval");
|
"bad trymap interval");
|
||||||
|
|
||||||
AddComment("TryLow");
|
AddComment("TryLow");
|
||||||
OS.EmitIntValue(TBME.TryLow, 4);
|
OS.emitIntValue(TBME.TryLow, 4);
|
||||||
|
|
||||||
AddComment("TryHigh");
|
AddComment("TryHigh");
|
||||||
OS.EmitIntValue(TBME.TryHigh, 4);
|
OS.emitIntValue(TBME.TryHigh, 4);
|
||||||
|
|
||||||
AddComment("CatchHigh");
|
AddComment("CatchHigh");
|
||||||
OS.EmitIntValue(TBME.CatchHigh, 4);
|
OS.emitIntValue(TBME.CatchHigh, 4);
|
||||||
|
|
||||||
AddComment("NumCatches");
|
AddComment("NumCatches");
|
||||||
OS.EmitIntValue(TBME.HandlerArray.size(), 4);
|
OS.emitIntValue(TBME.HandlerArray.size(), 4);
|
||||||
|
|
||||||
AddComment("HandlerArray");
|
AddComment("HandlerArray");
|
||||||
OS.EmitValue(create32bitRef(HandlerMapXData), 4);
|
OS.emitValue(create32bitRef(HandlerMapXData), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// All funclets use the same parent frame offset currently.
|
// All funclets use the same parent frame offset currently.
|
||||||
@ -847,20 +847,20 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
|||||||
getMCSymbolForMBB(Asm, HT.Handler.dyn_cast<MachineBasicBlock *>());
|
getMCSymbolForMBB(Asm, HT.Handler.dyn_cast<MachineBasicBlock *>());
|
||||||
|
|
||||||
AddComment("Adjectives");
|
AddComment("Adjectives");
|
||||||
OS.EmitIntValue(HT.Adjectives, 4);
|
OS.emitIntValue(HT.Adjectives, 4);
|
||||||
|
|
||||||
AddComment("Type");
|
AddComment("Type");
|
||||||
OS.EmitValue(create32bitRef(HT.TypeDescriptor), 4);
|
OS.emitValue(create32bitRef(HT.TypeDescriptor), 4);
|
||||||
|
|
||||||
AddComment("CatchObjOffset");
|
AddComment("CatchObjOffset");
|
||||||
OS.EmitValue(FrameAllocOffsetRef, 4);
|
OS.emitValue(FrameAllocOffsetRef, 4);
|
||||||
|
|
||||||
AddComment("Handler");
|
AddComment("Handler");
|
||||||
OS.EmitValue(create32bitRef(HandlerSym), 4);
|
OS.emitValue(create32bitRef(HandlerSym), 4);
|
||||||
|
|
||||||
if (shouldEmitPersonality) {
|
if (shouldEmitPersonality) {
|
||||||
AddComment("ParentFrameOffset");
|
AddComment("ParentFrameOffset");
|
||||||
OS.EmitIntValue(ParentFrameOffset, 4);
|
OS.emitIntValue(ParentFrameOffset, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -874,9 +874,9 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
|||||||
OS.emitLabel(IPToStateXData);
|
OS.emitLabel(IPToStateXData);
|
||||||
for (auto &IPStatePair : IPToStateTable) {
|
for (auto &IPStatePair : IPToStateTable) {
|
||||||
AddComment("IP");
|
AddComment("IP");
|
||||||
OS.EmitValue(IPStatePair.first, 4);
|
OS.emitValue(IPStatePair.first, 4);
|
||||||
AddComment("ToState");
|
AddComment("ToState");
|
||||||
OS.EmitIntValue(IPStatePair.second, 4);
|
OS.emitIntValue(IPStatePair.second, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1028,13 +1028,13 @@ void WinException::emitExceptHandlerTable(const MachineFunction *MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddComment("GSCookieOffset");
|
AddComment("GSCookieOffset");
|
||||||
OS.EmitIntValue(GSCookieOffset, 4);
|
OS.emitIntValue(GSCookieOffset, 4);
|
||||||
AddComment("GSCookieXOROffset");
|
AddComment("GSCookieXOROffset");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
AddComment("EHCookieOffset");
|
AddComment("EHCookieOffset");
|
||||||
OS.EmitIntValue(EHCookieOffset, 4);
|
OS.emitIntValue(EHCookieOffset, 4);
|
||||||
AddComment("EHCookieXOROffset");
|
AddComment("EHCookieXOROffset");
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
BaseState = -2;
|
BaseState = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1047,11 +1047,11 @@ void WinException::emitExceptHandlerTable(const MachineFunction *MF) {
|
|||||||
// _except_handler4 it's -2. Do that replacement here if necessary.
|
// _except_handler4 it's -2. Do that replacement here if necessary.
|
||||||
int ToState = UME.ToState == -1 ? BaseState : UME.ToState;
|
int ToState = UME.ToState == -1 ? BaseState : UME.ToState;
|
||||||
AddComment("ToState");
|
AddComment("ToState");
|
||||||
OS.EmitIntValue(ToState, 4);
|
OS.emitIntValue(ToState, 4);
|
||||||
AddComment(UME.IsFinally ? "Null" : "FilterFunction");
|
AddComment(UME.IsFinally ? "Null" : "FilterFunction");
|
||||||
OS.EmitValue(create32bitRef(UME.Filter), 4);
|
OS.emitValue(create32bitRef(UME.Filter), 4);
|
||||||
AddComment(UME.IsFinally ? "FinallyFunclet" : "ExceptionHandler");
|
AddComment(UME.IsFinally ? "FinallyFunclet" : "ExceptionHandler");
|
||||||
OS.EmitValue(create32bitRef(ExceptOrFinally), 4);
|
OS.emitValue(create32bitRef(ExceptOrFinally), 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,9 +1124,9 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
|
|||||||
|
|
||||||
// Write out a sentinel indicating the end of the standard (Windows) xdata
|
// Write out a sentinel indicating the end of the standard (Windows) xdata
|
||||||
// and the start of the additional (CLR) info.
|
// and the start of the additional (CLR) info.
|
||||||
OS.EmitIntValue(0xffffffff, 4);
|
OS.emitIntValue(0xffffffff, 4);
|
||||||
// Write out the number of funclets
|
// Write out the number of funclets
|
||||||
OS.EmitIntValue(NumStates, 4);
|
OS.emitIntValue(NumStates, 4);
|
||||||
|
|
||||||
// Walk the machine blocks/instrs, computing and emitting a few things:
|
// Walk the machine blocks/instrs, computing and emitting a few things:
|
||||||
// 1. Emit a list of the offsets to each handler entry, in lexical order.
|
// 1. Emit a list of the offsets to each handler entry, in lexical order.
|
||||||
@ -1164,7 +1164,7 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
|
|||||||
}
|
}
|
||||||
// Emit the function/funclet end and, if this is a funclet (and not the
|
// Emit the function/funclet end and, if this is a funclet (and not the
|
||||||
// root function), record it in the EndSymbolMap.
|
// root function), record it in the EndSymbolMap.
|
||||||
OS.EmitValue(getOffset(EndSymbol, FuncBeginSym), 4);
|
OS.emitValue(getOffset(EndSymbol, FuncBeginSym), 4);
|
||||||
if (FuncletState != NullState) {
|
if (FuncletState != NullState) {
|
||||||
// Record the end of the handler.
|
// Record the end of the handler.
|
||||||
EndSymbolMap[FuncletState] = EndSymbol;
|
EndSymbolMap[FuncletState] = EndSymbol;
|
||||||
@ -1217,7 +1217,7 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now emit the clause info, starting with the number of clauses.
|
// Now emit the clause info, starting with the number of clauses.
|
||||||
OS.EmitIntValue(Clauses.size(), 4);
|
OS.emitIntValue(Clauses.size(), 4);
|
||||||
for (ClrClause &Clause : Clauses) {
|
for (ClrClause &Clause : Clauses) {
|
||||||
// Emit a CORINFO_EH_CLAUSE :
|
// Emit a CORINFO_EH_CLAUSE :
|
||||||
/*
|
/*
|
||||||
@ -1299,18 +1299,18 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
|
|||||||
assert(Clause.EnclosingState > MinClauseMap[Clause.State]);
|
assert(Clause.EnclosingState > MinClauseMap[Clause.State]);
|
||||||
Flags |= 8;
|
Flags |= 8;
|
||||||
}
|
}
|
||||||
OS.EmitIntValue(Flags, 4);
|
OS.emitIntValue(Flags, 4);
|
||||||
|
|
||||||
// Write the clause start/end
|
// Write the clause start/end
|
||||||
OS.EmitValue(ClauseBegin, 4);
|
OS.emitValue(ClauseBegin, 4);
|
||||||
OS.EmitValue(ClauseEnd, 4);
|
OS.emitValue(ClauseEnd, 4);
|
||||||
|
|
||||||
// Write out the handler start/end
|
// Write out the handler start/end
|
||||||
OS.EmitValue(HandlerBegin, 4);
|
OS.emitValue(HandlerBegin, 4);
|
||||||
OS.EmitValue(HandlerEnd, 4);
|
OS.emitValue(HandlerEnd, 4);
|
||||||
|
|
||||||
// Write out the type token or filter offset
|
// Write out the type token or filter offset
|
||||||
assert(Entry.HandlerType != ClrHandlerType::Filter && "NYI: filters");
|
assert(Entry.HandlerType != ClrHandlerType::Filter && "NYI: filters");
|
||||||
OS.EmitIntValue(Entry.TypeToken, 4);
|
OS.emitIntValue(Entry.TypeToken, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ void FaultMaps::serializeToFaultMapSection() {
|
|||||||
LLVM_DEBUG(dbgs() << "********** Fault Map Output **********\n");
|
LLVM_DEBUG(dbgs() << "********** Fault Map Output **********\n");
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
OS.EmitIntValue(FaultMapVersion, 1); // Version.
|
OS.emitIntValue(FaultMapVersion, 1); // Version.
|
||||||
OS.EmitIntValue(0, 1); // Reserved.
|
OS.emitIntValue(0, 1); // Reserved.
|
||||||
OS.EmitIntValue(0, 2); // Reserved.
|
OS.emitIntValue(0, 2); // Reserved.
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << WFMP << "#functions = " << FunctionInfos.size() << "\n");
|
LLVM_DEBUG(dbgs() << WFMP << "#functions = " << FunctionInfos.size() << "\n");
|
||||||
OS.EmitIntValue(FunctionInfos.size(), 4);
|
OS.emitIntValue(FunctionInfos.size(), 4);
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << WFMP << "functions:\n");
|
LLVM_DEBUG(dbgs() << WFMP << "functions:\n");
|
||||||
|
|
||||||
@ -83,22 +83,22 @@ void FaultMaps::emitFunctionInfo(const MCSymbol *FnLabel,
|
|||||||
OS.emitSymbolValue(FnLabel, 8);
|
OS.emitSymbolValue(FnLabel, 8);
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << WFMP << " #faulting PCs: " << FFI.size() << "\n");
|
LLVM_DEBUG(dbgs() << WFMP << " #faulting PCs: " << FFI.size() << "\n");
|
||||||
OS.EmitIntValue(FFI.size(), 4);
|
OS.emitIntValue(FFI.size(), 4);
|
||||||
|
|
||||||
OS.EmitIntValue(0, 4); // Reserved
|
OS.emitIntValue(0, 4); // Reserved
|
||||||
|
|
||||||
for (auto &Fault : FFI) {
|
for (auto &Fault : FFI) {
|
||||||
LLVM_DEBUG(dbgs() << WFMP << " fault type: "
|
LLVM_DEBUG(dbgs() << WFMP << " fault type: "
|
||||||
<< faultTypeToString(Fault.Kind) << "\n");
|
<< faultTypeToString(Fault.Kind) << "\n");
|
||||||
OS.EmitIntValue(Fault.Kind, 4);
|
OS.emitIntValue(Fault.Kind, 4);
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << WFMP << " faulting PC offset: "
|
LLVM_DEBUG(dbgs() << WFMP << " faulting PC offset: "
|
||||||
<< *Fault.FaultingOffsetExpr << "\n");
|
<< *Fault.FaultingOffsetExpr << "\n");
|
||||||
OS.EmitValue(Fault.FaultingOffsetExpr, 4);
|
OS.emitValue(Fault.FaultingOffsetExpr, 4);
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << WFMP << " fault handler PC offset: "
|
LLVM_DEBUG(dbgs() << WFMP << " fault handler PC offset: "
|
||||||
<< *Fault.HandlerOffsetExpr << "\n");
|
<< *Fault.HandlerOffsetExpr << "\n");
|
||||||
OS.EmitValue(Fault.HandlerOffsetExpr, 4);
|
OS.emitValue(Fault.HandlerOffsetExpr, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,19 +413,19 @@ void StackMaps::recordStatepoint(const MCSymbol &L, const MachineInstr &MI) {
|
|||||||
/// uint32 : NumRecords
|
/// uint32 : NumRecords
|
||||||
void StackMaps::emitStackmapHeader(MCStreamer &OS) {
|
void StackMaps::emitStackmapHeader(MCStreamer &OS) {
|
||||||
// Header.
|
// Header.
|
||||||
OS.EmitIntValue(StackMapVersion, 1); // Version.
|
OS.emitIntValue(StackMapVersion, 1); // Version.
|
||||||
OS.EmitIntValue(0, 1); // Reserved.
|
OS.emitIntValue(0, 1); // Reserved.
|
||||||
OS.EmitIntValue(0, 2); // Reserved.
|
OS.emitIntValue(0, 2); // Reserved.
|
||||||
|
|
||||||
// Num functions.
|
// Num functions.
|
||||||
LLVM_DEBUG(dbgs() << WSMP << "#functions = " << FnInfos.size() << '\n');
|
LLVM_DEBUG(dbgs() << WSMP << "#functions = " << FnInfos.size() << '\n');
|
||||||
OS.EmitIntValue(FnInfos.size(), 4);
|
OS.emitIntValue(FnInfos.size(), 4);
|
||||||
// Num constants.
|
// Num constants.
|
||||||
LLVM_DEBUG(dbgs() << WSMP << "#constants = " << ConstPool.size() << '\n');
|
LLVM_DEBUG(dbgs() << WSMP << "#constants = " << ConstPool.size() << '\n');
|
||||||
OS.EmitIntValue(ConstPool.size(), 4);
|
OS.emitIntValue(ConstPool.size(), 4);
|
||||||
// Num callsites.
|
// Num callsites.
|
||||||
LLVM_DEBUG(dbgs() << WSMP << "#callsites = " << CSInfos.size() << '\n');
|
LLVM_DEBUG(dbgs() << WSMP << "#callsites = " << CSInfos.size() << '\n');
|
||||||
OS.EmitIntValue(CSInfos.size(), 4);
|
OS.emitIntValue(CSInfos.size(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit the function frame record for each function.
|
/// Emit the function frame record for each function.
|
||||||
@ -443,8 +443,8 @@ void StackMaps::emitFunctionFrameRecords(MCStreamer &OS) {
|
|||||||
<< " frame size: " << FR.second.StackSize
|
<< " frame size: " << FR.second.StackSize
|
||||||
<< " callsite count: " << FR.second.RecordCount << '\n');
|
<< " callsite count: " << FR.second.RecordCount << '\n');
|
||||||
OS.emitSymbolValue(FR.first, 8);
|
OS.emitSymbolValue(FR.first, 8);
|
||||||
OS.EmitIntValue(FR.second.StackSize, 8);
|
OS.emitIntValue(FR.second.StackSize, 8);
|
||||||
OS.EmitIntValue(FR.second.RecordCount, 8);
|
OS.emitIntValue(FR.second.RecordCount, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ void StackMaps::emitConstantPoolEntries(MCStreamer &OS) {
|
|||||||
LLVM_DEBUG(dbgs() << WSMP << "constants:\n");
|
LLVM_DEBUG(dbgs() << WSMP << "constants:\n");
|
||||||
for (const auto &ConstEntry : ConstPool) {
|
for (const auto &ConstEntry : ConstPool) {
|
||||||
LLVM_DEBUG(dbgs() << WSMP << ConstEntry.second << '\n');
|
LLVM_DEBUG(dbgs() << WSMP << ConstEntry.second << '\n');
|
||||||
OS.EmitIntValue(ConstEntry.second, 8);
|
OS.emitIntValue(ConstEntry.second, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,43 +501,43 @@ void StackMaps::emitCallsiteEntries(MCStreamer &OS) {
|
|||||||
// simple overflow checks, but we may eventually communicate other
|
// simple overflow checks, but we may eventually communicate other
|
||||||
// compilation errors this way.
|
// compilation errors this way.
|
||||||
if (CSLocs.size() > UINT16_MAX || LiveOuts.size() > UINT16_MAX) {
|
if (CSLocs.size() > UINT16_MAX || LiveOuts.size() > UINT16_MAX) {
|
||||||
OS.EmitIntValue(UINT64_MAX, 8); // Invalid ID.
|
OS.emitIntValue(UINT64_MAX, 8); // Invalid ID.
|
||||||
OS.EmitValue(CSI.CSOffsetExpr, 4);
|
OS.emitValue(CSI.CSOffsetExpr, 4);
|
||||||
OS.EmitIntValue(0, 2); // Reserved.
|
OS.emitIntValue(0, 2); // Reserved.
|
||||||
OS.EmitIntValue(0, 2); // 0 locations.
|
OS.emitIntValue(0, 2); // 0 locations.
|
||||||
OS.EmitIntValue(0, 2); // padding.
|
OS.emitIntValue(0, 2); // padding.
|
||||||
OS.EmitIntValue(0, 2); // 0 live-out registers.
|
OS.emitIntValue(0, 2); // 0 live-out registers.
|
||||||
OS.EmitIntValue(0, 4); // padding.
|
OS.emitIntValue(0, 4); // padding.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
OS.EmitIntValue(CSI.ID, 8);
|
OS.emitIntValue(CSI.ID, 8);
|
||||||
OS.EmitValue(CSI.CSOffsetExpr, 4);
|
OS.emitValue(CSI.CSOffsetExpr, 4);
|
||||||
|
|
||||||
// Reserved for flags.
|
// Reserved for flags.
|
||||||
OS.EmitIntValue(0, 2);
|
OS.emitIntValue(0, 2);
|
||||||
OS.EmitIntValue(CSLocs.size(), 2);
|
OS.emitIntValue(CSLocs.size(), 2);
|
||||||
|
|
||||||
for (const auto &Loc : CSLocs) {
|
for (const auto &Loc : CSLocs) {
|
||||||
OS.EmitIntValue(Loc.Type, 1);
|
OS.emitIntValue(Loc.Type, 1);
|
||||||
OS.EmitIntValue(0, 1); // Reserved
|
OS.emitIntValue(0, 1); // Reserved
|
||||||
OS.EmitIntValue(Loc.Size, 2);
|
OS.emitIntValue(Loc.Size, 2);
|
||||||
OS.EmitIntValue(Loc.Reg, 2);
|
OS.emitIntValue(Loc.Reg, 2);
|
||||||
OS.EmitIntValue(0, 2); // Reserved
|
OS.emitIntValue(0, 2); // Reserved
|
||||||
OS.EmitIntValue(Loc.Offset, 4);
|
OS.emitIntValue(Loc.Offset, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit alignment to 8 byte.
|
// Emit alignment to 8 byte.
|
||||||
OS.emitValueToAlignment(8);
|
OS.emitValueToAlignment(8);
|
||||||
|
|
||||||
// Num live-out registers and padding to align to 4 byte.
|
// Num live-out registers and padding to align to 4 byte.
|
||||||
OS.EmitIntValue(0, 2);
|
OS.emitIntValue(0, 2);
|
||||||
OS.EmitIntValue(LiveOuts.size(), 2);
|
OS.emitIntValue(LiveOuts.size(), 2);
|
||||||
|
|
||||||
for (const auto &LO : LiveOuts) {
|
for (const auto &LO : LiveOuts) {
|
||||||
OS.EmitIntValue(LO.DwarfRegNum, 2);
|
OS.emitIntValue(LO.DwarfRegNum, 2);
|
||||||
OS.EmitIntValue(0, 1);
|
OS.emitIntValue(0, 1);
|
||||||
OS.EmitIntValue(LO.Size, 1);
|
OS.emitIntValue(LO.Size, 1);
|
||||||
}
|
}
|
||||||
// Emit alignment to 8 byte.
|
// Emit alignment to 8 byte.
|
||||||
OS.emitValueToAlignment(8);
|
OS.emitValueToAlignment(8);
|
||||||
|
@ -278,7 +278,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
|
|||||||
report_fatal_error("invalid llvm.linker.options");
|
report_fatal_error("invalid llvm.linker.options");
|
||||||
for (const auto &Option : cast<MDNode>(Operand)->operands()) {
|
for (const auto &Option : cast<MDNode>(Operand)->operands()) {
|
||||||
Streamer.emitBytes(cast<MDString>(Option)->getString());
|
Streamer.emitBytes(cast<MDString>(Option)->getString());
|
||||||
Streamer.EmitIntValue(0, 1);
|
Streamer.emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
|
|||||||
for (const auto *Operand : DependentLibraries->operands()) {
|
for (const auto *Operand : DependentLibraries->operands()) {
|
||||||
Streamer.emitBytes(
|
Streamer.emitBytes(
|
||||||
cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
|
cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
|
||||||
Streamer.EmitIntValue(0, 1);
|
Streamer.emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,8 +305,8 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
|
|||||||
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
|
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
|
||||||
Streamer.SwitchSection(S);
|
Streamer.SwitchSection(S);
|
||||||
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
|
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
|
||||||
Streamer.EmitIntValue(Version, 4);
|
Streamer.emitIntValue(Version, 4);
|
||||||
Streamer.EmitIntValue(Flags, 4);
|
Streamer.emitIntValue(Flags, 4);
|
||||||
Streamer.AddBlankLine();
|
Streamer.AddBlankLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,8 +920,8 @@ void TargetLoweringObjectFileMachO::emitModuleMetadata(MCStreamer &Streamer,
|
|||||||
Streamer.SwitchSection(S);
|
Streamer.SwitchSection(S);
|
||||||
Streamer.emitLabel(getContext().
|
Streamer.emitLabel(getContext().
|
||||||
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
|
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
|
||||||
Streamer.EmitIntValue(VersionVal, 4);
|
Streamer.emitIntValue(VersionVal, 4);
|
||||||
Streamer.EmitIntValue(ImageInfoFlags, 4);
|
Streamer.emitIntValue(ImageInfoFlags, 4);
|
||||||
Streamer.AddBlankLine();
|
Streamer.AddBlankLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1473,8 +1473,8 @@ void TargetLoweringObjectFileCOFF::emitModuleMetadata(MCStreamer &Streamer,
|
|||||||
SectionKind::getReadOnly());
|
SectionKind::getReadOnly());
|
||||||
Streamer.SwitchSection(S);
|
Streamer.SwitchSection(S);
|
||||||
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
|
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
|
||||||
Streamer.EmitIntValue(Version, 4);
|
Streamer.emitIntValue(Version, 4);
|
||||||
Streamer.EmitIntValue(Flags, 4);
|
Streamer.emitIntValue(Flags, 4);
|
||||||
Streamer.AddBlankLine();
|
Streamer.AddBlankLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd, const Twine &Comment) {
|
|||||||
emitComment(Comment + ": " + TypeNameStr);
|
emitComment(Comment + ": " + TypeNameStr);
|
||||||
else
|
else
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(TypeInd.getIndex(), sizeof(TypeInd.getIndex()));
|
Streamer->emitIntValue(TypeInd.getIndex(), sizeof(TypeInd.getIndex()));
|
||||||
incrStreamedLen(sizeof(TypeInd.getIndex()));
|
incrStreamedLen(sizeof(TypeInd.getIndex()));
|
||||||
} else if (isWriting()) {
|
} else if (isWriting()) {
|
||||||
if (auto EC = Writer->writeInteger(TypeInd.getIndex()))
|
if (auto EC = Writer->writeInteger(TypeInd.getIndex()))
|
||||||
@ -275,24 +275,24 @@ void CodeViewRecordIO::emitEncodedSignedInteger(const int64_t &Value,
|
|||||||
const Twine &Comment) {
|
const Twine &Comment) {
|
||||||
assert(Value < 0 && "Encoded integer is not signed!");
|
assert(Value < 0 && "Encoded integer is not signed!");
|
||||||
if (Value >= std::numeric_limits<int8_t>::min()) {
|
if (Value >= std::numeric_limits<int8_t>::min()) {
|
||||||
Streamer->EmitIntValue(LF_CHAR, 2);
|
Streamer->emitIntValue(LF_CHAR, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 1);
|
Streamer->emitIntValue(Value, 1);
|
||||||
incrStreamedLen(3);
|
incrStreamedLen(3);
|
||||||
} else if (Value >= std::numeric_limits<int16_t>::min()) {
|
} else if (Value >= std::numeric_limits<int16_t>::min()) {
|
||||||
Streamer->EmitIntValue(LF_SHORT, 2);
|
Streamer->emitIntValue(LF_SHORT, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 2);
|
Streamer->emitIntValue(Value, 2);
|
||||||
incrStreamedLen(4);
|
incrStreamedLen(4);
|
||||||
} else if (Value >= std::numeric_limits<int32_t>::min()) {
|
} else if (Value >= std::numeric_limits<int32_t>::min()) {
|
||||||
Streamer->EmitIntValue(LF_LONG, 2);
|
Streamer->emitIntValue(LF_LONG, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 4);
|
Streamer->emitIntValue(Value, 4);
|
||||||
incrStreamedLen(6);
|
incrStreamedLen(6);
|
||||||
} else {
|
} else {
|
||||||
Streamer->EmitIntValue(LF_QUADWORD, 2);
|
Streamer->emitIntValue(LF_QUADWORD, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 4);
|
Streamer->emitIntValue(Value, 4);
|
||||||
incrStreamedLen(6);
|
incrStreamedLen(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,22 +301,22 @@ void CodeViewRecordIO::emitEncodedUnsignedInteger(const uint64_t &Value,
|
|||||||
const Twine &Comment) {
|
const Twine &Comment) {
|
||||||
if (Value < LF_NUMERIC) {
|
if (Value < LF_NUMERIC) {
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 2);
|
Streamer->emitIntValue(Value, 2);
|
||||||
incrStreamedLen(2);
|
incrStreamedLen(2);
|
||||||
} else if (Value <= std::numeric_limits<uint16_t>::max()) {
|
} else if (Value <= std::numeric_limits<uint16_t>::max()) {
|
||||||
Streamer->EmitIntValue(LF_USHORT, 2);
|
Streamer->emitIntValue(LF_USHORT, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 2);
|
Streamer->emitIntValue(Value, 2);
|
||||||
incrStreamedLen(4);
|
incrStreamedLen(4);
|
||||||
} else if (Value <= std::numeric_limits<uint32_t>::max()) {
|
} else if (Value <= std::numeric_limits<uint32_t>::max()) {
|
||||||
Streamer->EmitIntValue(LF_ULONG, 2);
|
Streamer->emitIntValue(LF_ULONG, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 4);
|
Streamer->emitIntValue(Value, 4);
|
||||||
incrStreamedLen(6);
|
incrStreamedLen(6);
|
||||||
} else {
|
} else {
|
||||||
Streamer->EmitIntValue(LF_UQUADWORD, 2);
|
Streamer->emitIntValue(LF_UQUADWORD, 2);
|
||||||
emitComment(Comment);
|
emitComment(Comment);
|
||||||
Streamer->EmitIntValue(Value, 8);
|
Streamer->emitIntValue(Value, 8);
|
||||||
incrStreamedLen(6);
|
incrStreamedLen(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ void ConstantPool::emitEntries(MCStreamer &Streamer) {
|
|||||||
for (const ConstantPoolEntry &Entry : Entries) {
|
for (const ConstantPoolEntry &Entry : Entries) {
|
||||||
Streamer.emitCodeAlignment(Entry.Size); // align naturally
|
Streamer.emitCodeAlignment(Entry.Size); // align naturally
|
||||||
Streamer.emitLabel(Entry.Label);
|
Streamer.emitLabel(Entry.Label);
|
||||||
Streamer.EmitValue(Entry.Value, Entry.Size, Entry.Loc);
|
Streamer.emitValue(Entry.Value, Entry.Size, Entry.Loc);
|
||||||
}
|
}
|
||||||
Streamer.emitDataRegion(MCDR_DataRegionEnd);
|
Streamer.emitDataRegion(MCDR_DataRegionEnd);
|
||||||
Entries.clear();
|
Entries.clear();
|
||||||
|
@ -194,9 +194,9 @@ public:
|
|||||||
|
|
||||||
void emitValueImpl(const MCExpr *Value, unsigned Size,
|
void emitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
SMLoc Loc = SMLoc()) override;
|
SMLoc Loc = SMLoc()) override;
|
||||||
void EmitIntValue(uint64_t Value, unsigned Size) override;
|
void emitIntValue(uint64_t Value, unsigned Size) override;
|
||||||
void EmitIntValueInHex(uint64_t Value, unsigned Size) override;
|
void emitIntValueInHex(uint64_t Value, unsigned Size) override;
|
||||||
void EmitIntValueInHexWithPadding(uint64_t Value, unsigned Size) override;
|
void emitIntValueInHexWithPadding(uint64_t Value, unsigned Size) override;
|
||||||
|
|
||||||
void emitULEB128Value(const MCExpr *Value) override;
|
void emitULEB128Value(const MCExpr *Value) override;
|
||||||
|
|
||||||
@ -966,17 +966,17 @@ void MCAsmStreamer::emitBinaryData(StringRef Data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
|
void MCAsmStreamer::emitIntValue(uint64_t Value, unsigned Size) {
|
||||||
EmitValue(MCConstantExpr::create(Value, getContext()), Size);
|
emitValue(MCConstantExpr::create(Value, getContext()), Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::EmitIntValueInHex(uint64_t Value, unsigned Size) {
|
void MCAsmStreamer::emitIntValueInHex(uint64_t Value, unsigned Size) {
|
||||||
EmitValue(MCConstantExpr::create(Value, getContext(), true), Size);
|
emitValue(MCConstantExpr::create(Value, getContext(), true), Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::EmitIntValueInHexWithPadding(uint64_t Value,
|
void MCAsmStreamer::emitIntValueInHexWithPadding(uint64_t Value,
|
||||||
unsigned Size) {
|
unsigned Size) {
|
||||||
EmitValue(MCConstantExpr::create(Value, getContext(), true, Size), Size);
|
emitValue(MCConstantExpr::create(Value, getContext(), true, Size), Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
|
void MCAsmStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
@ -1021,7 +1021,7 @@ void MCAsmStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
|
|||||||
std::numeric_limits<unsigned long long>::digits) &&
|
std::numeric_limits<unsigned long long>::digits) &&
|
||||||
"undefined behavior");
|
"undefined behavior");
|
||||||
ValueToEmit &= ~0ULL >> Shift;
|
ValueToEmit &= ~0ULL >> Shift;
|
||||||
EmitIntValue(ValueToEmit, EmissionSize);
|
emitIntValue(ValueToEmit, EmissionSize);
|
||||||
Emitted += EmissionSize;
|
Emitted += EmissionSize;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -172,7 +172,7 @@ void CodeViewContext::emitStringTable(MCObjectStreamer &OS) {
|
|||||||
MCSymbol *StringBegin = Ctx.createTempSymbol("strtab_begin", false),
|
MCSymbol *StringBegin = Ctx.createTempSymbol("strtab_begin", false),
|
||||||
*StringEnd = Ctx.createTempSymbol("strtab_end", false);
|
*StringEnd = Ctx.createTempSymbol("strtab_end", false);
|
||||||
|
|
||||||
OS.EmitIntValue(unsigned(DebugSubsectionKind::StringTable), 4);
|
OS.emitIntValue(unsigned(DebugSubsectionKind::StringTable), 4);
|
||||||
OS.emitAbsoluteSymbolDiff(StringEnd, StringBegin, 4);
|
OS.emitAbsoluteSymbolDiff(StringEnd, StringBegin, 4);
|
||||||
OS.emitLabel(StringBegin);
|
OS.emitLabel(StringBegin);
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
|
|||||||
MCSymbol *FileBegin = Ctx.createTempSymbol("filechecksums_begin", false),
|
MCSymbol *FileBegin = Ctx.createTempSymbol("filechecksums_begin", false),
|
||||||
*FileEnd = Ctx.createTempSymbol("filechecksums_end", false);
|
*FileEnd = Ctx.createTempSymbol("filechecksums_end", false);
|
||||||
|
|
||||||
OS.EmitIntValue(unsigned(DebugSubsectionKind::FileChecksums), 4);
|
OS.emitIntValue(unsigned(DebugSubsectionKind::FileChecksums), 4);
|
||||||
OS.emitAbsoluteSymbolDiff(FileEnd, FileBegin, 4);
|
OS.emitAbsoluteSymbolDiff(FileEnd, FileBegin, 4);
|
||||||
OS.emitLabel(FileBegin);
|
OS.emitLabel(FileBegin);
|
||||||
|
|
||||||
@ -221,16 +221,16 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
|
|||||||
CurrentOffset = alignTo(CurrentOffset, 4);
|
CurrentOffset = alignTo(CurrentOffset, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
OS.EmitIntValue(File.StringTableOffset, 4);
|
OS.emitIntValue(File.StringTableOffset, 4);
|
||||||
|
|
||||||
if (!File.ChecksumKind) {
|
if (!File.ChecksumKind) {
|
||||||
// There is no checksum. Therefore zero the next two fields and align
|
// There is no checksum. Therefore zero the next two fields and align
|
||||||
// back to 4 bytes.
|
// back to 4 bytes.
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
OS.EmitIntValue(static_cast<uint8_t>(File.Checksum.size()), 1);
|
OS.emitIntValue(static_cast<uint8_t>(File.Checksum.size()), 1);
|
||||||
OS.EmitIntValue(File.ChecksumKind, 1);
|
OS.emitIntValue(File.ChecksumKind, 1);
|
||||||
OS.emitBytes(toStringRef(File.Checksum));
|
OS.emitBytes(toStringRef(File.Checksum));
|
||||||
OS.emitValueToAlignment(4);
|
OS.emitValueToAlignment(4);
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
|
|||||||
MCSymbol *LineBegin = Ctx.createTempSymbol("linetable_begin", false),
|
MCSymbol *LineBegin = Ctx.createTempSymbol("linetable_begin", false),
|
||||||
*LineEnd = Ctx.createTempSymbol("linetable_end", false);
|
*LineEnd = Ctx.createTempSymbol("linetable_end", false);
|
||||||
|
|
||||||
OS.EmitIntValue(unsigned(DebugSubsectionKind::Lines), 4);
|
OS.emitIntValue(unsigned(DebugSubsectionKind::Lines), 4);
|
||||||
OS.emitAbsoluteSymbolDiff(LineEnd, LineBegin, 4);
|
OS.emitAbsoluteSymbolDiff(LineEnd, LineBegin, 4);
|
||||||
OS.emitLabel(LineBegin);
|
OS.emitLabel(LineBegin);
|
||||||
OS.EmitCOFFSecRel32(FuncBegin, /*Offset=*/0);
|
OS.EmitCOFFSecRel32(FuncBegin, /*Offset=*/0);
|
||||||
@ -342,7 +342,7 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
|
|||||||
bool HaveColumns = any_of(Locs, [](const MCCVLoc &LineEntry) {
|
bool HaveColumns = any_of(Locs, [](const MCCVLoc &LineEntry) {
|
||||||
return LineEntry.getColumn() != 0;
|
return LineEntry.getColumn() != 0;
|
||||||
});
|
});
|
||||||
OS.EmitIntValue(HaveColumns ? int(LF_HaveColumns) : 0, 2);
|
OS.emitIntValue(HaveColumns ? int(LF_HaveColumns) : 0, 2);
|
||||||
OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 4);
|
OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 4);
|
||||||
|
|
||||||
for (auto I = Locs.begin(), E = Locs.end(); I != E;) {
|
for (auto I = Locs.begin(), E = Locs.end(); I != E;) {
|
||||||
@ -359,24 +359,24 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
|
|||||||
->getContents()[Files[CurFileNum - 1].StringTableOffset]) +
|
->getContents()[Files[CurFileNum - 1].StringTableOffset]) +
|
||||||
"' begins");
|
"' begins");
|
||||||
OS.EmitCVFileChecksumOffsetDirective(CurFileNum);
|
OS.EmitCVFileChecksumOffsetDirective(CurFileNum);
|
||||||
OS.EmitIntValue(EntryCount, 4);
|
OS.emitIntValue(EntryCount, 4);
|
||||||
uint32_t SegmentSize = 12;
|
uint32_t SegmentSize = 12;
|
||||||
SegmentSize += 8 * EntryCount;
|
SegmentSize += 8 * EntryCount;
|
||||||
if (HaveColumns)
|
if (HaveColumns)
|
||||||
SegmentSize += 4 * EntryCount;
|
SegmentSize += 4 * EntryCount;
|
||||||
OS.EmitIntValue(SegmentSize, 4);
|
OS.emitIntValue(SegmentSize, 4);
|
||||||
|
|
||||||
for (auto J = I; J != FileSegEnd; ++J) {
|
for (auto J = I; J != FileSegEnd; ++J) {
|
||||||
OS.emitAbsoluteSymbolDiff(J->getLabel(), FuncBegin, 4);
|
OS.emitAbsoluteSymbolDiff(J->getLabel(), FuncBegin, 4);
|
||||||
unsigned LineData = J->getLine();
|
unsigned LineData = J->getLine();
|
||||||
if (J->isStmt())
|
if (J->isStmt())
|
||||||
LineData |= LineInfo::StatementFlag;
|
LineData |= LineInfo::StatementFlag;
|
||||||
OS.EmitIntValue(LineData, 4);
|
OS.emitIntValue(LineData, 4);
|
||||||
}
|
}
|
||||||
if (HaveColumns) {
|
if (HaveColumns) {
|
||||||
for (auto J = I; J != FileSegEnd; ++J) {
|
for (auto J = I; J != FileSegEnd; ++J) {
|
||||||
OS.EmitIntValue(J->getColumn(), 2);
|
OS.emitIntValue(J->getColumn(), 2);
|
||||||
OS.EmitIntValue(0, 2);
|
OS.emitIntValue(0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
I = FileSegEnd;
|
I = FileSegEnd;
|
||||||
|
@ -163,38 +163,38 @@ static inline void emitDwarfLineTable(
|
|||||||
|
|
||||||
if (FileNum != LineEntry.getFileNum()) {
|
if (FileNum != LineEntry.getFileNum()) {
|
||||||
FileNum = LineEntry.getFileNum();
|
FileNum = LineEntry.getFileNum();
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_set_file, 1);
|
||||||
MCOS->emitULEB128IntValue(FileNum);
|
MCOS->emitULEB128IntValue(FileNum);
|
||||||
}
|
}
|
||||||
if (Column != LineEntry.getColumn()) {
|
if (Column != LineEntry.getColumn()) {
|
||||||
Column = LineEntry.getColumn();
|
Column = LineEntry.getColumn();
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_column, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_set_column, 1);
|
||||||
MCOS->emitULEB128IntValue(Column);
|
MCOS->emitULEB128IntValue(Column);
|
||||||
}
|
}
|
||||||
if (Discriminator != LineEntry.getDiscriminator() &&
|
if (Discriminator != LineEntry.getDiscriminator() &&
|
||||||
MCOS->getContext().getDwarfVersion() >= 4) {
|
MCOS->getContext().getDwarfVersion() >= 4) {
|
||||||
Discriminator = LineEntry.getDiscriminator();
|
Discriminator = LineEntry.getDiscriminator();
|
||||||
unsigned Size = getULEB128Size(Discriminator);
|
unsigned Size = getULEB128Size(Discriminator);
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_extended_op, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_extended_op, 1);
|
||||||
MCOS->emitULEB128IntValue(Size + 1);
|
MCOS->emitULEB128IntValue(Size + 1);
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNE_set_discriminator, 1);
|
MCOS->emitIntValue(dwarf::DW_LNE_set_discriminator, 1);
|
||||||
MCOS->emitULEB128IntValue(Discriminator);
|
MCOS->emitULEB128IntValue(Discriminator);
|
||||||
}
|
}
|
||||||
if (Isa != LineEntry.getIsa()) {
|
if (Isa != LineEntry.getIsa()) {
|
||||||
Isa = LineEntry.getIsa();
|
Isa = LineEntry.getIsa();
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_isa, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_set_isa, 1);
|
||||||
MCOS->emitULEB128IntValue(Isa);
|
MCOS->emitULEB128IntValue(Isa);
|
||||||
}
|
}
|
||||||
if ((LineEntry.getFlags() ^ Flags) & DWARF2_FLAG_IS_STMT) {
|
if ((LineEntry.getFlags() ^ Flags) & DWARF2_FLAG_IS_STMT) {
|
||||||
Flags = LineEntry.getFlags();
|
Flags = LineEntry.getFlags();
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_negate_stmt, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_negate_stmt, 1);
|
||||||
}
|
}
|
||||||
if (LineEntry.getFlags() & DWARF2_FLAG_BASIC_BLOCK)
|
if (LineEntry.getFlags() & DWARF2_FLAG_BASIC_BLOCK)
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_basic_block, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_set_basic_block, 1);
|
||||||
if (LineEntry.getFlags() & DWARF2_FLAG_PROLOGUE_END)
|
if (LineEntry.getFlags() & DWARF2_FLAG_PROLOGUE_END)
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_prologue_end, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_set_prologue_end, 1);
|
||||||
if (LineEntry.getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
|
if (LineEntry.getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
|
||||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
|
MCOS->emitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
|
||||||
|
|
||||||
MCSymbol *Label = LineEntry.getLabel();
|
MCSymbol *Label = LineEntry.getLabel();
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ static const MCExpr *forceExpAbs(MCStreamer &OS, const MCExpr* Expr) {
|
|||||||
|
|
||||||
static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size) {
|
static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size) {
|
||||||
const MCExpr *ABS = forceExpAbs(OS, Value);
|
const MCExpr *ABS = forceExpAbs(OS, Value);
|
||||||
OS.EmitValue(ABS, Size);
|
OS.emitValue(ABS, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
|
void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
|
||||||
@ -324,9 +324,9 @@ void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) {
|
|||||||
size_t Offset = LineStrings.add(Path);
|
size_t Offset = LineStrings.add(Path);
|
||||||
if (UseRelocs) {
|
if (UseRelocs) {
|
||||||
MCContext &Ctx = MCOS->getContext();
|
MCContext &Ctx = MCOS->getContext();
|
||||||
MCOS->EmitValue(makeStartPlusIntExpr(Ctx, *LineStrLabel, Offset), RefSize);
|
MCOS->emitValue(makeStartPlusIntExpr(Ctx, *LineStrLabel, Offset), RefSize);
|
||||||
} else
|
} else
|
||||||
MCOS->EmitIntValue(Offset, RefSize);
|
MCOS->emitIntValue(Offset, RefSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
|
void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
|
||||||
@ -335,7 +335,7 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
|
|||||||
MCOS->emitBytes(Dir); // The DirectoryName, and...
|
MCOS->emitBytes(Dir); // The DirectoryName, and...
|
||||||
MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
|
MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
|
||||||
}
|
}
|
||||||
MCOS->EmitIntValue(0, 1); // Terminate the directory list.
|
MCOS->emitIntValue(0, 1); // Terminate the directory list.
|
||||||
|
|
||||||
// Second the file table.
|
// Second the file table.
|
||||||
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
|
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
|
||||||
@ -343,10 +343,10 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
|
|||||||
MCOS->emitBytes(MCDwarfFiles[i].Name); // FileName and...
|
MCOS->emitBytes(MCDwarfFiles[i].Name); // FileName and...
|
||||||
MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
|
MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
|
||||||
MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
|
MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
|
||||||
MCOS->EmitIntValue(0, 1); // Last modification timestamp (always 0).
|
MCOS->emitIntValue(0, 1); // Last modification timestamp (always 0).
|
||||||
MCOS->EmitIntValue(0, 1); // File size (always 0).
|
MCOS->emitIntValue(0, 1); // File size (always 0).
|
||||||
}
|
}
|
||||||
MCOS->EmitIntValue(0, 1); // Terminate the file list.
|
MCOS->emitIntValue(0, 1); // Terminate the file list.
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
|
static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
|
||||||
@ -382,7 +382,7 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
|
|||||||
// The directory format, which is just a list of the directory paths. In a
|
// The directory format, which is just a list of the directory paths. In a
|
||||||
// non-split object, these are references to .debug_line_str; in a split
|
// non-split object, these are references to .debug_line_str; in a split
|
||||||
// object, they are inline strings.
|
// object, they are inline strings.
|
||||||
MCOS->EmitIntValue(1, 1);
|
MCOS->emitIntValue(1, 1);
|
||||||
MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
|
MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
|
||||||
MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
|
MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
|
||||||
: dwarf::DW_FORM_string);
|
: dwarf::DW_FORM_string);
|
||||||
@ -414,7 +414,7 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
|
|||||||
Entries += 1;
|
Entries += 1;
|
||||||
if (HasSource)
|
if (HasSource)
|
||||||
Entries += 1;
|
Entries += 1;
|
||||||
MCOS->EmitIntValue(Entries, 1);
|
MCOS->emitIntValue(Entries, 1);
|
||||||
MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
|
MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
|
||||||
MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
|
MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
|
||||||
: dwarf::DW_FORM_string);
|
: dwarf::DW_FORM_string);
|
||||||
@ -467,7 +467,7 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
|||||||
|
|
||||||
// Next 2 bytes is the Version.
|
// Next 2 bytes is the Version.
|
||||||
unsigned LineTableVersion = context.getDwarfVersion();
|
unsigned LineTableVersion = context.getDwarfVersion();
|
||||||
MCOS->EmitIntValue(LineTableVersion, 2);
|
MCOS->emitIntValue(LineTableVersion, 2);
|
||||||
|
|
||||||
// Keep track of the bytes between the very start and where the header length
|
// Keep track of the bytes between the very start and where the header length
|
||||||
// comes out.
|
// comes out.
|
||||||
@ -475,8 +475,8 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
|||||||
|
|
||||||
// In v5, we get address info next.
|
// In v5, we get address info next.
|
||||||
if (LineTableVersion >= 5) {
|
if (LineTableVersion >= 5) {
|
||||||
MCOS->EmitIntValue(context.getAsmInfo()->getCodePointerSize(), 1);
|
MCOS->emitIntValue(context.getAsmInfo()->getCodePointerSize(), 1);
|
||||||
MCOS->EmitIntValue(0, 1); // Segment selector; same as EmitGenDwarfAranges.
|
MCOS->emitIntValue(0, 1); // Segment selector; same as EmitGenDwarfAranges.
|
||||||
PreHeaderLengthBytes += 2;
|
PreHeaderLengthBytes += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,20 +491,20 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
|||||||
4);
|
4);
|
||||||
|
|
||||||
// Parameters of the state machine, are next.
|
// Parameters of the state machine, are next.
|
||||||
MCOS->EmitIntValue(context.getAsmInfo()->getMinInstAlignment(), 1);
|
MCOS->emitIntValue(context.getAsmInfo()->getMinInstAlignment(), 1);
|
||||||
// maximum_operations_per_instruction
|
// maximum_operations_per_instruction
|
||||||
// For non-VLIW architectures this field is always 1.
|
// For non-VLIW architectures this field is always 1.
|
||||||
// FIXME: VLIW architectures need to update this field accordingly.
|
// FIXME: VLIW architectures need to update this field accordingly.
|
||||||
if (LineTableVersion >= 4)
|
if (LineTableVersion >= 4)
|
||||||
MCOS->EmitIntValue(1, 1);
|
MCOS->emitIntValue(1, 1);
|
||||||
MCOS->EmitIntValue(DWARF2_LINE_DEFAULT_IS_STMT, 1);
|
MCOS->emitIntValue(DWARF2_LINE_DEFAULT_IS_STMT, 1);
|
||||||
MCOS->EmitIntValue(Params.DWARF2LineBase, 1);
|
MCOS->emitIntValue(Params.DWARF2LineBase, 1);
|
||||||
MCOS->EmitIntValue(Params.DWARF2LineRange, 1);
|
MCOS->emitIntValue(Params.DWARF2LineRange, 1);
|
||||||
MCOS->EmitIntValue(StandardOpcodeLengths.size() + 1, 1);
|
MCOS->emitIntValue(StandardOpcodeLengths.size() + 1, 1);
|
||||||
|
|
||||||
// Standard opcode lengths
|
// Standard opcode lengths
|
||||||
for (char Length : StandardOpcodeLengths)
|
for (char Length : StandardOpcodeLengths)
|
||||||
MCOS->EmitIntValue(Length, 1);
|
MCOS->emitIntValue(Length, 1);
|
||||||
|
|
||||||
// Put out the directory and file tables. The formats vary depending on
|
// Put out the directory and file tables. The formats vary depending on
|
||||||
// the version.
|
// the version.
|
||||||
@ -803,7 +803,7 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
|
|||||||
// DW_TAG_compile_unit DIE abbrev (1).
|
// DW_TAG_compile_unit DIE abbrev (1).
|
||||||
MCOS->emitULEB128IntValue(1);
|
MCOS->emitULEB128IntValue(1);
|
||||||
MCOS->emitULEB128IntValue(dwarf::DW_TAG_compile_unit);
|
MCOS->emitULEB128IntValue(dwarf::DW_TAG_compile_unit);
|
||||||
MCOS->EmitIntValue(dwarf::DW_CHILDREN_yes, 1);
|
MCOS->emitIntValue(dwarf::DW_CHILDREN_yes, 1);
|
||||||
EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, context.getDwarfVersion() >= 4
|
EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, context.getDwarfVersion() >= 4
|
||||||
? dwarf::DW_FORM_sec_offset
|
? dwarf::DW_FORM_sec_offset
|
||||||
: dwarf::DW_FORM_data4);
|
: dwarf::DW_FORM_data4);
|
||||||
@ -829,7 +829,7 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
|
|||||||
// DW_TAG_label DIE abbrev (2).
|
// DW_TAG_label DIE abbrev (2).
|
||||||
MCOS->emitULEB128IntValue(2);
|
MCOS->emitULEB128IntValue(2);
|
||||||
MCOS->emitULEB128IntValue(dwarf::DW_TAG_label);
|
MCOS->emitULEB128IntValue(dwarf::DW_TAG_label);
|
||||||
MCOS->EmitIntValue(dwarf::DW_CHILDREN_yes, 1);
|
MCOS->emitIntValue(dwarf::DW_CHILDREN_yes, 1);
|
||||||
EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
|
EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
|
||||||
EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
|
EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
|
||||||
EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
|
EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
|
||||||
@ -840,11 +840,11 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
|
|||||||
// DW_TAG_unspecified_parameters DIE abbrev (3).
|
// DW_TAG_unspecified_parameters DIE abbrev (3).
|
||||||
MCOS->emitULEB128IntValue(3);
|
MCOS->emitULEB128IntValue(3);
|
||||||
MCOS->emitULEB128IntValue(dwarf::DW_TAG_unspecified_parameters);
|
MCOS->emitULEB128IntValue(dwarf::DW_TAG_unspecified_parameters);
|
||||||
MCOS->EmitIntValue(dwarf::DW_CHILDREN_no, 1);
|
MCOS->emitIntValue(dwarf::DW_CHILDREN_no, 1);
|
||||||
EmitAbbrev(MCOS, 0, 0);
|
EmitAbbrev(MCOS, 0, 0);
|
||||||
|
|
||||||
// Terminate the abbreviations for this compilation unit.
|
// Terminate the abbreviations for this compilation unit.
|
||||||
MCOS->EmitIntValue(0, 1);
|
MCOS->emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When generating dwarf for assembly source files this emits the data for
|
// When generating dwarf for assembly source files this emits the data for
|
||||||
@ -880,23 +880,23 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
|
|||||||
|
|
||||||
// Emit the header for this section.
|
// Emit the header for this section.
|
||||||
// The 4 byte length not including the 4 byte value for the length.
|
// The 4 byte length not including the 4 byte value for the length.
|
||||||
MCOS->EmitIntValue(Length - 4, 4);
|
MCOS->emitIntValue(Length - 4, 4);
|
||||||
// The 2 byte version, which is 2.
|
// The 2 byte version, which is 2.
|
||||||
MCOS->EmitIntValue(2, 2);
|
MCOS->emitIntValue(2, 2);
|
||||||
// The 4 byte offset to the compile unit in the .debug_info from the start
|
// The 4 byte offset to the compile unit in the .debug_info from the start
|
||||||
// of the .debug_info.
|
// of the .debug_info.
|
||||||
if (InfoSectionSymbol)
|
if (InfoSectionSymbol)
|
||||||
MCOS->emitSymbolValue(InfoSectionSymbol, 4,
|
MCOS->emitSymbolValue(InfoSectionSymbol, 4,
|
||||||
asmInfo->needsDwarfSectionOffsetDirective());
|
asmInfo->needsDwarfSectionOffsetDirective());
|
||||||
else
|
else
|
||||||
MCOS->EmitIntValue(0, 4);
|
MCOS->emitIntValue(0, 4);
|
||||||
// The 1 byte size of an address.
|
// The 1 byte size of an address.
|
||||||
MCOS->EmitIntValue(AddrSize, 1);
|
MCOS->emitIntValue(AddrSize, 1);
|
||||||
// The 1 byte size of a segment descriptor, we use a value of zero.
|
// The 1 byte size of a segment descriptor, we use a value of zero.
|
||||||
MCOS->EmitIntValue(0, 1);
|
MCOS->emitIntValue(0, 1);
|
||||||
// Align the header with the padding if needed, before we put out the table.
|
// Align the header with the padding if needed, before we put out the table.
|
||||||
for(int i = 0; i < Pad; i++)
|
for(int i = 0; i < Pad; i++)
|
||||||
MCOS->EmitIntValue(0, 1);
|
MCOS->emitIntValue(0, 1);
|
||||||
|
|
||||||
// Now emit the table of pairs of PointerSize'ed values for the section
|
// Now emit the table of pairs of PointerSize'ed values for the section
|
||||||
// addresses and sizes.
|
// addresses and sizes.
|
||||||
@ -910,13 +910,13 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
|
|||||||
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
||||||
const MCExpr *Size = MakeStartMinusEndExpr(*MCOS,
|
const MCExpr *Size = MakeStartMinusEndExpr(*MCOS,
|
||||||
*StartSymbol, *EndSymbol, 0);
|
*StartSymbol, *EndSymbol, 0);
|
||||||
MCOS->EmitValue(Addr, AddrSize);
|
MCOS->emitValue(Addr, AddrSize);
|
||||||
emitAbsValue(*MCOS, Size, AddrSize);
|
emitAbsValue(*MCOS, Size, AddrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// And finally the pair of terminating zeros.
|
// And finally the pair of terminating zeros.
|
||||||
MCOS->EmitIntValue(0, AddrSize);
|
MCOS->emitIntValue(0, AddrSize);
|
||||||
MCOS->EmitIntValue(0, AddrSize);
|
MCOS->emitIntValue(0, AddrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When generating dwarf for assembly source files this emits the data for
|
// When generating dwarf for assembly source files this emits the data for
|
||||||
@ -944,25 +944,25 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
emitAbsValue(*MCOS, Length, 4);
|
emitAbsValue(*MCOS, Length, 4);
|
||||||
|
|
||||||
// The 2 byte DWARF version.
|
// The 2 byte DWARF version.
|
||||||
MCOS->EmitIntValue(context.getDwarfVersion(), 2);
|
MCOS->emitIntValue(context.getDwarfVersion(), 2);
|
||||||
|
|
||||||
// The DWARF v5 header has unit type, address size, abbrev offset.
|
// The DWARF v5 header has unit type, address size, abbrev offset.
|
||||||
// Earlier versions have abbrev offset, address size.
|
// Earlier versions have abbrev offset, address size.
|
||||||
const MCAsmInfo &AsmInfo = *context.getAsmInfo();
|
const MCAsmInfo &AsmInfo = *context.getAsmInfo();
|
||||||
int AddrSize = AsmInfo.getCodePointerSize();
|
int AddrSize = AsmInfo.getCodePointerSize();
|
||||||
if (context.getDwarfVersion() >= 5) {
|
if (context.getDwarfVersion() >= 5) {
|
||||||
MCOS->EmitIntValue(dwarf::DW_UT_compile, 1);
|
MCOS->emitIntValue(dwarf::DW_UT_compile, 1);
|
||||||
MCOS->EmitIntValue(AddrSize, 1);
|
MCOS->emitIntValue(AddrSize, 1);
|
||||||
}
|
}
|
||||||
// The 4 byte offset to the debug abbrevs from the start of the .debug_abbrev,
|
// The 4 byte offset to the debug abbrevs from the start of the .debug_abbrev,
|
||||||
// it is at the start of that section so this is zero.
|
// it is at the start of that section so this is zero.
|
||||||
if (AbbrevSectionSymbol == nullptr)
|
if (AbbrevSectionSymbol == nullptr)
|
||||||
MCOS->EmitIntValue(0, 4);
|
MCOS->emitIntValue(0, 4);
|
||||||
else
|
else
|
||||||
MCOS->emitSymbolValue(AbbrevSectionSymbol, 4,
|
MCOS->emitSymbolValue(AbbrevSectionSymbol, 4,
|
||||||
AsmInfo.needsDwarfSectionOffsetDirective());
|
AsmInfo.needsDwarfSectionOffsetDirective());
|
||||||
if (context.getDwarfVersion() <= 4)
|
if (context.getDwarfVersion() <= 4)
|
||||||
MCOS->EmitIntValue(AddrSize, 1);
|
MCOS->emitIntValue(AddrSize, 1);
|
||||||
|
|
||||||
// Second part: the compile_unit DIE.
|
// Second part: the compile_unit DIE.
|
||||||
|
|
||||||
@ -975,7 +975,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
MCOS->emitSymbolValue(LineSectionSymbol, 4,
|
MCOS->emitSymbolValue(LineSectionSymbol, 4,
|
||||||
AsmInfo.needsDwarfSectionOffsetDirective());
|
AsmInfo.needsDwarfSectionOffsetDirective());
|
||||||
else
|
else
|
||||||
MCOS->EmitIntValue(0, 4);
|
MCOS->emitIntValue(0, 4);
|
||||||
|
|
||||||
if (RangesSectionSymbol) {
|
if (RangesSectionSymbol) {
|
||||||
// There are multiple sections containing code, so we must use the
|
// There are multiple sections containing code, so we must use the
|
||||||
@ -1001,12 +1001,12 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
// AT_low_pc, the first address of the default .text section.
|
// AT_low_pc, the first address of the default .text section.
|
||||||
const MCExpr *Start = MCSymbolRefExpr::create(
|
const MCExpr *Start = MCSymbolRefExpr::create(
|
||||||
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
||||||
MCOS->EmitValue(Start, AddrSize);
|
MCOS->emitValue(Start, AddrSize);
|
||||||
|
|
||||||
// AT_high_pc, the last address of the default .text section.
|
// AT_high_pc, the last address of the default .text section.
|
||||||
const MCExpr *End = MCSymbolRefExpr::create(
|
const MCExpr *End = MCSymbolRefExpr::create(
|
||||||
EndSymbol, MCSymbolRefExpr::VK_None, context);
|
EndSymbol, MCSymbolRefExpr::VK_None, context);
|
||||||
MCOS->EmitValue(End, AddrSize);
|
MCOS->emitValue(End, AddrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AT_name, the name of the source file. Reconstruct from the first directory
|
// AT_name, the name of the source file. Reconstruct from the first directory
|
||||||
@ -1025,19 +1025,19 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
? context.getMCDwarfLineTable(/*CUID=*/0).getRootFile()
|
? context.getMCDwarfLineTable(/*CUID=*/0).getRootFile()
|
||||||
: MCDwarfFiles[1];
|
: MCDwarfFiles[1];
|
||||||
MCOS->emitBytes(RootFile.Name);
|
MCOS->emitBytes(RootFile.Name);
|
||||||
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
|
||||||
|
|
||||||
// AT_comp_dir, the working directory the assembly was done in.
|
// AT_comp_dir, the working directory the assembly was done in.
|
||||||
if (!context.getCompilationDir().empty()) {
|
if (!context.getCompilationDir().empty()) {
|
||||||
MCOS->emitBytes(context.getCompilationDir());
|
MCOS->emitBytes(context.getCompilationDir());
|
||||||
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
|
||||||
}
|
}
|
||||||
|
|
||||||
// AT_APPLE_flags, the command line arguments of the assembler tool.
|
// AT_APPLE_flags, the command line arguments of the assembler tool.
|
||||||
StringRef DwarfDebugFlags = context.getDwarfDebugFlags();
|
StringRef DwarfDebugFlags = context.getDwarfDebugFlags();
|
||||||
if (!DwarfDebugFlags.empty()){
|
if (!DwarfDebugFlags.empty()){
|
||||||
MCOS->emitBytes(DwarfDebugFlags);
|
MCOS->emitBytes(DwarfDebugFlags);
|
||||||
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
|
||||||
}
|
}
|
||||||
|
|
||||||
// AT_producer, the version of the assembler tool.
|
// AT_producer, the version of the assembler tool.
|
||||||
@ -1046,11 +1046,11 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
MCOS->emitBytes(DwarfDebugProducer);
|
MCOS->emitBytes(DwarfDebugProducer);
|
||||||
else
|
else
|
||||||
MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
|
MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
|
||||||
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
|
||||||
|
|
||||||
// AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2
|
// AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2
|
||||||
// draft has no standard code for assembler.
|
// draft has no standard code for assembler.
|
||||||
MCOS->EmitIntValue(dwarf::DW_LANG_Mips_Assembler, 2);
|
MCOS->emitIntValue(dwarf::DW_LANG_Mips_Assembler, 2);
|
||||||
|
|
||||||
// Third part: the list of label DIEs.
|
// Third part: the list of label DIEs.
|
||||||
|
|
||||||
@ -1063,31 +1063,31 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
|
|
||||||
// AT_name, of the label without any leading underbar.
|
// AT_name, of the label without any leading underbar.
|
||||||
MCOS->emitBytes(Entry.getName());
|
MCOS->emitBytes(Entry.getName());
|
||||||
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
|
||||||
|
|
||||||
// AT_decl_file, index into the file table.
|
// AT_decl_file, index into the file table.
|
||||||
MCOS->EmitIntValue(Entry.getFileNumber(), 4);
|
MCOS->emitIntValue(Entry.getFileNumber(), 4);
|
||||||
|
|
||||||
// AT_decl_line, source line number.
|
// AT_decl_line, source line number.
|
||||||
MCOS->EmitIntValue(Entry.getLineNumber(), 4);
|
MCOS->emitIntValue(Entry.getLineNumber(), 4);
|
||||||
|
|
||||||
// AT_low_pc, start address of the label.
|
// AT_low_pc, start address of the label.
|
||||||
const MCExpr *AT_low_pc = MCSymbolRefExpr::create(Entry.getLabel(),
|
const MCExpr *AT_low_pc = MCSymbolRefExpr::create(Entry.getLabel(),
|
||||||
MCSymbolRefExpr::VK_None, context);
|
MCSymbolRefExpr::VK_None, context);
|
||||||
MCOS->EmitValue(AT_low_pc, AddrSize);
|
MCOS->emitValue(AT_low_pc, AddrSize);
|
||||||
|
|
||||||
// DW_AT_prototyped, a one byte flag value of 0 saying we have no prototype.
|
// DW_AT_prototyped, a one byte flag value of 0 saying we have no prototype.
|
||||||
MCOS->EmitIntValue(0, 1);
|
MCOS->emitIntValue(0, 1);
|
||||||
|
|
||||||
// The DW_TAG_unspecified_parameters DIE abbrev (3).
|
// The DW_TAG_unspecified_parameters DIE abbrev (3).
|
||||||
MCOS->emitULEB128IntValue(3);
|
MCOS->emitULEB128IntValue(3);
|
||||||
|
|
||||||
// Add the NULL DIE terminating the DW_TAG_unspecified_parameters DIE's.
|
// Add the NULL DIE terminating the DW_TAG_unspecified_parameters DIE's.
|
||||||
MCOS->EmitIntValue(0, 1);
|
MCOS->emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the NULL DIE terminating the Compile Unit DIE's.
|
// Add the NULL DIE terminating the Compile Unit DIE's.
|
||||||
MCOS->EmitIntValue(0, 1);
|
MCOS->emitIntValue(0, 1);
|
||||||
|
|
||||||
// Now set the value of the symbol at the end of the info section.
|
// Now set the value of the symbol at the end of the info section.
|
||||||
MCOS->emitLabel(InfoEnd);
|
MCOS->emitLabel(InfoEnd);
|
||||||
@ -1115,18 +1115,18 @@ static void EmitGenDwarfRanges(MCStreamer *MCOS) {
|
|||||||
const MCExpr *SectionStartAddr = MCSymbolRefExpr::create(
|
const MCExpr *SectionStartAddr = MCSymbolRefExpr::create(
|
||||||
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
||||||
MCOS->emitFill(AddrSize, 0xFF);
|
MCOS->emitFill(AddrSize, 0xFF);
|
||||||
MCOS->EmitValue(SectionStartAddr, AddrSize);
|
MCOS->emitValue(SectionStartAddr, AddrSize);
|
||||||
|
|
||||||
// Emit a range list entry spanning this section
|
// Emit a range list entry spanning this section
|
||||||
const MCExpr *SectionSize = MakeStartMinusEndExpr(*MCOS,
|
const MCExpr *SectionSize = MakeStartMinusEndExpr(*MCOS,
|
||||||
*StartSymbol, *EndSymbol, 0);
|
*StartSymbol, *EndSymbol, 0);
|
||||||
MCOS->EmitIntValue(0, AddrSize);
|
MCOS->emitIntValue(0, AddrSize);
|
||||||
emitAbsValue(*MCOS, SectionSize, AddrSize);
|
emitAbsValue(*MCOS, SectionSize, AddrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit end of list entry
|
// Emit end of list entry
|
||||||
MCOS->EmitIntValue(0, AddrSize);
|
MCOS->emitIntValue(0, AddrSize);
|
||||||
MCOS->EmitIntValue(0, AddrSize);
|
MCOS->emitIntValue(0, AddrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1283,7 +1283,7 @@ static void emitFDESymbol(MCObjectStreamer &streamer, const MCSymbol &symbol,
|
|||||||
if (asmInfo->doDwarfFDESymbolsUseAbsDiff() && isEH)
|
if (asmInfo->doDwarfFDESymbolsUseAbsDiff() && isEH)
|
||||||
emitAbsValue(streamer, v, size);
|
emitAbsValue(streamer, v, size);
|
||||||
else
|
else
|
||||||
streamer.EmitValue(v, size);
|
streamer.emitValue(v, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
|
static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
|
||||||
@ -1294,7 +1294,7 @@ static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
|
|||||||
symbolEncoding,
|
symbolEncoding,
|
||||||
streamer);
|
streamer);
|
||||||
unsigned size = getSizeForEncoding(streamer, symbolEncoding);
|
unsigned size = getSizeForEncoding(streamer, symbolEncoding);
|
||||||
streamer.EmitValue(v, size);
|
streamer.emitValue(v, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -1323,7 +1323,7 @@ public:
|
|||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
static void emitEncodingByte(MCObjectStreamer &Streamer, unsigned Encoding) {
|
static void emitEncodingByte(MCObjectStreamer &Streamer, unsigned Encoding) {
|
||||||
Streamer.EmitIntValue(Encoding, 1);
|
Streamer.emitIntValue(Encoding, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
||||||
@ -1338,22 +1338,22 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
|||||||
Reg1 = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg1);
|
Reg1 = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg1);
|
||||||
Reg2 = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg2);
|
Reg2 = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg2);
|
||||||
}
|
}
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_register, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_register, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg1);
|
Streamer.emitULEB128IntValue(Reg1);
|
||||||
Streamer.emitULEB128IntValue(Reg2);
|
Streamer.emitULEB128IntValue(Reg2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case MCCFIInstruction::OpWindowSave:
|
case MCCFIInstruction::OpWindowSave:
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_GNU_window_save, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_GNU_window_save, 1);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MCCFIInstruction::OpNegateRAState:
|
case MCCFIInstruction::OpNegateRAState:
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_AARCH64_negate_ra_state, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_AARCH64_negate_ra_state, 1);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MCCFIInstruction::OpUndefined: {
|
case MCCFIInstruction::OpUndefined: {
|
||||||
unsigned Reg = Instr.getRegister();
|
unsigned Reg = Instr.getRegister();
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_undefined, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_undefined, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1362,7 +1362,7 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
|||||||
const bool IsRelative =
|
const bool IsRelative =
|
||||||
Instr.getOperation() == MCCFIInstruction::OpAdjustCfaOffset;
|
Instr.getOperation() == MCCFIInstruction::OpAdjustCfaOffset;
|
||||||
|
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_offset, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_def_cfa_offset, 1);
|
||||||
|
|
||||||
if (IsRelative)
|
if (IsRelative)
|
||||||
CFAOffset += Instr.getOffset();
|
CFAOffset += Instr.getOffset();
|
||||||
@ -1377,7 +1377,7 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
|||||||
unsigned Reg = Instr.getRegister();
|
unsigned Reg = Instr.getRegister();
|
||||||
if (!IsEH)
|
if (!IsEH)
|
||||||
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
|
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_def_cfa, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
CFAOffset = -Instr.getOffset();
|
CFAOffset = -Instr.getOffset();
|
||||||
Streamer.emitULEB128IntValue(CFAOffset);
|
Streamer.emitULEB128IntValue(CFAOffset);
|
||||||
@ -1388,7 +1388,7 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
|||||||
unsigned Reg = Instr.getRegister();
|
unsigned Reg = Instr.getRegister();
|
||||||
if (!IsEH)
|
if (!IsEH)
|
||||||
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
|
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_register, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_def_cfa_register, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -1408,28 +1408,28 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
|||||||
Offset = Offset / dataAlignmentFactor;
|
Offset = Offset / dataAlignmentFactor;
|
||||||
|
|
||||||
if (Offset < 0) {
|
if (Offset < 0) {
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_offset_extended_sf, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_offset_extended_sf, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
Streamer.emitSLEB128IntValue(Offset);
|
Streamer.emitSLEB128IntValue(Offset);
|
||||||
} else if (Reg < 64) {
|
} else if (Reg < 64) {
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_offset + Reg, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_offset + Reg, 1);
|
||||||
Streamer.emitULEB128IntValue(Offset);
|
Streamer.emitULEB128IntValue(Offset);
|
||||||
} else {
|
} else {
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_offset_extended, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_offset_extended, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
Streamer.emitULEB128IntValue(Offset);
|
Streamer.emitULEB128IntValue(Offset);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case MCCFIInstruction::OpRememberState:
|
case MCCFIInstruction::OpRememberState:
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_remember_state, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_remember_state, 1);
|
||||||
return;
|
return;
|
||||||
case MCCFIInstruction::OpRestoreState:
|
case MCCFIInstruction::OpRestoreState:
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_restore_state, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_restore_state, 1);
|
||||||
return;
|
return;
|
||||||
case MCCFIInstruction::OpSameValue: {
|
case MCCFIInstruction::OpSameValue: {
|
||||||
unsigned Reg = Instr.getRegister();
|
unsigned Reg = Instr.getRegister();
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_same_value, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_same_value, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1438,15 +1438,15 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
|
|||||||
if (!IsEH)
|
if (!IsEH)
|
||||||
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
|
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
|
||||||
if (Reg < 64) {
|
if (Reg < 64) {
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_restore | Reg, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_restore | Reg, 1);
|
||||||
} else {
|
} else {
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_restore_extended, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_restore_extended, 1);
|
||||||
Streamer.emitULEB128IntValue(Reg);
|
Streamer.emitULEB128IntValue(Reg);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case MCCFIInstruction::OpGnuArgsSize:
|
case MCCFIInstruction::OpGnuArgsSize:
|
||||||
Streamer.EmitIntValue(dwarf::DW_CFA_GNU_args_size, 1);
|
Streamer.emitIntValue(dwarf::DW_CFA_GNU_args_size, 1);
|
||||||
Streamer.emitULEB128IntValue(Instr.getOffset());
|
Streamer.emitULEB128IntValue(Instr.getOffset());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1525,21 +1525,21 @@ void FrameEmitterImpl::EmitCompactUnwind(const MCDwarfFrameInfo &Frame) {
|
|||||||
|
|
||||||
// Compact Encoding
|
// Compact Encoding
|
||||||
Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_udata4);
|
Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_udata4);
|
||||||
Streamer.EmitIntValue(Encoding, Size);
|
Streamer.emitIntValue(Encoding, Size);
|
||||||
|
|
||||||
// Personality Function
|
// Personality Function
|
||||||
Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_absptr);
|
Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_absptr);
|
||||||
if (!DwarfEHFrameOnly && Frame.Personality)
|
if (!DwarfEHFrameOnly && Frame.Personality)
|
||||||
Streamer.emitSymbolValue(Frame.Personality, Size);
|
Streamer.emitSymbolValue(Frame.Personality, Size);
|
||||||
else
|
else
|
||||||
Streamer.EmitIntValue(0, Size); // No personality fn
|
Streamer.emitIntValue(0, Size); // No personality fn
|
||||||
|
|
||||||
// LSDA
|
// LSDA
|
||||||
Size = getSizeForEncoding(Streamer, Frame.LsdaEncoding);
|
Size = getSizeForEncoding(Streamer, Frame.LsdaEncoding);
|
||||||
if (!DwarfEHFrameOnly && Frame.Lsda)
|
if (!DwarfEHFrameOnly && Frame.Lsda)
|
||||||
Streamer.emitSymbolValue(Frame.Lsda, Size);
|
Streamer.emitSymbolValue(Frame.Lsda, Size);
|
||||||
else
|
else
|
||||||
Streamer.EmitIntValue(0, Size); // No LSDA
|
Streamer.emitIntValue(0, Size); // No LSDA
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned getCIEVersion(bool IsEH, unsigned DwarfVersion) {
|
static unsigned getCIEVersion(bool IsEH, unsigned DwarfVersion) {
|
||||||
@ -1574,11 +1574,11 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
|
|||||||
|
|
||||||
// CIE ID
|
// CIE ID
|
||||||
unsigned CIE_ID = IsEH ? 0 : -1;
|
unsigned CIE_ID = IsEH ? 0 : -1;
|
||||||
Streamer.EmitIntValue(CIE_ID, 4);
|
Streamer.emitIntValue(CIE_ID, 4);
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
uint8_t CIEVersion = getCIEVersion(IsEH, context.getDwarfVersion());
|
uint8_t CIEVersion = getCIEVersion(IsEH, context.getDwarfVersion());
|
||||||
Streamer.EmitIntValue(CIEVersion, 1);
|
Streamer.emitIntValue(CIEVersion, 1);
|
||||||
|
|
||||||
if (IsEH) {
|
if (IsEH) {
|
||||||
SmallString<8> Augmentation;
|
SmallString<8> Augmentation;
|
||||||
@ -1594,14 +1594,14 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
|
|||||||
Augmentation += "B";
|
Augmentation += "B";
|
||||||
Streamer.emitBytes(Augmentation);
|
Streamer.emitBytes(Augmentation);
|
||||||
}
|
}
|
||||||
Streamer.EmitIntValue(0, 1);
|
Streamer.emitIntValue(0, 1);
|
||||||
|
|
||||||
if (CIEVersion >= 4) {
|
if (CIEVersion >= 4) {
|
||||||
// Address Size
|
// Address Size
|
||||||
Streamer.EmitIntValue(context.getAsmInfo()->getCodePointerSize(), 1);
|
Streamer.emitIntValue(context.getAsmInfo()->getCodePointerSize(), 1);
|
||||||
|
|
||||||
// Segment Descriptor Size
|
// Segment Descriptor Size
|
||||||
Streamer.EmitIntValue(0, 1);
|
Streamer.emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code Alignment Factor
|
// Code Alignment Factor
|
||||||
@ -1618,7 +1618,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
|
|||||||
if (CIEVersion == 1) {
|
if (CIEVersion == 1) {
|
||||||
assert(RAReg <= 255 &&
|
assert(RAReg <= 255 &&
|
||||||
"DWARF 2 encodes return_address_register in one byte");
|
"DWARF 2 encodes return_address_register in one byte");
|
||||||
Streamer.EmitIntValue(RAReg, 1);
|
Streamer.emitIntValue(RAReg, 1);
|
||||||
} else {
|
} else {
|
||||||
Streamer.emitULEB128IntValue(RAReg);
|
Streamer.emitULEB128IntValue(RAReg);
|
||||||
}
|
}
|
||||||
|
@ -368,11 +368,11 @@ void MCELFStreamer::EmitIdent(StringRef IdentString) {
|
|||||||
PushSection();
|
PushSection();
|
||||||
SwitchSection(Comment);
|
SwitchSection(Comment);
|
||||||
if (!SeenIdent) {
|
if (!SeenIdent) {
|
||||||
EmitIntValue(0, 1);
|
emitIntValue(0, 1);
|
||||||
SeenIdent = true;
|
SeenIdent = true;
|
||||||
}
|
}
|
||||||
emitBytes(IdentString);
|
emitBytes(IdentString);
|
||||||
EmitIntValue(0, 1);
|
emitIntValue(0, 1);
|
||||||
PopSection();
|
PopSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi,
|
|||||||
const MCSymbol *Lo,
|
const MCSymbol *Lo,
|
||||||
unsigned Size) {
|
unsigned Size) {
|
||||||
if (Optional<uint64_t> Diff = absoluteSymbolDiff(getAssembler(), Hi, Lo)) {
|
if (Optional<uint64_t> Diff = absoluteSymbolDiff(getAssembler(), Hi, Lo)) {
|
||||||
EmitIntValue(*Diff, Size);
|
emitIntValue(*Diff, Size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MCStreamer::emitAbsoluteSymbolDiff(Hi, Lo, Size);
|
MCStreamer::emitAbsoluteSymbolDiff(Hi, Lo, Size);
|
||||||
@ -241,7 +241,7 @@ void MCObjectStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
|
|||||||
Loc, "value evaluated as " + Twine(AbsValue) + " is out of range.");
|
Loc, "value evaluated as " + Twine(AbsValue) + " is out of range.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EmitIntValue(AbsValue, Size);
|
emitIntValue(AbsValue, Size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DF->getFixups().push_back(
|
DF->getFixups().push_back(
|
||||||
@ -472,9 +472,9 @@ static void emitDwarfSetLineAddr(MCObjectStreamer &OS,
|
|||||||
int64_t LineDelta, const MCSymbol *Label,
|
int64_t LineDelta, const MCSymbol *Label,
|
||||||
int PointerSize) {
|
int PointerSize) {
|
||||||
// emit the sequence to set the address
|
// emit the sequence to set the address
|
||||||
OS.EmitIntValue(dwarf::DW_LNS_extended_op, 1);
|
OS.emitIntValue(dwarf::DW_LNS_extended_op, 1);
|
||||||
OS.emitULEB128IntValue(PointerSize + 1);
|
OS.emitULEB128IntValue(PointerSize + 1);
|
||||||
OS.EmitIntValue(dwarf::DW_LNE_set_address, 1);
|
OS.emitIntValue(dwarf::DW_LNE_set_address, 1);
|
||||||
OS.emitSymbolValue(Label, PointerSize);
|
OS.emitSymbolValue(Label, PointerSize);
|
||||||
|
|
||||||
// emit the sequence for the LineDelta (from 1) and a zero address delta.
|
// emit the sequence for the LineDelta (from 1) and a zero address delta.
|
||||||
@ -723,9 +723,9 @@ void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
|
|||||||
int64_t NonZeroSize = Size > 4 ? 4 : Size;
|
int64_t NonZeroSize = Size > 4 ? 4 : Size;
|
||||||
Expr &= ~0ULL >> (64 - NonZeroSize * 8);
|
Expr &= ~0ULL >> (64 - NonZeroSize * 8);
|
||||||
for (uint64_t i = 0, e = IntNumValues; i != e; ++i) {
|
for (uint64_t i = 0, e = IntNumValues; i != e; ++i) {
|
||||||
EmitIntValue(Expr, NonZeroSize);
|
emitIntValue(Expr, NonZeroSize);
|
||||||
if (NonZeroSize < Size)
|
if (NonZeroSize < Size)
|
||||||
EmitIntValue(0, Size - NonZeroSize);
|
emitIntValue(0, Size - NonZeroSize);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3049,9 +3049,9 @@ bool AsmParser::parseDirectiveValue(StringRef IDVal, unsigned Size) {
|
|||||||
uint64_t IntValue = MCE->getValue();
|
uint64_t IntValue = MCE->getValue();
|
||||||
if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
|
if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
|
||||||
return Error(ExprLoc, "out of range literal value");
|
return Error(ExprLoc, "out of range literal value");
|
||||||
getStreamer().EmitIntValue(IntValue, Size);
|
getStreamer().emitIntValue(IntValue, Size);
|
||||||
} else
|
} else
|
||||||
getStreamer().EmitValue(Value, Size, ExprLoc);
|
getStreamer().emitValue(Value, Size, ExprLoc);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3090,11 +3090,11 @@ bool AsmParser::parseDirectiveOctaValue(StringRef IDVal) {
|
|||||||
if (parseHexOcta(*this, hi, lo))
|
if (parseHexOcta(*this, hi, lo))
|
||||||
return true;
|
return true;
|
||||||
if (MAI.isLittleEndian()) {
|
if (MAI.isLittleEndian()) {
|
||||||
getStreamer().EmitIntValue(lo, 8);
|
getStreamer().emitIntValue(lo, 8);
|
||||||
getStreamer().EmitIntValue(hi, 8);
|
getStreamer().emitIntValue(hi, 8);
|
||||||
} else {
|
} else {
|
||||||
getStreamer().EmitIntValue(hi, 8);
|
getStreamer().emitIntValue(hi, 8);
|
||||||
getStreamer().EmitIntValue(lo, 8);
|
getStreamer().emitIntValue(lo, 8);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -3153,7 +3153,7 @@ bool AsmParser::parseDirectiveRealValue(StringRef IDVal,
|
|||||||
APInt AsInt;
|
APInt AsInt;
|
||||||
if (checkForValidSection() || parseRealValue(Semantics, AsInt))
|
if (checkForValidSection() || parseRealValue(Semantics, AsInt))
|
||||||
return true;
|
return true;
|
||||||
getStreamer().EmitIntValue(AsInt.getLimitedValue(),
|
getStreamer().emitIntValue(AsInt.getLimitedValue(),
|
||||||
AsInt.getBitWidth() / 8);
|
AsInt.getBitWidth() / 8);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -3979,7 +3979,7 @@ bool AsmParser::parseDirectiveCVString() {
|
|||||||
// Put the string in the table and emit the offset.
|
// Put the string in the table and emit the offset.
|
||||||
std::pair<StringRef, unsigned> Insertion =
|
std::pair<StringRef, unsigned> Insertion =
|
||||||
getCVContext().addToStringTable(Data);
|
getCVContext().addToStringTable(Data);
|
||||||
getStreamer().EmitIntValue(Insertion.second, 4);
|
getStreamer().emitIntValue(Insertion.second, 4);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4752,10 +4752,10 @@ bool AsmParser::parseDirectiveDCB(StringRef IDVal, unsigned Size) {
|
|||||||
if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
|
if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
|
||||||
return Error(ExprLoc, "literal value out of range for directive");
|
return Error(ExprLoc, "literal value out of range for directive");
|
||||||
for (uint64_t i = 0, e = NumValues; i != e; ++i)
|
for (uint64_t i = 0, e = NumValues; i != e; ++i)
|
||||||
getStreamer().EmitIntValue(IntValue, Size);
|
getStreamer().emitIntValue(IntValue, Size);
|
||||||
} else {
|
} else {
|
||||||
for (uint64_t i = 0, e = NumValues; i != e; ++i)
|
for (uint64_t i = 0, e = NumValues; i != e; ++i)
|
||||||
getStreamer().EmitValue(Value, Size, ExprLoc);
|
getStreamer().emitValue(Value, Size, ExprLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseToken(AsmToken::EndOfStatement,
|
if (parseToken(AsmToken::EndOfStatement,
|
||||||
@ -4791,7 +4791,7 @@ bool AsmParser::parseDirectiveRealDCB(StringRef IDVal, const fltSemantics &Seman
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (uint64_t i = 0, e = NumValues; i != e; ++i)
|
for (uint64_t i = 0, e = NumValues; i != e; ++i)
|
||||||
getStreamer().EmitIntValue(AsInt.getLimitedValue(),
|
getStreamer().emitIntValue(AsInt.getLimitedValue(),
|
||||||
AsInt.getBitWidth() / 8);
|
AsInt.getBitWidth() / 8);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -797,11 +797,11 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
|
|||||||
|
|
||||||
getStreamer().PushSection();
|
getStreamer().PushSection();
|
||||||
getStreamer().SwitchSection(Note);
|
getStreamer().SwitchSection(Note);
|
||||||
getStreamer().EmitIntValue(Data.size()+1, 4); // namesz.
|
getStreamer().emitIntValue(Data.size()+1, 4); // namesz.
|
||||||
getStreamer().EmitIntValue(0, 4); // descsz = 0 (no description).
|
getStreamer().emitIntValue(0, 4); // descsz = 0 (no description).
|
||||||
getStreamer().EmitIntValue(1, 4); // type = NT_VERSION.
|
getStreamer().emitIntValue(1, 4); // type = NT_VERSION.
|
||||||
getStreamer().emitBytes(Data); // name.
|
getStreamer().emitBytes(Data); // name.
|
||||||
getStreamer().EmitIntValue(0, 1); // terminate the string.
|
getStreamer().emitIntValue(0, 1); // terminate the string.
|
||||||
getStreamer().emitValueToAlignment(4); // ensure 4 byte alignment.
|
getStreamer().emitValueToAlignment(4); // ensure 4 byte alignment.
|
||||||
getStreamer().PopSection();
|
getStreamer().PopSection();
|
||||||
return false;
|
return false;
|
||||||
|
@ -128,7 +128,7 @@ void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend *MAB) {
|
|||||||
|
|
||||||
/// EmitIntValue - Special case of EmitValue that avoids the client having to
|
/// EmitIntValue - Special case of EmitValue that avoids the client having to
|
||||||
/// pass in a MCExpr for constant integers.
|
/// pass in a MCExpr for constant integers.
|
||||||
void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
|
void MCStreamer::emitIntValue(uint64_t Value, unsigned Size) {
|
||||||
assert(1 <= Size && Size <= 8 && "Invalid size");
|
assert(1 <= Size && Size <= 8 && "Invalid size");
|
||||||
assert((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) &&
|
assert((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) &&
|
||||||
"Invalid size");
|
"Invalid size");
|
||||||
@ -159,7 +159,7 @@ void MCStreamer::emitSLEB128IntValue(int64_t Value) {
|
|||||||
emitBytes(OSE.str());
|
emitBytes(OSE.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc) {
|
void MCStreamer::emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc) {
|
||||||
emitValueImpl(Value, Size, Loc);
|
emitValueImpl(Value, Size, Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,7 +1027,7 @@ void MCStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
|
|||||||
|
|
||||||
const MCAsmInfo *MAI = Context.getAsmInfo();
|
const MCAsmInfo *MAI = Context.getAsmInfo();
|
||||||
if (!MAI->doesSetDirectiveSuppressReloc()) {
|
if (!MAI->doesSetDirectiveSuppressReloc()) {
|
||||||
EmitValue(Diff, Size);
|
emitValue(Diff, Size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ static void EmitAbsDifference(MCStreamer &Streamer, const MCSymbol *LHS,
|
|||||||
const MCExpr *Diff =
|
const MCExpr *Diff =
|
||||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(LHS, Context),
|
MCBinaryExpr::createSub(MCSymbolRefExpr::create(LHS, Context),
|
||||||
MCSymbolRefExpr::create(RHS, Context), Context);
|
MCSymbolRefExpr::create(RHS, Context), Context);
|
||||||
Streamer.EmitValue(Diff, 1);
|
Streamer.emitValue(Diff, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin,
|
static void EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin,
|
||||||
@ -69,59 +69,59 @@ static void EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin,
|
|||||||
case Win64EH::UOP_PushNonVol:
|
case Win64EH::UOP_PushNonVol:
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
b2 |= (inst.Register & 0x0F) << 4;
|
b2 |= (inst.Register & 0x0F) << 4;
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_AllocLarge:
|
case Win64EH::UOP_AllocLarge:
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
if (inst.Offset > 512 * 1024 - 8) {
|
if (inst.Offset > 512 * 1024 - 8) {
|
||||||
b2 |= 0x10;
|
b2 |= 0x10;
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
w = inst.Offset & 0xFFF8;
|
w = inst.Offset & 0xFFF8;
|
||||||
streamer.EmitIntValue(w, 2);
|
streamer.emitIntValue(w, 2);
|
||||||
w = inst.Offset >> 16;
|
w = inst.Offset >> 16;
|
||||||
} else {
|
} else {
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
w = inst.Offset >> 3;
|
w = inst.Offset >> 3;
|
||||||
}
|
}
|
||||||
streamer.EmitIntValue(w, 2);
|
streamer.emitIntValue(w, 2);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_AllocSmall:
|
case Win64EH::UOP_AllocSmall:
|
||||||
b2 |= (((inst.Offset - 8) >> 3) & 0x0F) << 4;
|
b2 |= (((inst.Offset - 8) >> 3) & 0x0F) << 4;
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SetFPReg:
|
case Win64EH::UOP_SetFPReg:
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveNonVol:
|
case Win64EH::UOP_SaveNonVol:
|
||||||
case Win64EH::UOP_SaveXMM128:
|
case Win64EH::UOP_SaveXMM128:
|
||||||
b2 |= (inst.Register & 0x0F) << 4;
|
b2 |= (inst.Register & 0x0F) << 4;
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
w = inst.Offset >> 3;
|
w = inst.Offset >> 3;
|
||||||
if (inst.Operation == Win64EH::UOP_SaveXMM128)
|
if (inst.Operation == Win64EH::UOP_SaveXMM128)
|
||||||
w >>= 1;
|
w >>= 1;
|
||||||
streamer.EmitIntValue(w, 2);
|
streamer.emitIntValue(w, 2);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveNonVolBig:
|
case Win64EH::UOP_SaveNonVolBig:
|
||||||
case Win64EH::UOP_SaveXMM128Big:
|
case Win64EH::UOP_SaveXMM128Big:
|
||||||
b2 |= (inst.Register & 0x0F) << 4;
|
b2 |= (inst.Register & 0x0F) << 4;
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
if (inst.Operation == Win64EH::UOP_SaveXMM128Big)
|
if (inst.Operation == Win64EH::UOP_SaveXMM128Big)
|
||||||
w = inst.Offset & 0xFFF0;
|
w = inst.Offset & 0xFFF0;
|
||||||
else
|
else
|
||||||
w = inst.Offset & 0xFFF8;
|
w = inst.Offset & 0xFFF8;
|
||||||
streamer.EmitIntValue(w, 2);
|
streamer.emitIntValue(w, 2);
|
||||||
w = inst.Offset >> 16;
|
w = inst.Offset >> 16;
|
||||||
streamer.EmitIntValue(w, 2);
|
streamer.emitIntValue(w, 2);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_PushMachFrame:
|
case Win64EH::UOP_PushMachFrame:
|
||||||
if (inst.Offset == 1)
|
if (inst.Offset == 1)
|
||||||
b2 |= 0x10;
|
b2 |= 0x10;
|
||||||
EmitAbsDifference(streamer, inst.Label, begin);
|
EmitAbsDifference(streamer, inst.Label, begin);
|
||||||
streamer.EmitIntValue(b2, 1);
|
streamer.emitIntValue(b2, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ static void EmitSymbolRefWithOfs(MCStreamer &streamer,
|
|||||||
const MCSymbolRefExpr *BaseRefRel = MCSymbolRefExpr::create(Base,
|
const MCSymbolRefExpr *BaseRefRel = MCSymbolRefExpr::create(Base,
|
||||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||||
Context);
|
Context);
|
||||||
streamer.EmitValue(MCBinaryExpr::createAdd(BaseRefRel, Ofs, Context), 4);
|
streamer.emitValue(MCBinaryExpr::createAdd(BaseRefRel, Ofs, Context), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EmitRuntimeFunction(MCStreamer &streamer,
|
static void EmitRuntimeFunction(MCStreamer &streamer,
|
||||||
@ -146,7 +146,7 @@ static void EmitRuntimeFunction(MCStreamer &streamer,
|
|||||||
streamer.emitValueToAlignment(4);
|
streamer.emitValueToAlignment(4);
|
||||||
EmitSymbolRefWithOfs(streamer, info->Function, info->Begin);
|
EmitSymbolRefWithOfs(streamer, info->Function, info->Begin);
|
||||||
EmitSymbolRefWithOfs(streamer, info->Function, info->End);
|
EmitSymbolRefWithOfs(streamer, info->Function, info->End);
|
||||||
streamer.EmitValue(MCSymbolRefExpr::create(info->Symbol,
|
streamer.emitValue(MCSymbolRefExpr::create(info->Symbol,
|
||||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||||
context), 4);
|
context), 4);
|
||||||
}
|
}
|
||||||
@ -173,15 +173,15 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
if (info->HandlesExceptions)
|
if (info->HandlesExceptions)
|
||||||
flags |= Win64EH::UNW_ExceptionHandler << 3;
|
flags |= Win64EH::UNW_ExceptionHandler << 3;
|
||||||
}
|
}
|
||||||
streamer.EmitIntValue(flags, 1);
|
streamer.emitIntValue(flags, 1);
|
||||||
|
|
||||||
if (info->PrologEnd)
|
if (info->PrologEnd)
|
||||||
EmitAbsDifference(streamer, info->PrologEnd, info->Begin);
|
EmitAbsDifference(streamer, info->PrologEnd, info->Begin);
|
||||||
else
|
else
|
||||||
streamer.EmitIntValue(0, 1);
|
streamer.emitIntValue(0, 1);
|
||||||
|
|
||||||
uint8_t numCodes = CountOfUnwindCodes(info->Instructions);
|
uint8_t numCodes = CountOfUnwindCodes(info->Instructions);
|
||||||
streamer.EmitIntValue(numCodes, 1);
|
streamer.emitIntValue(numCodes, 1);
|
||||||
|
|
||||||
uint8_t frame = 0;
|
uint8_t frame = 0;
|
||||||
if (info->LastFrameInst >= 0) {
|
if (info->LastFrameInst >= 0) {
|
||||||
@ -189,7 +189,7 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
assert(frameInst.Operation == Win64EH::UOP_SetFPReg);
|
assert(frameInst.Operation == Win64EH::UOP_SetFPReg);
|
||||||
frame = (frameInst.Register & 0x0F) | (frameInst.Offset & 0xF0);
|
frame = (frameInst.Register & 0x0F) | (frameInst.Offset & 0xF0);
|
||||||
}
|
}
|
||||||
streamer.EmitIntValue(frame, 1);
|
streamer.emitIntValue(frame, 1);
|
||||||
|
|
||||||
// Emit unwind instructions (in reverse order).
|
// Emit unwind instructions (in reverse order).
|
||||||
uint8_t numInst = info->Instructions.size();
|
uint8_t numInst = info->Instructions.size();
|
||||||
@ -204,21 +204,21 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
// the array will be one longer than indicated by the count of unwind codes
|
// the array will be one longer than indicated by the count of unwind codes
|
||||||
// field).
|
// field).
|
||||||
if (numCodes & 1) {
|
if (numCodes & 1) {
|
||||||
streamer.EmitIntValue(0, 2);
|
streamer.emitIntValue(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & (Win64EH::UNW_ChainInfo << 3))
|
if (flags & (Win64EH::UNW_ChainInfo << 3))
|
||||||
EmitRuntimeFunction(streamer, info->ChainedParent);
|
EmitRuntimeFunction(streamer, info->ChainedParent);
|
||||||
else if (flags &
|
else if (flags &
|
||||||
((Win64EH::UNW_TerminateHandler|Win64EH::UNW_ExceptionHandler) << 3))
|
((Win64EH::UNW_TerminateHandler|Win64EH::UNW_ExceptionHandler) << 3))
|
||||||
streamer.EmitValue(MCSymbolRefExpr::create(info->ExceptionHandler,
|
streamer.emitValue(MCSymbolRefExpr::create(info->ExceptionHandler,
|
||||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||||
context), 4);
|
context), 4);
|
||||||
else if (numCodes == 0) {
|
else if (numCodes == 0) {
|
||||||
// The minimum size of an UNWIND_INFO struct is 8 bytes. If we're not
|
// The minimum size of an UNWIND_INFO struct is 8 bytes. If we're not
|
||||||
// a chained unwind info, if there is no handler, and if there are fewer
|
// a chained unwind info, if there is no handler, and if there are fewer
|
||||||
// than 2 slots used in the unwind code array, we have to pad to 8 bytes.
|
// than 2 slots used in the unwind code array, we have to pad to 8 bytes.
|
||||||
streamer.EmitIntValue(0, 4);
|
streamer.emitIntValue(0, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,121 +337,121 @@ static void ARM64EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin,
|
|||||||
llvm_unreachable("Unsupported ARM64 unwind code");
|
llvm_unreachable("Unsupported ARM64 unwind code");
|
||||||
case Win64EH::UOP_AllocSmall:
|
case Win64EH::UOP_AllocSmall:
|
||||||
b = (inst.Offset >> 4) & 0x1F;
|
b = (inst.Offset >> 4) & 0x1F;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_AllocMedium: {
|
case Win64EH::UOP_AllocMedium: {
|
||||||
uint16_t hw = (inst.Offset >> 4) & 0x7FF;
|
uint16_t hw = (inst.Offset >> 4) & 0x7FF;
|
||||||
b = 0xC0;
|
b = 0xC0;
|
||||||
b |= (hw >> 8);
|
b |= (hw >> 8);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = hw & 0xFF;
|
b = hw & 0xFF;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Win64EH::UOP_AllocLarge: {
|
case Win64EH::UOP_AllocLarge: {
|
||||||
uint32_t w;
|
uint32_t w;
|
||||||
b = 0xE0;
|
b = 0xE0;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
w = inst.Offset >> 4;
|
w = inst.Offset >> 4;
|
||||||
b = (w & 0x00FF0000) >> 16;
|
b = (w & 0x00FF0000) >> 16;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = (w & 0x0000FF00) >> 8;
|
b = (w & 0x0000FF00) >> 8;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = w & 0x000000FF;
|
b = w & 0x000000FF;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Win64EH::UOP_SetFP:
|
case Win64EH::UOP_SetFP:
|
||||||
b = 0xE1;
|
b = 0xE1;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_AddFP:
|
case Win64EH::UOP_AddFP:
|
||||||
b = 0xE2;
|
b = 0xE2;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = (inst.Offset >> 3);
|
b = (inst.Offset >> 3);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_Nop:
|
case Win64EH::UOP_Nop:
|
||||||
b = 0xE3;
|
b = 0xE3;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveFPLRX:
|
case Win64EH::UOP_SaveFPLRX:
|
||||||
b = 0x80;
|
b = 0x80;
|
||||||
b |= ((inst.Offset - 1) >> 3) & 0x3F;
|
b |= ((inst.Offset - 1) >> 3) & 0x3F;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveFPLR:
|
case Win64EH::UOP_SaveFPLR:
|
||||||
b = 0x40;
|
b = 0x40;
|
||||||
b |= (inst.Offset >> 3) & 0x3F;
|
b |= (inst.Offset >> 3) & 0x3F;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveReg:
|
case Win64EH::UOP_SaveReg:
|
||||||
assert(inst.Register >= 19 && "Saved reg must be >= 19");
|
assert(inst.Register >= 19 && "Saved reg must be >= 19");
|
||||||
reg = inst.Register - 19;
|
reg = inst.Register - 19;
|
||||||
b = 0xD0 | ((reg & 0xC) >> 2);
|
b = 0xD0 | ((reg & 0xC) >> 2);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveRegX:
|
case Win64EH::UOP_SaveRegX:
|
||||||
assert(inst.Register >= 19 && "Saved reg must be >= 19");
|
assert(inst.Register >= 19 && "Saved reg must be >= 19");
|
||||||
reg = inst.Register - 19;
|
reg = inst.Register - 19;
|
||||||
b = 0xD4 | ((reg & 0x8) >> 3);
|
b = 0xD4 | ((reg & 0x8) >> 3);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x7) << 5) | ((inst.Offset >> 3) - 1);
|
b = ((reg & 0x7) << 5) | ((inst.Offset >> 3) - 1);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveRegP:
|
case Win64EH::UOP_SaveRegP:
|
||||||
assert(inst.Register >= 19 && "Saved registers must be >= 19");
|
assert(inst.Register >= 19 && "Saved registers must be >= 19");
|
||||||
reg = inst.Register - 19;
|
reg = inst.Register - 19;
|
||||||
b = 0xC8 | ((reg & 0xC) >> 2);
|
b = 0xC8 | ((reg & 0xC) >> 2);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveRegPX:
|
case Win64EH::UOP_SaveRegPX:
|
||||||
assert(inst.Register >= 19 && "Saved registers must be >= 19");
|
assert(inst.Register >= 19 && "Saved registers must be >= 19");
|
||||||
reg = inst.Register - 19;
|
reg = inst.Register - 19;
|
||||||
b = 0xCC | ((reg & 0xC) >> 2);
|
b = 0xCC | ((reg & 0xC) >> 2);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x3) << 6) | ((inst.Offset >> 3) - 1);
|
b = ((reg & 0x3) << 6) | ((inst.Offset >> 3) - 1);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveFReg:
|
case Win64EH::UOP_SaveFReg:
|
||||||
assert(inst.Register >= 8 && "Saved dreg must be >= 8");
|
assert(inst.Register >= 8 && "Saved dreg must be >= 8");
|
||||||
reg = inst.Register - 8;
|
reg = inst.Register - 8;
|
||||||
b = 0xDC | ((reg & 0x4) >> 2);
|
b = 0xDC | ((reg & 0x4) >> 2);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveFRegX:
|
case Win64EH::UOP_SaveFRegX:
|
||||||
assert(inst.Register >= 8 && "Saved dreg must be >= 8");
|
assert(inst.Register >= 8 && "Saved dreg must be >= 8");
|
||||||
reg = inst.Register - 8;
|
reg = inst.Register - 8;
|
||||||
b = 0xDE;
|
b = 0xDE;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x7) << 5) | ((inst.Offset >> 3) - 1);
|
b = ((reg & 0x7) << 5) | ((inst.Offset >> 3) - 1);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveFRegP:
|
case Win64EH::UOP_SaveFRegP:
|
||||||
assert(inst.Register >= 8 && "Saved dregs must be >= 8");
|
assert(inst.Register >= 8 && "Saved dregs must be >= 8");
|
||||||
reg = inst.Register - 8;
|
reg = inst.Register - 8;
|
||||||
b = 0xD8 | ((reg & 0x4) >> 2);
|
b = 0xD8 | ((reg & 0x4) >> 2);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_SaveFRegPX:
|
case Win64EH::UOP_SaveFRegPX:
|
||||||
assert(inst.Register >= 8 && "Saved dregs must be >= 8");
|
assert(inst.Register >= 8 && "Saved dregs must be >= 8");
|
||||||
reg = inst.Register - 8;
|
reg = inst.Register - 8;
|
||||||
b = 0xDA | ((reg & 0x4) >> 2);
|
b = 0xDA | ((reg & 0x4) >> 2);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
b = ((reg & 0x3) << 6) | ((inst.Offset >> 3) - 1);
|
b = ((reg & 0x3) << 6) | ((inst.Offset >> 3) - 1);
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
case Win64EH::UOP_End:
|
case Win64EH::UOP_End:
|
||||||
b = 0xE4;
|
b = 0xE4;
|
||||||
streamer.EmitIntValue(b, 1);
|
streamer.emitIntValue(b, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
if (info->HandlesExceptions) // X
|
if (info->HandlesExceptions) // X
|
||||||
row1 |= 1 << 20;
|
row1 |= 1 << 20;
|
||||||
row1 |= FuncLength & 0x3FFFF;
|
row1 |= FuncLength & 0x3FFFF;
|
||||||
streamer.EmitIntValue(row1, 4);
|
streamer.emitIntValue(row1, 4);
|
||||||
|
|
||||||
// Extended Code Words, Extended Epilog Count
|
// Extended Code Words, Extended Epilog Count
|
||||||
if (ExtensionWord) {
|
if (ExtensionWord) {
|
||||||
@ -597,7 +597,7 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
uint32_t row2 = 0x0;
|
uint32_t row2 = 0x0;
|
||||||
row2 |= (CodeWords & 0xFF) << 16;
|
row2 |= (CodeWords & 0xFF) << 16;
|
||||||
row2 |= (EpilogCount & 0xFFFF);
|
row2 |= (EpilogCount & 0xFFFF);
|
||||||
streamer.EmitIntValue(row2, 4);
|
streamer.emitIntValue(row2, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Epilog Start Index, Epilog Start Offset
|
// Epilog Start Index, Epilog Start Offset
|
||||||
@ -610,7 +610,7 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
EpilogOffset /= 4;
|
EpilogOffset /= 4;
|
||||||
uint32_t row3 = EpilogOffset;
|
uint32_t row3 = EpilogOffset;
|
||||||
row3 |= (EpilogIndex & 0x3FF) << 22;
|
row3 |= (EpilogIndex & 0x3FF) << 22;
|
||||||
streamer.EmitIntValue(row3, 4);
|
streamer.emitIntValue(row3, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit prolog unwind instructions (in reverse order).
|
// Emit prolog unwind instructions (in reverse order).
|
||||||
@ -633,10 +633,10 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
|||||||
int32_t BytesMod = CodeWords * 4 - TotalCodeBytes;
|
int32_t BytesMod = CodeWords * 4 - TotalCodeBytes;
|
||||||
assert(BytesMod >= 0);
|
assert(BytesMod >= 0);
|
||||||
for (int i = 0; i < BytesMod; i++)
|
for (int i = 0; i < BytesMod; i++)
|
||||||
streamer.EmitIntValue(0xE3, 1);
|
streamer.emitIntValue(0xE3, 1);
|
||||||
|
|
||||||
if (info->HandlesExceptions)
|
if (info->HandlesExceptions)
|
||||||
streamer.EmitValue(
|
streamer.emitValue(
|
||||||
MCSymbolRefExpr::create(info->ExceptionHandler,
|
MCSymbolRefExpr::create(info->ExceptionHandler,
|
||||||
MCSymbolRefExpr::VK_COFF_IMGREL32, context),
|
MCSymbolRefExpr::VK_COFF_IMGREL32, context),
|
||||||
4);
|
4);
|
||||||
@ -648,7 +648,7 @@ static void ARM64EmitRuntimeFunction(MCStreamer &streamer,
|
|||||||
|
|
||||||
streamer.emitValueToAlignment(4);
|
streamer.emitValueToAlignment(4);
|
||||||
EmitSymbolRefWithOfs(streamer, info->Function, info->Begin);
|
EmitSymbolRefWithOfs(streamer, info->Function, info->Begin);
|
||||||
streamer.EmitValue(MCSymbolRefExpr::create(info->Symbol,
|
streamer.emitValue(MCSymbolRefExpr::create(info->Symbol,
|
||||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||||
context),
|
context),
|
||||||
4);
|
4);
|
||||||
|
@ -226,16 +226,16 @@ void AArch64AsmPrinter::emitStartOfAsmFile(Module &M) {
|
|||||||
|
|
||||||
// Emit the note header.
|
// Emit the note header.
|
||||||
emitAlignment(Align(8));
|
emitAlignment(Align(8));
|
||||||
OutStreamer->EmitIntValue(4, 4); // data size for "GNU\0"
|
OutStreamer->emitIntValue(4, 4); // data size for "GNU\0"
|
||||||
OutStreamer->EmitIntValue(4 * 4, 4); // Elf_Prop size
|
OutStreamer->emitIntValue(4 * 4, 4); // Elf_Prop size
|
||||||
OutStreamer->EmitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4);
|
OutStreamer->emitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4);
|
||||||
OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
|
OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
|
||||||
|
|
||||||
// Emit the PAC/BTI properties.
|
// Emit the PAC/BTI properties.
|
||||||
OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_AARCH64_FEATURE_1_AND, 4);
|
OutStreamer->emitIntValue(ELF::GNU_PROPERTY_AARCH64_FEATURE_1_AND, 4);
|
||||||
OutStreamer->EmitIntValue(4, 4); // data size
|
OutStreamer->emitIntValue(4, 4); // data size
|
||||||
OutStreamer->EmitIntValue(Flags, 4); // data
|
OutStreamer->emitIntValue(Flags, 4); // data
|
||||||
OutStreamer->EmitIntValue(0, 4); // pad
|
OutStreamer->emitIntValue(0, 4); // pad
|
||||||
|
|
||||||
OutStreamer->endSection(Nt);
|
OutStreamer->endSection(Nt);
|
||||||
OutStreamer->SwitchSection(Cur);
|
OutStreamer->SwitchSection(Cur);
|
||||||
@ -811,7 +811,7 @@ void AArch64AsmPrinter::emitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
|||||||
Value, MCConstantExpr::create(2, OutContext), OutContext);
|
Value, MCConstantExpr::create(2, OutContext), OutContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStreamer->EmitValue(Value, Size);
|
OutStreamer->emitValue(Value, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Small jump tables contain an unsigned byte or half, representing the offset
|
/// Small jump tables contain an unsigned byte or half, representing the offset
|
||||||
|
@ -1124,40 +1124,40 @@ void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,
|
|||||||
unsigned RsrcReg = getRsrcReg(MF.getFunction().getCallingConv());
|
unsigned RsrcReg = getRsrcReg(MF.getFunction().getCallingConv());
|
||||||
|
|
||||||
if (AMDGPU::isCompute(MF.getFunction().getCallingConv())) {
|
if (AMDGPU::isCompute(MF.getFunction().getCallingConv())) {
|
||||||
OutStreamer->EmitIntValue(R_00B848_COMPUTE_PGM_RSRC1, 4);
|
OutStreamer->emitIntValue(R_00B848_COMPUTE_PGM_RSRC1, 4);
|
||||||
|
|
||||||
OutStreamer->EmitIntValue(CurrentProgramInfo.ComputePGMRSrc1, 4);
|
OutStreamer->emitIntValue(CurrentProgramInfo.ComputePGMRSrc1, 4);
|
||||||
|
|
||||||
OutStreamer->EmitIntValue(R_00B84C_COMPUTE_PGM_RSRC2, 4);
|
OutStreamer->emitIntValue(R_00B84C_COMPUTE_PGM_RSRC2, 4);
|
||||||
OutStreamer->EmitIntValue(CurrentProgramInfo.ComputePGMRSrc2, 4);
|
OutStreamer->emitIntValue(CurrentProgramInfo.ComputePGMRSrc2, 4);
|
||||||
|
|
||||||
OutStreamer->EmitIntValue(R_00B860_COMPUTE_TMPRING_SIZE, 4);
|
OutStreamer->emitIntValue(R_00B860_COMPUTE_TMPRING_SIZE, 4);
|
||||||
OutStreamer->EmitIntValue(S_00B860_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
|
OutStreamer->emitIntValue(S_00B860_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
|
||||||
|
|
||||||
// TODO: Should probably note flat usage somewhere. SC emits a "FlatPtr32 =
|
// TODO: Should probably note flat usage somewhere. SC emits a "FlatPtr32 =
|
||||||
// 0" comment but I don't see a corresponding field in the register spec.
|
// 0" comment but I don't see a corresponding field in the register spec.
|
||||||
} else {
|
} else {
|
||||||
OutStreamer->EmitIntValue(RsrcReg, 4);
|
OutStreamer->emitIntValue(RsrcReg, 4);
|
||||||
OutStreamer->EmitIntValue(S_00B028_VGPRS(CurrentProgramInfo.VGPRBlocks) |
|
OutStreamer->emitIntValue(S_00B028_VGPRS(CurrentProgramInfo.VGPRBlocks) |
|
||||||
S_00B028_SGPRS(CurrentProgramInfo.SGPRBlocks), 4);
|
S_00B028_SGPRS(CurrentProgramInfo.SGPRBlocks), 4);
|
||||||
OutStreamer->EmitIntValue(R_0286E8_SPI_TMPRING_SIZE, 4);
|
OutStreamer->emitIntValue(R_0286E8_SPI_TMPRING_SIZE, 4);
|
||||||
OutStreamer->EmitIntValue(
|
OutStreamer->emitIntValue(
|
||||||
S_0286E8_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
|
S_0286E8_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_PS) {
|
if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_PS) {
|
||||||
OutStreamer->EmitIntValue(R_00B02C_SPI_SHADER_PGM_RSRC2_PS, 4);
|
OutStreamer->emitIntValue(R_00B02C_SPI_SHADER_PGM_RSRC2_PS, 4);
|
||||||
OutStreamer->EmitIntValue(S_00B02C_EXTRA_LDS_SIZE(CurrentProgramInfo.LDSBlocks), 4);
|
OutStreamer->emitIntValue(S_00B02C_EXTRA_LDS_SIZE(CurrentProgramInfo.LDSBlocks), 4);
|
||||||
OutStreamer->EmitIntValue(R_0286CC_SPI_PS_INPUT_ENA, 4);
|
OutStreamer->emitIntValue(R_0286CC_SPI_PS_INPUT_ENA, 4);
|
||||||
OutStreamer->EmitIntValue(MFI->getPSInputEnable(), 4);
|
OutStreamer->emitIntValue(MFI->getPSInputEnable(), 4);
|
||||||
OutStreamer->EmitIntValue(R_0286D0_SPI_PS_INPUT_ADDR, 4);
|
OutStreamer->emitIntValue(R_0286D0_SPI_PS_INPUT_ADDR, 4);
|
||||||
OutStreamer->EmitIntValue(MFI->getPSInputAddr(), 4);
|
OutStreamer->emitIntValue(MFI->getPSInputAddr(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStreamer->EmitIntValue(R_SPILLED_SGPRS, 4);
|
OutStreamer->emitIntValue(R_SPILLED_SGPRS, 4);
|
||||||
OutStreamer->EmitIntValue(MFI->getNumSpilledSGPRs(), 4);
|
OutStreamer->emitIntValue(MFI->getNumSpilledSGPRs(), 4);
|
||||||
OutStreamer->EmitIntValue(R_SPILLED_VGPRS, 4);
|
OutStreamer->emitIntValue(R_SPILLED_VGPRS, 4);
|
||||||
OutStreamer->EmitIntValue(MFI->getNumSpilledVGPRs(), 4);
|
OutStreamer->emitIntValue(MFI->getNumSpilledVGPRs(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the equivalent of EmitProgramInfoSI above, but for when the OS type
|
// This is the equivalent of EmitProgramInfoSI above, but for when the OS type
|
||||||
|
@ -441,9 +441,9 @@ void AMDGPUTargetELFStreamer::EmitNote(
|
|||||||
S.PushSection();
|
S.PushSection();
|
||||||
S.SwitchSection(Context.getELFSection(
|
S.SwitchSection(Context.getELFSection(
|
||||||
ElfNote::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
|
ElfNote::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
|
||||||
S.EmitIntValue(NameSZ, 4); // namesz
|
S.emitIntValue(NameSZ, 4); // namesz
|
||||||
S.EmitValue(DescSZ, 4); // descz
|
S.emitValue(DescSZ, 4); // descz
|
||||||
S.EmitIntValue(NoteType, 4); // type
|
S.emitIntValue(NoteType, 4); // type
|
||||||
S.emitBytes(Name); // name
|
S.emitBytes(Name); // name
|
||||||
S.emitValueToAlignment(4, 0, 1, 0); // padding 0
|
S.emitValueToAlignment(4, 0, 1, 0); // padding 0
|
||||||
EmitDesc(S); // desc
|
EmitDesc(S); // desc
|
||||||
@ -458,8 +458,8 @@ void AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectVersion(
|
|||||||
|
|
||||||
EmitNote(ElfNote::NoteNameV2, MCConstantExpr::create(8, getContext()),
|
EmitNote(ElfNote::NoteNameV2, MCConstantExpr::create(8, getContext()),
|
||||||
ElfNote::NT_AMDGPU_HSA_CODE_OBJECT_VERSION, [&](MCELFStreamer &OS) {
|
ElfNote::NT_AMDGPU_HSA_CODE_OBJECT_VERSION, [&](MCELFStreamer &OS) {
|
||||||
OS.EmitIntValue(Major, 4);
|
OS.emitIntValue(Major, 4);
|
||||||
OS.EmitIntValue(Minor, 4);
|
OS.emitIntValue(Minor, 4);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,15 +478,15 @@ AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISA(uint32_t Major,
|
|||||||
|
|
||||||
EmitNote(ElfNote::NoteNameV2, MCConstantExpr::create(DescSZ, getContext()),
|
EmitNote(ElfNote::NoteNameV2, MCConstantExpr::create(DescSZ, getContext()),
|
||||||
ElfNote::NT_AMDGPU_HSA_ISA, [&](MCELFStreamer &OS) {
|
ElfNote::NT_AMDGPU_HSA_ISA, [&](MCELFStreamer &OS) {
|
||||||
OS.EmitIntValue(VendorNameSize, 2);
|
OS.emitIntValue(VendorNameSize, 2);
|
||||||
OS.EmitIntValue(ArchNameSize, 2);
|
OS.emitIntValue(ArchNameSize, 2);
|
||||||
OS.EmitIntValue(Major, 4);
|
OS.emitIntValue(Major, 4);
|
||||||
OS.EmitIntValue(Minor, 4);
|
OS.emitIntValue(Minor, 4);
|
||||||
OS.EmitIntValue(Stepping, 4);
|
OS.emitIntValue(Stepping, 4);
|
||||||
OS.emitBytes(VendorName);
|
OS.emitBytes(VendorName);
|
||||||
OS.EmitIntValue(0, 1); // NULL terminate VendorName
|
OS.emitIntValue(0, 1); // NULL terminate VendorName
|
||||||
OS.emitBytes(ArchName);
|
OS.emitBytes(ArchName);
|
||||||
OS.EmitIntValue(0, 1); // NULL terminte ArchName
|
OS.emitIntValue(0, 1); // NULL terminte ArchName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +604,7 @@ bool AMDGPUTargetELFStreamer::EmitCodeEnd() {
|
|||||||
OS.PushSection();
|
OS.PushSection();
|
||||||
OS.emitValueToAlignment(64, Encoded_s_code_end, 4);
|
OS.emitValueToAlignment(64, Encoded_s_code_end, 4);
|
||||||
for (unsigned I = 0; I < 48; ++I)
|
for (unsigned I = 0; I < 48; ++I)
|
||||||
OS.EmitIntValue(Encoded_s_code_end, 4);
|
OS.emitIntValue(Encoded_s_code_end, 4);
|
||||||
OS.PopSection();
|
OS.PopSection();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ void AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(
|
|||||||
// expression being created is:
|
// expression being created is:
|
||||||
// (start of kernel code) - (start of kernel descriptor)
|
// (start of kernel code) - (start of kernel descriptor)
|
||||||
// It implies R_AMDGPU_REL64, but ends up being R_AMDGPU_ABS64.
|
// It implies R_AMDGPU_REL64, but ends up being R_AMDGPU_ABS64.
|
||||||
Streamer.EmitValue(MCBinaryExpr::createSub(
|
Streamer.emitValue(MCBinaryExpr::createSub(
|
||||||
MCSymbolRefExpr::create(
|
MCSymbolRefExpr::create(
|
||||||
KernelCodeSymbol, MCSymbolRefExpr::VK_AMDGPU_REL64, Context),
|
KernelCodeSymbol, MCSymbolRefExpr::VK_AMDGPU_REL64, Context),
|
||||||
MCSymbolRefExpr::create(
|
MCSymbolRefExpr::create(
|
||||||
|
@ -88,15 +88,15 @@ void R600AsmPrinter::EmitProgramInfoR600(const MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStreamer->EmitIntValue(RsrcReg, 4);
|
OutStreamer->emitIntValue(RsrcReg, 4);
|
||||||
OutStreamer->EmitIntValue(S_NUM_GPRS(MaxGPR + 1) |
|
OutStreamer->emitIntValue(S_NUM_GPRS(MaxGPR + 1) |
|
||||||
S_STACK_SIZE(MFI->CFStackSize), 4);
|
S_STACK_SIZE(MFI->CFStackSize), 4);
|
||||||
OutStreamer->EmitIntValue(R_02880C_DB_SHADER_CONTROL, 4);
|
OutStreamer->emitIntValue(R_02880C_DB_SHADER_CONTROL, 4);
|
||||||
OutStreamer->EmitIntValue(S_02880C_KILL_ENABLE(killPixel), 4);
|
OutStreamer->emitIntValue(S_02880C_KILL_ENABLE(killPixel), 4);
|
||||||
|
|
||||||
if (AMDGPU::isCompute(MF.getFunction().getCallingConv())) {
|
if (AMDGPU::isCompute(MF.getFunction().getCallingConv())) {
|
||||||
OutStreamer->EmitIntValue(R_0288E8_SQ_LDS_ALLOC, 4);
|
OutStreamer->emitIntValue(R_0288E8_SQ_LDS_ALLOC, 4);
|
||||||
OutStreamer->EmitIntValue(alignTo(MFI->getLDSSize(), 4) >> 2, 4);
|
OutStreamer->emitIntValue(alignTo(MFI->getLDSSize(), 4) >> 2, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void ARMAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) {
|
|||||||
: MCSymbolRefExpr::VK_None),
|
: MCSymbolRefExpr::VK_None),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
OutStreamer->EmitValue(E, Size);
|
OutStreamer->emitValue(E, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
|
void ARMAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
|
||||||
@ -497,7 +497,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
|
|||||||
|
|
||||||
if (MCSym.getInt())
|
if (MCSym.getInt())
|
||||||
// External to current translation unit.
|
// External to current translation unit.
|
||||||
OutStreamer.EmitIntValue(0, 4/*size*/);
|
OutStreamer.emitIntValue(0, 4/*size*/);
|
||||||
else
|
else
|
||||||
// Internal to current translation unit.
|
// Internal to current translation unit.
|
||||||
//
|
//
|
||||||
@ -505,7 +505,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
|
|||||||
// pointers need to be indirect and pc-rel. We accomplish this by
|
// pointers need to be indirect and pc-rel. We accomplish this by
|
||||||
// using NLPs; however, sometimes the types are local to the file.
|
// using NLPs; however, sometimes the types are local to the file.
|
||||||
// We need to fill in the value for the NLP in those cases.
|
// We need to fill in the value for the NLP in those cases.
|
||||||
OutStreamer.EmitValue(
|
OutStreamer.emitValue(
|
||||||
MCSymbolRefExpr::create(MCSym.getPointer(), OutStreamer.getContext()),
|
MCSymbolRefExpr::create(MCSym.getPointer(), OutStreamer.getContext()),
|
||||||
4 /*size*/);
|
4 /*size*/);
|
||||||
}
|
}
|
||||||
@ -932,7 +932,7 @@ void ARMAsmPrinter::emitMachineConstantPoolValue(
|
|||||||
}
|
}
|
||||||
Expr = MCBinaryExpr::createSub(Expr, PCRelExpr, OutContext);
|
Expr = MCBinaryExpr::createSub(Expr, PCRelExpr, OutContext);
|
||||||
}
|
}
|
||||||
OutStreamer->EmitValue(Expr, Size);
|
OutStreamer->emitValue(Expr, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMAsmPrinter::emitJumpTableAddrs(const MachineInstr *MI) {
|
void ARMAsmPrinter::emitJumpTableAddrs(const MachineInstr *MI) {
|
||||||
@ -975,7 +975,7 @@ void ARMAsmPrinter::emitJumpTableAddrs(const MachineInstr *MI) {
|
|||||||
else if (AFI->isThumbFunction())
|
else if (AFI->isThumbFunction())
|
||||||
Expr = MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(1,OutContext),
|
Expr = MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(1,OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
OutStreamer->EmitValue(Expr, 4);
|
OutStreamer->emitValue(Expr, 4);
|
||||||
}
|
}
|
||||||
// Mark the end of jump table data-in-code region.
|
// Mark the end of jump table data-in-code region.
|
||||||
OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
|
OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
|
||||||
@ -1051,7 +1051,7 @@ void ARMAsmPrinter::emitJumpTableTBInst(const MachineInstr *MI,
|
|||||||
Expr = MCBinaryExpr::createSub(MBBSymbolExpr, Expr, OutContext);
|
Expr = MCBinaryExpr::createSub(MBBSymbolExpr, Expr, OutContext);
|
||||||
Expr = MCBinaryExpr::createDiv(Expr, MCConstantExpr::create(2, OutContext),
|
Expr = MCBinaryExpr::createDiv(Expr, MCConstantExpr::create(2, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
OutStreamer->EmitValue(Expr, OffsetWidth);
|
OutStreamer->emitValue(Expr, OffsetWidth);
|
||||||
}
|
}
|
||||||
// Mark the end of jump table data-in-code region. 32-bit offsets use
|
// Mark the end of jump table data-in-code region. 32-bit offsets use
|
||||||
// actual branch instructions here, so we don't mark those as a data-region
|
// actual branch instructions here, so we don't mark those as a data-region
|
||||||
|
@ -10632,7 +10632,7 @@ bool ARMAsmParser::parseLiteralValues(unsigned Size, SMLoc L) {
|
|||||||
const MCExpr *Value;
|
const MCExpr *Value;
|
||||||
if (getParser().parseExpression(Value))
|
if (getParser().parseExpression(Value))
|
||||||
return true;
|
return true;
|
||||||
getParser().getStreamer().EmitValue(Value, Size, L);
|
getParser().getStreamer().emitValue(Value, Size, L);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
return (parseMany(parseOne));
|
return (parseMany(parseOne));
|
||||||
|
@ -1079,7 +1079,7 @@ void ARMTargetELFStreamer::finishAttributeSection() {
|
|||||||
Streamer.SwitchSection(AttributeSection);
|
Streamer.SwitchSection(AttributeSection);
|
||||||
|
|
||||||
// Format version
|
// Format version
|
||||||
Streamer.EmitIntValue(0x41, 1);
|
Streamer.emitIntValue(0x41, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vendor size + Vendor name + '\0'
|
// Vendor size + Vendor name + '\0'
|
||||||
@ -1090,12 +1090,12 @@ void ARMTargetELFStreamer::finishAttributeSection() {
|
|||||||
|
|
||||||
const size_t ContentsSize = calculateContentSize();
|
const size_t ContentsSize = calculateContentSize();
|
||||||
|
|
||||||
Streamer.EmitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4);
|
Streamer.emitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4);
|
||||||
Streamer.emitBytes(CurrentVendor);
|
Streamer.emitBytes(CurrentVendor);
|
||||||
Streamer.EmitIntValue(0, 1); // '\0'
|
Streamer.emitIntValue(0, 1); // '\0'
|
||||||
|
|
||||||
Streamer.EmitIntValue(ARMBuildAttrs::File, 1);
|
Streamer.emitIntValue(ARMBuildAttrs::File, 1);
|
||||||
Streamer.EmitIntValue(TagHeaderSize + ContentsSize, 4);
|
Streamer.emitIntValue(TagHeaderSize + ContentsSize, 4);
|
||||||
|
|
||||||
// Size should have been accounted for already, now
|
// Size should have been accounted for already, now
|
||||||
// emit each field as its type (ULEB or String)
|
// emit each field as its type (ULEB or String)
|
||||||
@ -1109,12 +1109,12 @@ void ARMTargetELFStreamer::finishAttributeSection() {
|
|||||||
break;
|
break;
|
||||||
case AttributeItem::TextAttribute:
|
case AttributeItem::TextAttribute:
|
||||||
Streamer.emitBytes(item.StringValue);
|
Streamer.emitBytes(item.StringValue);
|
||||||
Streamer.EmitIntValue(0, 1); // '\0'
|
Streamer.emitIntValue(0, 1); // '\0'
|
||||||
break;
|
break;
|
||||||
case AttributeItem::NumericAndTextAttributes:
|
case AttributeItem::NumericAndTextAttributes:
|
||||||
Streamer.emitULEB128IntValue(item.IntValue);
|
Streamer.emitULEB128IntValue(item.IntValue);
|
||||||
Streamer.emitBytes(item.StringValue);
|
Streamer.emitBytes(item.StringValue);
|
||||||
Streamer.EmitIntValue(0, 1); // '\0'
|
Streamer.emitIntValue(0, 1); // '\0'
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1272,17 +1272,17 @@ void ARMELFStreamer::emitFnEnd() {
|
|||||||
MCSymbolRefExpr::VK_ARM_PREL31,
|
MCSymbolRefExpr::VK_ARM_PREL31,
|
||||||
getContext());
|
getContext());
|
||||||
|
|
||||||
EmitValue(FnStartRef, 4);
|
emitValue(FnStartRef, 4);
|
||||||
|
|
||||||
if (CantUnwind) {
|
if (CantUnwind) {
|
||||||
EmitIntValue(ARM::EHABI::EXIDX_CANTUNWIND, 4);
|
emitIntValue(ARM::EHABI::EXIDX_CANTUNWIND, 4);
|
||||||
} else if (ExTab) {
|
} else if (ExTab) {
|
||||||
// Emit a reference to the unwind opcodes in the ".ARM.extab" section.
|
// Emit a reference to the unwind opcodes in the ".ARM.extab" section.
|
||||||
const MCSymbolRefExpr *ExTabEntryRef =
|
const MCSymbolRefExpr *ExTabEntryRef =
|
||||||
MCSymbolRefExpr::create(ExTab,
|
MCSymbolRefExpr::create(ExTab,
|
||||||
MCSymbolRefExpr::VK_ARM_PREL31,
|
MCSymbolRefExpr::VK_ARM_PREL31,
|
||||||
getContext());
|
getContext());
|
||||||
EmitValue(ExTabEntryRef, 4);
|
emitValue(ExTabEntryRef, 4);
|
||||||
} else {
|
} else {
|
||||||
// For the __aeabi_unwind_cpp_pr0, we have to emit the unwind opcodes in
|
// For the __aeabi_unwind_cpp_pr0, we have to emit the unwind opcodes in
|
||||||
// the second word of exception index table entry. The size of the unwind
|
// the second word of exception index table entry. The size of the unwind
|
||||||
@ -1295,7 +1295,7 @@ void ARMELFStreamer::emitFnEnd() {
|
|||||||
Opcodes[1] << 8 |
|
Opcodes[1] << 8 |
|
||||||
Opcodes[2] << 16 |
|
Opcodes[2] << 16 |
|
||||||
Opcodes[3] << 24;
|
Opcodes[3] << 24;
|
||||||
EmitIntValue(Intval, Opcodes.size());
|
emitIntValue(Intval, Opcodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to the section containing FnStart
|
// Switch to the section containing FnStart
|
||||||
@ -1363,7 +1363,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
|
|||||||
MCSymbolRefExpr::VK_ARM_PREL31,
|
MCSymbolRefExpr::VK_ARM_PREL31,
|
||||||
getContext());
|
getContext());
|
||||||
|
|
||||||
EmitValue(PersonalityRef, 4);
|
emitValue(PersonalityRef, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit unwind opcodes
|
// Emit unwind opcodes
|
||||||
@ -1374,7 +1374,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
|
|||||||
Opcodes[I + 1] << 8 |
|
Opcodes[I + 1] << 8 |
|
||||||
Opcodes[I + 2] << 16 |
|
Opcodes[I + 2] << 16 |
|
||||||
Opcodes[I + 3] << 24;
|
Opcodes[I + 3] << 24;
|
||||||
EmitIntValue(Intval, 4);
|
emitIntValue(Intval, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or
|
// According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or
|
||||||
@ -1385,7 +1385,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
|
|||||||
// In case that the .handlerdata directive is not specified by the
|
// In case that the .handlerdata directive is not specified by the
|
||||||
// programmer, we should emit zero to terminate the handler data.
|
// programmer, we should emit zero to terminate the handler data.
|
||||||
if (NoHandlerData && !Personality)
|
if (NoHandlerData && !Personality)
|
||||||
EmitIntValue(0, 4);
|
emitIntValue(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(false); }
|
void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(false); }
|
||||||
|
@ -670,7 +670,7 @@ bool AVRAsmParser::parseLiteralValues(unsigned SizeInBytes, SMLoc L) {
|
|||||||
Tokens[0].getKind() == AsmToken::Minus &&
|
Tokens[0].getKind() == AsmToken::Minus &&
|
||||||
Tokens[1].getKind() == AsmToken::Identifier) {
|
Tokens[1].getKind() == AsmToken::Identifier) {
|
||||||
MCSymbol *Symbol = getContext().getOrCreateSymbol(".text");
|
MCSymbol *Symbol = getContext().getOrCreateSymbol(".text");
|
||||||
AVRStreamer.EmitValueForModiferKind(Symbol, SizeInBytes, L,
|
AVRStreamer.emitValueForModiferKind(Symbol, SizeInBytes, L,
|
||||||
AVRMCExpr::VK_AVR_None);
|
AVRMCExpr::VK_AVR_None);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -688,7 +688,7 @@ bool AVRAsmParser::parseLiteralValues(unsigned SizeInBytes, SMLoc L) {
|
|||||||
}
|
}
|
||||||
MCSymbol *Symbol =
|
MCSymbol *Symbol =
|
||||||
getContext().getOrCreateSymbol(Parser.getTok().getString());
|
getContext().getOrCreateSymbol(Parser.getTok().getString());
|
||||||
AVRStreamer.EmitValueForModiferKind(Symbol, SizeInBytes, L, ModifierKind);
|
AVRStreamer.emitValueForModiferKind(Symbol, SizeInBytes, L, ModifierKind);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +696,7 @@ bool AVRAsmParser::parseLiteralValues(unsigned SizeInBytes, SMLoc L) {
|
|||||||
const MCExpr *Value;
|
const MCExpr *Value;
|
||||||
if (Parser.parseExpression(Value))
|
if (Parser.parseExpression(Value))
|
||||||
return true;
|
return true;
|
||||||
Parser.getStreamer().EmitValue(Value, SizeInBytes, L);
|
Parser.getStreamer().emitValue(Value, SizeInBytes, L);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
return (parseMany(parseOne));
|
return (parseMany(parseOne));
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
void AVRMCELFStreamer::EmitValueForModiferKind(
|
void AVRMCELFStreamer::emitValueForModiferKind(
|
||||||
const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc,
|
const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc,
|
||||||
AVRMCExpr::VariantKind ModifierKind) {
|
AVRMCExpr::VariantKind ModifierKind) {
|
||||||
MCSymbolRefExpr::VariantKind Kind = MCSymbolRefExpr::VK_AVR_NONE;
|
MCSymbolRefExpr::VariantKind Kind = MCSymbolRefExpr::VK_AVR_NONE;
|
||||||
@ -36,7 +36,7 @@ void AVRMCELFStreamer::EmitValueForModiferKind(
|
|||||||
Kind = MCSymbolRefExpr::VK_AVR_HI8;
|
Kind = MCSymbolRefExpr::VK_AVR_HI8;
|
||||||
else if (ModifierKind == AVRMCExpr::VK_AVR_HH8)
|
else if (ModifierKind == AVRMCExpr::VK_AVR_HH8)
|
||||||
Kind = MCSymbolRefExpr::VK_AVR_HLO8;
|
Kind = MCSymbolRefExpr::VK_AVR_HLO8;
|
||||||
MCELFStreamer::EmitValue(MCSymbolRefExpr::create(Sym, Kind, getContext()),
|
MCELFStreamer::emitValue(MCSymbolRefExpr::create(Sym, Kind, getContext()),
|
||||||
SizeInBytes, Loc);
|
SizeInBytes, Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
std::move(Emitter)),
|
std::move(Emitter)),
|
||||||
MCII(createAVRMCInstrInfo()) {}
|
MCII(createAVRMCInstrInfo()) {}
|
||||||
|
|
||||||
void EmitValueForModiferKind(
|
void emitValueForModiferKind(
|
||||||
const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc = SMLoc(),
|
const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc = SMLoc(),
|
||||||
AVRMCExpr::VariantKind ModifierKind = AVRMCExpr::VK_AVR_None);
|
AVRMCExpr::VariantKind ModifierKind = AVRMCExpr::VK_AVR_None);
|
||||||
};
|
};
|
||||||
|
@ -34,10 +34,10 @@ static const char *BTFKindStr[] = {
|
|||||||
void BTFTypeBase::emitType(MCStreamer &OS) {
|
void BTFTypeBase::emitType(MCStreamer &OS) {
|
||||||
OS.AddComment(std::string(BTFKindStr[Kind]) + "(id = " + std::to_string(Id) +
|
OS.AddComment(std::string(BTFKindStr[Kind]) + "(id = " + std::to_string(Id) +
|
||||||
")");
|
")");
|
||||||
OS.EmitIntValue(BTFType.NameOff, 4);
|
OS.emitIntValue(BTFType.NameOff, 4);
|
||||||
OS.AddComment("0x" + Twine::utohexstr(BTFType.Info));
|
OS.AddComment("0x" + Twine::utohexstr(BTFType.Info));
|
||||||
OS.EmitIntValue(BTFType.Info, 4);
|
OS.emitIntValue(BTFType.Info, 4);
|
||||||
OS.EmitIntValue(BTFType.Size, 4);
|
OS.emitIntValue(BTFType.Size, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
BTFTypeDerived::BTFTypeDerived(const DIDerivedType *DTy, unsigned Tag,
|
BTFTypeDerived::BTFTypeDerived(const DIDerivedType *DTy, unsigned Tag,
|
||||||
@ -148,7 +148,7 @@ void BTFTypeInt::completeType(BTFDebug &BDebug) {
|
|||||||
void BTFTypeInt::emitType(MCStreamer &OS) {
|
void BTFTypeInt::emitType(MCStreamer &OS) {
|
||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
OS.AddComment("0x" + Twine::utohexstr(IntVal));
|
OS.AddComment("0x" + Twine::utohexstr(IntVal));
|
||||||
OS.EmitIntValue(IntVal, 4);
|
OS.emitIntValue(IntVal, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
BTFTypeEnum::BTFTypeEnum(const DICompositeType *ETy, uint32_t VLen) : ETy(ETy) {
|
BTFTypeEnum::BTFTypeEnum(const DICompositeType *ETy, uint32_t VLen) : ETy(ETy) {
|
||||||
@ -179,8 +179,8 @@ void BTFTypeEnum::completeType(BTFDebug &BDebug) {
|
|||||||
void BTFTypeEnum::emitType(MCStreamer &OS) {
|
void BTFTypeEnum::emitType(MCStreamer &OS) {
|
||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
for (const auto &Enum : EnumValues) {
|
for (const auto &Enum : EnumValues) {
|
||||||
OS.EmitIntValue(Enum.NameOff, 4);
|
OS.emitIntValue(Enum.NameOff, 4);
|
||||||
OS.EmitIntValue(Enum.Val, 4);
|
OS.emitIntValue(Enum.Val, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,9 +209,9 @@ void BTFTypeArray::completeType(BTFDebug &BDebug) {
|
|||||||
|
|
||||||
void BTFTypeArray::emitType(MCStreamer &OS) {
|
void BTFTypeArray::emitType(MCStreamer &OS) {
|
||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
OS.EmitIntValue(ArrayInfo.ElemType, 4);
|
OS.emitIntValue(ArrayInfo.ElemType, 4);
|
||||||
OS.EmitIntValue(ArrayInfo.IndexType, 4);
|
OS.emitIntValue(ArrayInfo.IndexType, 4);
|
||||||
OS.EmitIntValue(ArrayInfo.Nelems, 4);
|
OS.emitIntValue(ArrayInfo.Nelems, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represent either a struct or a union.
|
/// Represent either a struct or a union.
|
||||||
@ -252,10 +252,10 @@ void BTFTypeStruct::completeType(BTFDebug &BDebug) {
|
|||||||
void BTFTypeStruct::emitType(MCStreamer &OS) {
|
void BTFTypeStruct::emitType(MCStreamer &OS) {
|
||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
for (const auto &Member : Members) {
|
for (const auto &Member : Members) {
|
||||||
OS.EmitIntValue(Member.NameOff, 4);
|
OS.emitIntValue(Member.NameOff, 4);
|
||||||
OS.EmitIntValue(Member.Type, 4);
|
OS.emitIntValue(Member.Type, 4);
|
||||||
OS.AddComment("0x" + Twine::utohexstr(Member.Offset));
|
OS.AddComment("0x" + Twine::utohexstr(Member.Offset));
|
||||||
OS.EmitIntValue(Member.Offset, 4);
|
OS.emitIntValue(Member.Offset, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,8 +303,8 @@ void BTFTypeFuncProto::completeType(BTFDebug &BDebug) {
|
|||||||
void BTFTypeFuncProto::emitType(MCStreamer &OS) {
|
void BTFTypeFuncProto::emitType(MCStreamer &OS) {
|
||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
for (const auto &Param : Parameters) {
|
for (const auto &Param : Parameters) {
|
||||||
OS.EmitIntValue(Param.NameOff, 4);
|
OS.emitIntValue(Param.NameOff, 4);
|
||||||
OS.EmitIntValue(Param.Type, 4);
|
OS.emitIntValue(Param.Type, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ void BTFKindVar::completeType(BTFDebug &BDebug) {
|
|||||||
|
|
||||||
void BTFKindVar::emitType(MCStreamer &OS) {
|
void BTFKindVar::emitType(MCStreamer &OS) {
|
||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
OS.EmitIntValue(Info, 4);
|
OS.emitIntValue(Info, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
BTFKindDataSec::BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
|
BTFKindDataSec::BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
|
||||||
@ -359,9 +359,9 @@ void BTFKindDataSec::emitType(MCStreamer &OS) {
|
|||||||
BTFTypeBase::emitType(OS);
|
BTFTypeBase::emitType(OS);
|
||||||
|
|
||||||
for (const auto &V : Vars) {
|
for (const auto &V : Vars) {
|
||||||
OS.EmitIntValue(std::get<0>(V), 4);
|
OS.emitIntValue(std::get<0>(V), 4);
|
||||||
Asm->emitLabelReference(std::get<1>(V), 4);
|
Asm->emitLabelReference(std::get<1>(V), 4);
|
||||||
OS.EmitIntValue(std::get<2>(V), 4);
|
OS.emitIntValue(std::get<2>(V), 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,9 +711,9 @@ void BTFDebug::constructLineInfo(const DISubprogram *SP, MCSymbol *Label,
|
|||||||
|
|
||||||
void BTFDebug::emitCommonHeader() {
|
void BTFDebug::emitCommonHeader() {
|
||||||
OS.AddComment("0x" + Twine::utohexstr(BTF::MAGIC));
|
OS.AddComment("0x" + Twine::utohexstr(BTF::MAGIC));
|
||||||
OS.EmitIntValue(BTF::MAGIC, 2);
|
OS.emitIntValue(BTF::MAGIC, 2);
|
||||||
OS.EmitIntValue(BTF::VERSION, 1);
|
OS.emitIntValue(BTF::VERSION, 1);
|
||||||
OS.EmitIntValue(0, 1);
|
OS.emitIntValue(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BTFDebug::emitBTFSection() {
|
void BTFDebug::emitBTFSection() {
|
||||||
@ -726,17 +726,17 @@ void BTFDebug::emitBTFSection() {
|
|||||||
|
|
||||||
// Emit header.
|
// Emit header.
|
||||||
emitCommonHeader();
|
emitCommonHeader();
|
||||||
OS.EmitIntValue(BTF::HeaderSize, 4);
|
OS.emitIntValue(BTF::HeaderSize, 4);
|
||||||
|
|
||||||
uint32_t TypeLen = 0, StrLen;
|
uint32_t TypeLen = 0, StrLen;
|
||||||
for (const auto &TypeEntry : TypeEntries)
|
for (const auto &TypeEntry : TypeEntries)
|
||||||
TypeLen += TypeEntry->getSize();
|
TypeLen += TypeEntry->getSize();
|
||||||
StrLen = StringTable.getSize();
|
StrLen = StringTable.getSize();
|
||||||
|
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.EmitIntValue(TypeLen, 4);
|
OS.emitIntValue(TypeLen, 4);
|
||||||
OS.EmitIntValue(TypeLen, 4);
|
OS.emitIntValue(TypeLen, 4);
|
||||||
OS.EmitIntValue(StrLen, 4);
|
OS.emitIntValue(StrLen, 4);
|
||||||
|
|
||||||
// Emit type table.
|
// Emit type table.
|
||||||
for (const auto &TypeEntry : TypeEntries)
|
for (const auto &TypeEntry : TypeEntries)
|
||||||
@ -764,7 +764,7 @@ void BTFDebug::emitBTFExtSection() {
|
|||||||
|
|
||||||
// Emit header.
|
// Emit header.
|
||||||
emitCommonHeader();
|
emitCommonHeader();
|
||||||
OS.EmitIntValue(BTF::ExtHeaderSize, 4);
|
OS.emitIntValue(BTF::ExtHeaderSize, 4);
|
||||||
|
|
||||||
// Account for FuncInfo/LineInfo record size as well.
|
// Account for FuncInfo/LineInfo record size as well.
|
||||||
uint32_t FuncLen = 4, LineLen = 4;
|
uint32_t FuncLen = 4, LineLen = 4;
|
||||||
@ -786,59 +786,59 @@ void BTFDebug::emitBTFExtSection() {
|
|||||||
if (FieldRelocLen)
|
if (FieldRelocLen)
|
||||||
FieldRelocLen += 4;
|
FieldRelocLen += 4;
|
||||||
|
|
||||||
OS.EmitIntValue(0, 4);
|
OS.emitIntValue(0, 4);
|
||||||
OS.EmitIntValue(FuncLen, 4);
|
OS.emitIntValue(FuncLen, 4);
|
||||||
OS.EmitIntValue(FuncLen, 4);
|
OS.emitIntValue(FuncLen, 4);
|
||||||
OS.EmitIntValue(LineLen, 4);
|
OS.emitIntValue(LineLen, 4);
|
||||||
OS.EmitIntValue(FuncLen + LineLen, 4);
|
OS.emitIntValue(FuncLen + LineLen, 4);
|
||||||
OS.EmitIntValue(FieldRelocLen, 4);
|
OS.emitIntValue(FieldRelocLen, 4);
|
||||||
|
|
||||||
// Emit func_info table.
|
// Emit func_info table.
|
||||||
OS.AddComment("FuncInfo");
|
OS.AddComment("FuncInfo");
|
||||||
OS.EmitIntValue(BTF::BPFFuncInfoSize, 4);
|
OS.emitIntValue(BTF::BPFFuncInfoSize, 4);
|
||||||
for (const auto &FuncSec : FuncInfoTable) {
|
for (const auto &FuncSec : FuncInfoTable) {
|
||||||
OS.AddComment("FuncInfo section string offset=" +
|
OS.AddComment("FuncInfo section string offset=" +
|
||||||
std::to_string(FuncSec.first));
|
std::to_string(FuncSec.first));
|
||||||
OS.EmitIntValue(FuncSec.first, 4);
|
OS.emitIntValue(FuncSec.first, 4);
|
||||||
OS.EmitIntValue(FuncSec.second.size(), 4);
|
OS.emitIntValue(FuncSec.second.size(), 4);
|
||||||
for (const auto &FuncInfo : FuncSec.second) {
|
for (const auto &FuncInfo : FuncSec.second) {
|
||||||
Asm->emitLabelReference(FuncInfo.Label, 4);
|
Asm->emitLabelReference(FuncInfo.Label, 4);
|
||||||
OS.EmitIntValue(FuncInfo.TypeId, 4);
|
OS.emitIntValue(FuncInfo.TypeId, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit line_info table.
|
// Emit line_info table.
|
||||||
OS.AddComment("LineInfo");
|
OS.AddComment("LineInfo");
|
||||||
OS.EmitIntValue(BTF::BPFLineInfoSize, 4);
|
OS.emitIntValue(BTF::BPFLineInfoSize, 4);
|
||||||
for (const auto &LineSec : LineInfoTable) {
|
for (const auto &LineSec : LineInfoTable) {
|
||||||
OS.AddComment("LineInfo section string offset=" +
|
OS.AddComment("LineInfo section string offset=" +
|
||||||
std::to_string(LineSec.first));
|
std::to_string(LineSec.first));
|
||||||
OS.EmitIntValue(LineSec.first, 4);
|
OS.emitIntValue(LineSec.first, 4);
|
||||||
OS.EmitIntValue(LineSec.second.size(), 4);
|
OS.emitIntValue(LineSec.second.size(), 4);
|
||||||
for (const auto &LineInfo : LineSec.second) {
|
for (const auto &LineInfo : LineSec.second) {
|
||||||
Asm->emitLabelReference(LineInfo.Label, 4);
|
Asm->emitLabelReference(LineInfo.Label, 4);
|
||||||
OS.EmitIntValue(LineInfo.FileNameOff, 4);
|
OS.emitIntValue(LineInfo.FileNameOff, 4);
|
||||||
OS.EmitIntValue(LineInfo.LineOff, 4);
|
OS.emitIntValue(LineInfo.LineOff, 4);
|
||||||
OS.AddComment("Line " + std::to_string(LineInfo.LineNum) + " Col " +
|
OS.AddComment("Line " + std::to_string(LineInfo.LineNum) + " Col " +
|
||||||
std::to_string(LineInfo.ColumnNum));
|
std::to_string(LineInfo.ColumnNum));
|
||||||
OS.EmitIntValue(LineInfo.LineNum << 10 | LineInfo.ColumnNum, 4);
|
OS.emitIntValue(LineInfo.LineNum << 10 | LineInfo.ColumnNum, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit field reloc table.
|
// Emit field reloc table.
|
||||||
if (FieldRelocLen) {
|
if (FieldRelocLen) {
|
||||||
OS.AddComment("FieldReloc");
|
OS.AddComment("FieldReloc");
|
||||||
OS.EmitIntValue(BTF::BPFFieldRelocSize, 4);
|
OS.emitIntValue(BTF::BPFFieldRelocSize, 4);
|
||||||
for (const auto &FieldRelocSec : FieldRelocTable) {
|
for (const auto &FieldRelocSec : FieldRelocTable) {
|
||||||
OS.AddComment("Field reloc section string offset=" +
|
OS.AddComment("Field reloc section string offset=" +
|
||||||
std::to_string(FieldRelocSec.first));
|
std::to_string(FieldRelocSec.first));
|
||||||
OS.EmitIntValue(FieldRelocSec.first, 4);
|
OS.emitIntValue(FieldRelocSec.first, 4);
|
||||||
OS.EmitIntValue(FieldRelocSec.second.size(), 4);
|
OS.emitIntValue(FieldRelocSec.second.size(), 4);
|
||||||
for (const auto &FieldRelocInfo : FieldRelocSec.second) {
|
for (const auto &FieldRelocInfo : FieldRelocSec.second) {
|
||||||
Asm->emitLabelReference(FieldRelocInfo.Label, 4);
|
Asm->emitLabelReference(FieldRelocInfo.Label, 4);
|
||||||
OS.EmitIntValue(FieldRelocInfo.TypeID, 4);
|
OS.emitIntValue(FieldRelocInfo.TypeID, 4);
|
||||||
OS.EmitIntValue(FieldRelocInfo.OffsetNameOff, 4);
|
OS.emitIntValue(FieldRelocInfo.OffsetNameOff, 4);
|
||||||
OS.EmitIntValue(FieldRelocInfo.RelocKind, 4);
|
OS.emitIntValue(FieldRelocInfo.RelocKind, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1509,7 +1509,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
|
|||||||
if (Sym->isUndefined()) {
|
if (Sym->isUndefined()) {
|
||||||
getStreamer().emitLabel(Sym);
|
getStreamer().emitLabel(Sym);
|
||||||
getStreamer().emitSymbolAttribute(Sym, MCSA_Global);
|
getStreamer().emitSymbolAttribute(Sym, MCSA_Global);
|
||||||
getStreamer().EmitIntValue(Value, byteSize);
|
getStreamer().emitIntValue(Value, byteSize);
|
||||||
}
|
}
|
||||||
} else if (MO_1.isExpr()) {
|
} else if (MO_1.isExpr()) {
|
||||||
const char *StringStart = nullptr;
|
const char *StringStart = nullptr;
|
||||||
@ -1531,7 +1531,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
|
|||||||
// case where symbol is not yet defined: emit symbol
|
// case where symbol is not yet defined: emit symbol
|
||||||
getStreamer().emitLabel(Sym);
|
getStreamer().emitLabel(Sym);
|
||||||
getStreamer().emitSymbolAttribute(Sym, MCSA_Local);
|
getStreamer().emitSymbolAttribute(Sym, MCSA_Local);
|
||||||
getStreamer().EmitValue(MO_1.getExpr(), 4);
|
getStreamer().emitValue(MO_1.getExpr(), 4);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
llvm_unreachable("unexpected type of machine operand!");
|
llvm_unreachable("unexpected type of machine operand!");
|
||||||
|
@ -208,7 +208,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
|
|||||||
if (Sym->isUndefined()) {
|
if (Sym->isUndefined()) {
|
||||||
OutStreamer.emitLabel(Sym);
|
OutStreamer.emitLabel(Sym);
|
||||||
OutStreamer.emitSymbolAttribute(Sym, MCSA_Global);
|
OutStreamer.emitSymbolAttribute(Sym, MCSA_Global);
|
||||||
OutStreamer.EmitIntValue(Value, AlignSize);
|
OutStreamer.emitIntValue(Value, AlignSize);
|
||||||
OutStreamer.emitCodeAlignment(AlignSize);
|
OutStreamer.emitCodeAlignment(AlignSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -236,7 +236,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
|
|||||||
if (Sym->isUndefined()) {
|
if (Sym->isUndefined()) {
|
||||||
OutStreamer.emitLabel(Sym);
|
OutStreamer.emitLabel(Sym);
|
||||||
OutStreamer.emitSymbolAttribute(Sym, MCSA_Local);
|
OutStreamer.emitSymbolAttribute(Sym, MCSA_Local);
|
||||||
OutStreamer.EmitValue(Imm.getExpr(), AlignSize);
|
OutStreamer.emitValue(Imm.getExpr(), AlignSize);
|
||||||
OutStreamer.emitCodeAlignment(AlignSize);
|
OutStreamer.emitCodeAlignment(AlignSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ bool MSP430AsmParser::ParseLiteralValues(unsigned Size, SMLoc L) {
|
|||||||
const MCExpr *Value;
|
const MCExpr *Value;
|
||||||
if (getParser().parseExpression(Value))
|
if (getParser().parseExpression(Value))
|
||||||
return true;
|
return true;
|
||||||
getParser().getStreamer().EmitValue(Value, Size, L);
|
getParser().getStreamer().emitValue(Value, Size, L);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
return (parseMany(parseOne));
|
return (parseMany(parseOne));
|
||||||
|
@ -43,26 +43,26 @@ MSP430TargetELFStreamer::MSP430TargetELFStreamer(MCStreamer &S,
|
|||||||
Streamer.SwitchSection(AttributeSection);
|
Streamer.SwitchSection(AttributeSection);
|
||||||
|
|
||||||
// Format version.
|
// Format version.
|
||||||
Streamer.EmitIntValue(0x41, 1);
|
Streamer.emitIntValue(0x41, 1);
|
||||||
// Subsection length.
|
// Subsection length.
|
||||||
Streamer.EmitIntValue(22, 4);
|
Streamer.emitIntValue(22, 4);
|
||||||
// Vendor name string, zero-terminated.
|
// Vendor name string, zero-terminated.
|
||||||
Streamer.emitBytes("mspabi");
|
Streamer.emitBytes("mspabi");
|
||||||
Streamer.EmitIntValue(0, 1);
|
Streamer.emitIntValue(0, 1);
|
||||||
|
|
||||||
// Attribute vector scope tag. 1 stands for the entire file.
|
// Attribute vector scope tag. 1 stands for the entire file.
|
||||||
Streamer.EmitIntValue(1, 1);
|
Streamer.emitIntValue(1, 1);
|
||||||
// Attribute vector length.
|
// Attribute vector length.
|
||||||
Streamer.EmitIntValue(11, 4);
|
Streamer.emitIntValue(11, 4);
|
||||||
// OFBA_MSPABI_Tag_ISA(4) = 1, MSP430
|
// OFBA_MSPABI_Tag_ISA(4) = 1, MSP430
|
||||||
Streamer.EmitIntValue(4, 1);
|
Streamer.emitIntValue(4, 1);
|
||||||
Streamer.EmitIntValue(1, 1);
|
Streamer.emitIntValue(1, 1);
|
||||||
// OFBA_MSPABI_Tag_Code_Model(6) = 1, Small
|
// OFBA_MSPABI_Tag_Code_Model(6) = 1, Small
|
||||||
Streamer.EmitIntValue(6, 1);
|
Streamer.emitIntValue(6, 1);
|
||||||
Streamer.EmitIntValue(1, 1);
|
Streamer.emitIntValue(1, 1);
|
||||||
// OFBA_MSPABI_Tag_Data_Model(8) = 1, Small
|
// OFBA_MSPABI_Tag_Data_Model(8) = 1, Small
|
||||||
Streamer.EmitIntValue(8, 1);
|
Streamer.emitIntValue(8, 1);
|
||||||
Streamer.EmitIntValue(1, 1);
|
Streamer.emitIntValue(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCELFStreamer &MSP430TargetELFStreamer::getStreamer() {
|
MCELFStreamer &MSP430TargetELFStreamer::getStreamer() {
|
||||||
|
@ -3389,7 +3389,7 @@ bool MipsAsmParser::expandLoadSingleImmToFPR(MCInst &Inst, SMLoc IDLoc,
|
|||||||
|
|
||||||
getStreamer().SwitchSection(ReadOnlySection);
|
getStreamer().SwitchSection(ReadOnlySection);
|
||||||
getStreamer().emitLabel(Sym, IDLoc);
|
getStreamer().emitLabel(Sym, IDLoc);
|
||||||
getStreamer().EmitIntValue(ImmOp32, 4);
|
getStreamer().emitIntValue(ImmOp32, 4);
|
||||||
getStreamer().SwitchSection(CS);
|
getStreamer().SwitchSection(CS);
|
||||||
|
|
||||||
if (emitPartialAddress(TOut, IDLoc, Sym))
|
if (emitPartialAddress(TOut, IDLoc, Sym))
|
||||||
@ -3442,7 +3442,7 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
|
|||||||
getStreamer().SwitchSection(ReadOnlySection);
|
getStreamer().SwitchSection(ReadOnlySection);
|
||||||
getStreamer().emitLabel(Sym, IDLoc);
|
getStreamer().emitLabel(Sym, IDLoc);
|
||||||
getStreamer().emitValueToAlignment(8);
|
getStreamer().emitValueToAlignment(8);
|
||||||
getStreamer().EmitIntValue(ImmOp64, 8);
|
getStreamer().emitIntValue(ImmOp64, 8);
|
||||||
getStreamer().SwitchSection(CS);
|
getStreamer().SwitchSection(CS);
|
||||||
|
|
||||||
unsigned TmpReg = getATReg(IDLoc);
|
unsigned TmpReg = getATReg(IDLoc);
|
||||||
@ -3525,7 +3525,7 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
|
|||||||
getStreamer().SwitchSection(ReadOnlySection);
|
getStreamer().SwitchSection(ReadOnlySection);
|
||||||
getStreamer().emitLabel(Sym, IDLoc);
|
getStreamer().emitLabel(Sym, IDLoc);
|
||||||
getStreamer().emitValueToAlignment(8);
|
getStreamer().emitValueToAlignment(8);
|
||||||
getStreamer().EmitIntValue(ImmOp64, 8);
|
getStreamer().emitIntValue(ImmOp64, 8);
|
||||||
getStreamer().SwitchSection(CS);
|
getStreamer().SwitchSection(CS);
|
||||||
|
|
||||||
if (emitPartialAddress(TOut, IDLoc, Sym))
|
if (emitPartialAddress(TOut, IDLoc, Sym))
|
||||||
|
@ -57,17 +57,17 @@ namespace llvm {
|
|||||||
|
|
||||||
MCStreamer &operator<<(MCStreamer &OS, MipsABIFlagsSection &ABIFlagsSection) {
|
MCStreamer &operator<<(MCStreamer &OS, MipsABIFlagsSection &ABIFlagsSection) {
|
||||||
// Write out a Elf_Internal_ABIFlags_v0 struct
|
// Write out a Elf_Internal_ABIFlags_v0 struct
|
||||||
OS.EmitIntValue(ABIFlagsSection.getVersionValue(), 2); // version
|
OS.emitIntValue(ABIFlagsSection.getVersionValue(), 2); // version
|
||||||
OS.EmitIntValue(ABIFlagsSection.getISALevelValue(), 1); // isa_level
|
OS.emitIntValue(ABIFlagsSection.getISALevelValue(), 1); // isa_level
|
||||||
OS.EmitIntValue(ABIFlagsSection.getISARevisionValue(), 1); // isa_rev
|
OS.emitIntValue(ABIFlagsSection.getISARevisionValue(), 1); // isa_rev
|
||||||
OS.EmitIntValue(ABIFlagsSection.getGPRSizeValue(), 1); // gpr_size
|
OS.emitIntValue(ABIFlagsSection.getGPRSizeValue(), 1); // gpr_size
|
||||||
OS.EmitIntValue(ABIFlagsSection.getCPR1SizeValue(), 1); // cpr1_size
|
OS.emitIntValue(ABIFlagsSection.getCPR1SizeValue(), 1); // cpr1_size
|
||||||
OS.EmitIntValue(ABIFlagsSection.getCPR2SizeValue(), 1); // cpr2_size
|
OS.emitIntValue(ABIFlagsSection.getCPR2SizeValue(), 1); // cpr2_size
|
||||||
OS.EmitIntValue(ABIFlagsSection.getFpABIValue(), 1); // fp_abi
|
OS.emitIntValue(ABIFlagsSection.getFpABIValue(), 1); // fp_abi
|
||||||
OS.EmitIntValue(ABIFlagsSection.getISAExtensionValue(), 4); // isa_ext
|
OS.emitIntValue(ABIFlagsSection.getISAExtensionValue(), 4); // isa_ext
|
||||||
OS.EmitIntValue(ABIFlagsSection.getASESetValue(), 4); // ases
|
OS.emitIntValue(ABIFlagsSection.getASESetValue(), 4); // ases
|
||||||
OS.EmitIntValue(ABIFlagsSection.getFlags1Value(), 4); // flags1
|
OS.emitIntValue(ABIFlagsSection.getFlags1Value(), 4); // flags1
|
||||||
OS.EmitIntValue(ABIFlagsSection.getFlags2Value(), 4); // flags2
|
OS.emitIntValue(ABIFlagsSection.getFlags2Value(), 4); // flags2
|
||||||
return OS;
|
return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ void MipsELFStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
|
|||||||
Labels.clear();
|
Labels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsELFStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
|
void MipsELFStreamer::emitIntValue(uint64_t Value, unsigned Size) {
|
||||||
MCELFStreamer::EmitIntValue(Value, Size);
|
MCELFStreamer::emitIntValue(Value, Size);
|
||||||
Labels.clear();
|
Labels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
/// candidates for marking as microMIPS when .word/.long/.4byte etc
|
/// candidates for marking as microMIPS when .word/.long/.4byte etc
|
||||||
/// directives are emitted.
|
/// directives are emitted.
|
||||||
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override;
|
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override;
|
||||||
void EmitIntValue(uint64_t Value, unsigned Size) override;
|
void emitIntValue(uint64_t Value, unsigned Size) override;
|
||||||
|
|
||||||
// Overriding these functions allows us to avoid recording of these labels
|
// Overriding these functions allows us to avoid recording of these labels
|
||||||
// in EmitLabel and later marking them as microMIPS.
|
// in EmitLabel and later marking them as microMIPS.
|
||||||
|
@ -40,17 +40,17 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
|||||||
Sec->setAlignment(Align(8));
|
Sec->setAlignment(Align(8));
|
||||||
Streamer->SwitchSection(Sec);
|
Streamer->SwitchSection(Sec);
|
||||||
|
|
||||||
Streamer->EmitIntValue(ELF::ODK_REGINFO, 1); // kind
|
Streamer->emitIntValue(ELF::ODK_REGINFO, 1); // kind
|
||||||
Streamer->EmitIntValue(40, 1); // size
|
Streamer->emitIntValue(40, 1); // size
|
||||||
Streamer->EmitIntValue(0, 2); // section
|
Streamer->emitIntValue(0, 2); // section
|
||||||
Streamer->EmitIntValue(0, 4); // info
|
Streamer->emitIntValue(0, 4); // info
|
||||||
Streamer->EmitIntValue(ri_gprmask, 4);
|
Streamer->emitIntValue(ri_gprmask, 4);
|
||||||
Streamer->EmitIntValue(0, 4); // pad
|
Streamer->emitIntValue(0, 4); // pad
|
||||||
Streamer->EmitIntValue(ri_cprmask[0], 4);
|
Streamer->emitIntValue(ri_cprmask[0], 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[1], 4);
|
Streamer->emitIntValue(ri_cprmask[1], 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[2], 4);
|
Streamer->emitIntValue(ri_cprmask[2], 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[3], 4);
|
Streamer->emitIntValue(ri_cprmask[3], 4);
|
||||||
Streamer->EmitIntValue(ri_gp_value, 8);
|
Streamer->emitIntValue(ri_gp_value, 8);
|
||||||
} else {
|
} else {
|
||||||
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
|
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
|
||||||
ELF::SHF_ALLOC, 24, "");
|
ELF::SHF_ALLOC, 24, "");
|
||||||
@ -58,13 +58,13 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
|||||||
Sec->setAlignment(MTS->getABI().IsN32() ? Align(8) : Align(4));
|
Sec->setAlignment(MTS->getABI().IsN32() ? Align(8) : Align(4));
|
||||||
Streamer->SwitchSection(Sec);
|
Streamer->SwitchSection(Sec);
|
||||||
|
|
||||||
Streamer->EmitIntValue(ri_gprmask, 4);
|
Streamer->emitIntValue(ri_gprmask, 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[0], 4);
|
Streamer->emitIntValue(ri_cprmask[0], 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[1], 4);
|
Streamer->emitIntValue(ri_cprmask[1], 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[2], 4);
|
Streamer->emitIntValue(ri_cprmask[2], 4);
|
||||||
Streamer->EmitIntValue(ri_cprmask[3], 4);
|
Streamer->emitIntValue(ri_cprmask[3], 4);
|
||||||
assert((ri_gp_value & 0xffffffff) == ri_gp_value);
|
assert((ri_gp_value & 0xffffffff) == ri_gp_value);
|
||||||
Streamer->EmitIntValue(ri_gp_value, 4);
|
Streamer->emitIntValue(ri_gp_value, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
Streamer->PopSection();
|
Streamer->PopSection();
|
||||||
|
@ -999,15 +999,15 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
|
|||||||
|
|
||||||
OS.emitValueImpl(ExprRef, 4);
|
OS.emitValueImpl(ExprRef, 4);
|
||||||
|
|
||||||
OS.EmitIntValue(GPRInfoSet ? GPRBitMask : 0, 4); // reg_mask
|
OS.emitIntValue(GPRInfoSet ? GPRBitMask : 0, 4); // reg_mask
|
||||||
OS.EmitIntValue(GPRInfoSet ? GPROffset : 0, 4); // reg_offset
|
OS.emitIntValue(GPRInfoSet ? GPROffset : 0, 4); // reg_offset
|
||||||
|
|
||||||
OS.EmitIntValue(FPRInfoSet ? FPRBitMask : 0, 4); // fpreg_mask
|
OS.emitIntValue(FPRInfoSet ? FPRBitMask : 0, 4); // fpreg_mask
|
||||||
OS.EmitIntValue(FPRInfoSet ? FPROffset : 0, 4); // fpreg_offset
|
OS.emitIntValue(FPRInfoSet ? FPROffset : 0, 4); // fpreg_offset
|
||||||
|
|
||||||
OS.EmitIntValue(FrameInfoSet ? FrameOffset : 0, 4); // frame_offset
|
OS.emitIntValue(FrameInfoSet ? FrameOffset : 0, 4); // frame_offset
|
||||||
OS.EmitIntValue(FrameInfoSet ? FrameReg : 0, 4); // frame_reg
|
OS.emitIntValue(FrameInfoSet ? FrameReg : 0, 4); // frame_reg
|
||||||
OS.EmitIntValue(FrameInfoSet ? ReturnReg : 0, 4); // return_reg
|
OS.emitIntValue(FrameInfoSet ? ReturnReg : 0, 4); // return_reg
|
||||||
|
|
||||||
// The .end directive marks the end of a procedure. Invalidate
|
// The .end directive marks the end of a procedure. Invalidate
|
||||||
// the information gathered up until this point.
|
// the information gathered up until this point.
|
||||||
|
@ -1679,9 +1679,9 @@ bool PPCAsmParser::ParseDirectiveWord(unsigned Size, AsmToken ID) {
|
|||||||
if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
|
if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
|
||||||
return Error(ExprLoc, "literal value out of range for '" +
|
return Error(ExprLoc, "literal value out of range for '" +
|
||||||
ID.getIdentifier() + "' directive");
|
ID.getIdentifier() + "' directive");
|
||||||
getStreamer().EmitIntValue(IntValue, Size);
|
getStreamer().emitIntValue(IntValue, Size);
|
||||||
} else
|
} else
|
||||||
getStreamer().EmitValue(Value, Size, ExprLoc);
|
getStreamer().emitValue(Value, Size, ExprLoc);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -936,7 +936,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
|
|||||||
MCSymbolRefExpr::create(GOTRef, OutContext),
|
MCSymbolRefExpr::create(GOTRef, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
OutStreamer->emitLabel(GOTRef);
|
OutStreamer->emitLabel(GOTRef);
|
||||||
OutStreamer->EmitValue(OffsExpr, 4);
|
OutStreamer->emitValue(OffsExpr, 4);
|
||||||
OutStreamer->emitLabel(NextInstr);
|
OutStreamer->emitLabel(NextInstr);
|
||||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::MFLR)
|
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::MFLR)
|
||||||
.addReg(MI->getOperand(0).getReg()));
|
.addReg(MI->getOperand(0).getReg()));
|
||||||
@ -1343,7 +1343,7 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
|
|||||||
OutContext),
|
OutContext),
|
||||||
MCSymbolRefExpr::create(PICBase, OutContext),
|
MCSymbolRefExpr::create(PICBase, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
OutStreamer->EmitValue(OffsExpr, 4);
|
OutStreamer->emitValue(OffsExpr, 4);
|
||||||
OutStreamer->emitLabel(CurrentFnSym);
|
OutStreamer->emitLabel(CurrentFnSym);
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
@ -1369,7 +1369,7 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
|
|||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
OutStreamer->emitLabel(PPCFI->getTOCOffsetSymbol());
|
OutStreamer->emitLabel(PPCFI->getTOCOffsetSymbol());
|
||||||
OutStreamer->EmitValue(TOCDeltaExpr, 8);
|
OutStreamer->emitValue(TOCDeltaExpr, 8);
|
||||||
}
|
}
|
||||||
return AsmPrinter::emitFunctionEntryLabel();
|
return AsmPrinter::emitFunctionEntryLabel();
|
||||||
}
|
}
|
||||||
@ -1384,15 +1384,15 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
|
|||||||
MCSymbol *Symbol1 = CurrentFnSymForSize;
|
MCSymbol *Symbol1 = CurrentFnSymForSize;
|
||||||
// Generates a R_PPC64_ADDR64 (from FK_DATA_8) relocation for the function
|
// Generates a R_PPC64_ADDR64 (from FK_DATA_8) relocation for the function
|
||||||
// entry point.
|
// entry point.
|
||||||
OutStreamer->EmitValue(MCSymbolRefExpr::create(Symbol1, OutContext),
|
OutStreamer->emitValue(MCSymbolRefExpr::create(Symbol1, OutContext),
|
||||||
8 /*size*/);
|
8 /*size*/);
|
||||||
MCSymbol *Symbol2 = OutContext.getOrCreateSymbol(StringRef(".TOC."));
|
MCSymbol *Symbol2 = OutContext.getOrCreateSymbol(StringRef(".TOC."));
|
||||||
// Generates a R_PPC64_TOC relocation for TOC base insertion.
|
// Generates a R_PPC64_TOC relocation for TOC base insertion.
|
||||||
OutStreamer->EmitValue(
|
OutStreamer->emitValue(
|
||||||
MCSymbolRefExpr::create(Symbol2, MCSymbolRefExpr::VK_PPC_TOCBASE, OutContext),
|
MCSymbolRefExpr::create(Symbol2, MCSymbolRefExpr::VK_PPC_TOCBASE, OutContext),
|
||||||
8/*size*/);
|
8/*size*/);
|
||||||
// Emit a null environment pointer.
|
// Emit a null environment pointer.
|
||||||
OutStreamer->EmitIntValue(0, 8 /* size */);
|
OutStreamer->emitIntValue(0, 8 /* size */);
|
||||||
OutStreamer->SwitchSection(Current.first, Current.second);
|
OutStreamer->SwitchSection(Current.first, Current.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1539,8 +1539,8 @@ void PPCLinuxAsmPrinter::emitFunctionBodyEnd() {
|
|||||||
// the PPC64 ELF ABI (this is a low-priority item because GDB does not
|
// the PPC64 ELF ABI (this is a low-priority item because GDB does not
|
||||||
// currently make use of these fields).
|
// currently make use of these fields).
|
||||||
if (Subtarget->isPPC64()) {
|
if (Subtarget->isPPC64()) {
|
||||||
OutStreamer->EmitIntValue(0, 4/*size*/);
|
OutStreamer->emitIntValue(0, 4/*size*/);
|
||||||
OutStreamer->EmitIntValue(0, 8/*size*/);
|
OutStreamer->emitIntValue(0, 8/*size*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1647,16 +1647,16 @@ void PPCAIXAsmPrinter::emitFunctionDescriptor() {
|
|||||||
cast<MCSymbolXCOFF>(CurrentFnDescSym)->getContainingCsect());
|
cast<MCSymbolXCOFF>(CurrentFnDescSym)->getContainingCsect());
|
||||||
OutStreamer->emitLabel(CurrentFnDescSym);
|
OutStreamer->emitLabel(CurrentFnDescSym);
|
||||||
// Emit function entry point address.
|
// Emit function entry point address.
|
||||||
OutStreamer->EmitValue(MCSymbolRefExpr::create(CurrentFnSym, OutContext),
|
OutStreamer->emitValue(MCSymbolRefExpr::create(CurrentFnSym, OutContext),
|
||||||
PointerSize);
|
PointerSize);
|
||||||
// Emit TOC base address.
|
// Emit TOC base address.
|
||||||
const MCSymbol *TOCBaseSym =
|
const MCSymbol *TOCBaseSym =
|
||||||
cast<MCSectionXCOFF>(getObjFileLowering().getTOCBaseSection())
|
cast<MCSectionXCOFF>(getObjFileLowering().getTOCBaseSection())
|
||||||
->getQualNameSymbol();
|
->getQualNameSymbol();
|
||||||
OutStreamer->EmitValue(MCSymbolRefExpr::create(TOCBaseSym, OutContext),
|
OutStreamer->emitValue(MCSymbolRefExpr::create(TOCBaseSym, OutContext),
|
||||||
PointerSize);
|
PointerSize);
|
||||||
// Emit a null environment pointer.
|
// Emit a null environment pointer.
|
||||||
OutStreamer->EmitIntValue(0, PointerSize);
|
OutStreamer->emitIntValue(0, PointerSize);
|
||||||
|
|
||||||
OutStreamer->SwitchSection(Current.first, Current.second);
|
OutStreamer->SwitchSection(Current.first, Current.second);
|
||||||
}
|
}
|
||||||
|
@ -695,7 +695,7 @@ void SystemZAsmPrinter::emitMachineConstantPoolValue(
|
|||||||
OutContext);
|
OutContext);
|
||||||
uint64_t Size = getDataLayout().getTypeAllocSize(ZCPV->getType());
|
uint64_t Size = getDataLayout().getTypeAllocSize(ZCPV->getType());
|
||||||
|
|
||||||
OutStreamer->EmitValue(Expr, Size);
|
OutStreamer->emitValue(Expr, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemZAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
bool SystemZAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||||
|
@ -792,7 +792,7 @@ public:
|
|||||||
return error("Cannot parse .int expression: ", Lexer.getTok());
|
return error("Cannot parse .int expression: ", Lexer.getTok());
|
||||||
size_t NumBits = 0;
|
size_t NumBits = 0;
|
||||||
DirectiveID.getString().drop_front(4).getAsInteger(10, NumBits);
|
DirectiveID.getString().drop_front(4).getAsInteger(10, NumBits);
|
||||||
Out.EmitValue(Val, NumBits / 8, End);
|
Out.emitValue(Val, NumBits / 8, End);
|
||||||
return expect(AsmToken::EndOfStatement, "EOL");
|
return expect(AsmToken::EndOfStatement, "EOL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ WebAssemblyTargetStreamer::WebAssemblyTargetStreamer(MCStreamer &S)
|
|||||||
: MCTargetStreamer(S) {}
|
: MCTargetStreamer(S) {}
|
||||||
|
|
||||||
void WebAssemblyTargetStreamer::emitValueType(wasm::ValType Type) {
|
void WebAssemblyTargetStreamer::emitValueType(wasm::ValType Type) {
|
||||||
Streamer.EmitIntValue(uint8_t(Type), 1);
|
Streamer.emitIntValue(uint8_t(Type), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebAssemblyTargetAsmStreamer::WebAssemblyTargetAsmStreamer(
|
WebAssemblyTargetAsmStreamer::WebAssemblyTargetAsmStreamer(
|
||||||
|
@ -269,7 +269,7 @@ void WebAssemblyAsmPrinter::EmitTargetFeatures(Module &M) {
|
|||||||
|
|
||||||
OutStreamer->emitULEB128IntValue(EmittedFeatures.size());
|
OutStreamer->emitULEB128IntValue(EmittedFeatures.size());
|
||||||
for (auto &F : EmittedFeatures) {
|
for (auto &F : EmittedFeatures) {
|
||||||
OutStreamer->EmitIntValue(F.Prefix, 1);
|
OutStreamer->emitIntValue(F.Prefix, 1);
|
||||||
OutStreamer->emitULEB128IntValue(F.Name.size());
|
OutStreamer->emitULEB128IntValue(F.Name.size());
|
||||||
OutStreamer->emitBytes(F.Name);
|
OutStreamer->emitBytes(F.Name);
|
||||||
}
|
}
|
||||||
|
@ -372,13 +372,13 @@ void FPOStateMachine::emitFrameDataRecord(MCStreamer &OS, MCSymbol *Label) {
|
|||||||
|
|
||||||
OS.emitAbsoluteSymbolDiff(Label, FPO->Begin, 4); // RvaStart
|
OS.emitAbsoluteSymbolDiff(Label, FPO->Begin, 4); // RvaStart
|
||||||
OS.emitAbsoluteSymbolDiff(FPO->End, Label, 4); // CodeSize
|
OS.emitAbsoluteSymbolDiff(FPO->End, Label, 4); // CodeSize
|
||||||
OS.EmitIntValue(LocalSize, 4);
|
OS.emitIntValue(LocalSize, 4);
|
||||||
OS.EmitIntValue(FPO->ParamsSize, 4);
|
OS.emitIntValue(FPO->ParamsSize, 4);
|
||||||
OS.EmitIntValue(MaxStackSize, 4);
|
OS.emitIntValue(MaxStackSize, 4);
|
||||||
OS.EmitIntValue(FrameFuncStrTabOff, 4); // FrameFunc
|
OS.emitIntValue(FrameFuncStrTabOff, 4); // FrameFunc
|
||||||
OS.emitAbsoluteSymbolDiff(FPO->PrologueEnd, Label, 2);
|
OS.emitAbsoluteSymbolDiff(FPO->PrologueEnd, Label, 2);
|
||||||
OS.EmitIntValue(SavedRegSize, 2);
|
OS.emitIntValue(SavedRegSize, 2);
|
||||||
OS.EmitIntValue(CurFlags, 4);
|
OS.emitIntValue(CurFlags, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute and emit the real CodeView FrameData subsection.
|
/// Compute and emit the real CodeView FrameData subsection.
|
||||||
@ -398,12 +398,12 @@ bool X86WinCOFFTargetStreamer::emitFPOData(const MCSymbol *ProcSym, SMLoc L) {
|
|||||||
MCSymbol *FrameBegin = Ctx.createTempSymbol(),
|
MCSymbol *FrameBegin = Ctx.createTempSymbol(),
|
||||||
*FrameEnd = Ctx.createTempSymbol();
|
*FrameEnd = Ctx.createTempSymbol();
|
||||||
|
|
||||||
OS.EmitIntValue(unsigned(DebugSubsectionKind::FrameData), 4);
|
OS.emitIntValue(unsigned(DebugSubsectionKind::FrameData), 4);
|
||||||
OS.emitAbsoluteSymbolDiff(FrameEnd, FrameBegin, 4);
|
OS.emitAbsoluteSymbolDiff(FrameEnd, FrameBegin, 4);
|
||||||
OS.emitLabel(FrameBegin);
|
OS.emitLabel(FrameBegin);
|
||||||
|
|
||||||
// Start with the RVA of the function in question.
|
// Start with the RVA of the function in question.
|
||||||
OS.EmitValue(MCSymbolRefExpr::create(FPO->Function,
|
OS.emitValue(MCSymbolRefExpr::create(FPO->Function,
|
||||||
MCSymbolRefExpr::VK_COFF_IMGREL32, Ctx),
|
MCSymbolRefExpr::VK_COFF_IMGREL32, Ctx),
|
||||||
4);
|
4);
|
||||||
|
|
||||||
|
@ -598,15 +598,15 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
|
|||||||
// Emitting note header.
|
// Emitting note header.
|
||||||
int WordSize = TT.isArch64Bit() ? 8 : 4;
|
int WordSize = TT.isArch64Bit() ? 8 : 4;
|
||||||
emitAlignment(WordSize == 4 ? Align(4) : Align(8));
|
emitAlignment(WordSize == 4 ? Align(4) : Align(8));
|
||||||
OutStreamer->EmitIntValue(4, 4 /*size*/); // data size for "GNU\0"
|
OutStreamer->emitIntValue(4, 4 /*size*/); // data size for "GNU\0"
|
||||||
OutStreamer->EmitIntValue(8 + WordSize, 4 /*size*/); // Elf_Prop size
|
OutStreamer->emitIntValue(8 + WordSize, 4 /*size*/); // Elf_Prop size
|
||||||
OutStreamer->EmitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4 /*size*/);
|
OutStreamer->emitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4 /*size*/);
|
||||||
OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
|
OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
|
||||||
|
|
||||||
// Emitting an Elf_Prop for the CET properties.
|
// Emitting an Elf_Prop for the CET properties.
|
||||||
OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_X86_FEATURE_1_AND, 4);
|
OutStreamer->emitIntValue(ELF::GNU_PROPERTY_X86_FEATURE_1_AND, 4);
|
||||||
OutStreamer->EmitIntValue(4, 4); // data size
|
OutStreamer->emitIntValue(4, 4); // data size
|
||||||
OutStreamer->EmitIntValue(FeatureFlagsAnd, 4); // data
|
OutStreamer->emitIntValue(FeatureFlagsAnd, 4); // data
|
||||||
emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding
|
emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding
|
||||||
|
|
||||||
OutStreamer->endSection(Nt);
|
OutStreamer->endSection(Nt);
|
||||||
@ -662,7 +662,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
|
|||||||
|
|
||||||
if (MCSym.getInt())
|
if (MCSym.getInt())
|
||||||
// External to current translation unit.
|
// External to current translation unit.
|
||||||
OutStreamer.EmitIntValue(0, 4/*size*/);
|
OutStreamer.emitIntValue(0, 4/*size*/);
|
||||||
else
|
else
|
||||||
// Internal to current translation unit.
|
// Internal to current translation unit.
|
||||||
//
|
//
|
||||||
@ -670,7 +670,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
|
|||||||
// pointers need to be indirect and pc-rel. We accomplish this by
|
// pointers need to be indirect and pc-rel. We accomplish this by
|
||||||
// using NLPs; however, sometimes the types are local to the file.
|
// using NLPs; however, sometimes the types are local to the file.
|
||||||
// We need to fill in the value for the NLP in those cases.
|
// We need to fill in the value for the NLP in those cases.
|
||||||
OutStreamer.EmitValue(
|
OutStreamer.emitValue(
|
||||||
MCSymbolRefExpr::create(MCSym.getPointer(), OutStreamer.getContext()),
|
MCSymbolRefExpr::create(MCSym.getPointer(), OutStreamer.getContext()),
|
||||||
4 /*size*/);
|
4 /*size*/);
|
||||||
}
|
}
|
||||||
|
@ -333,14 +333,14 @@ void DwarfStreamer::emitRangesEntries(
|
|||||||
if (!(Range.StartAddress + OrigLowPc >= FuncRange.start() &&
|
if (!(Range.StartAddress + OrigLowPc >= FuncRange.start() &&
|
||||||
Range.EndAddress + OrigLowPc <= FuncRange.stop()))
|
Range.EndAddress + OrigLowPc <= FuncRange.stop()))
|
||||||
warn("inconsistent range data.", "emitting debug_ranges");
|
warn("inconsistent range data.", "emitting debug_ranges");
|
||||||
MS->EmitIntValue(Range.StartAddress + PcOffset, AddressSize);
|
MS->emitIntValue(Range.StartAddress + PcOffset, AddressSize);
|
||||||
MS->EmitIntValue(Range.EndAddress + PcOffset, AddressSize);
|
MS->emitIntValue(Range.EndAddress + PcOffset, AddressSize);
|
||||||
RangesSectionSize += 2 * AddressSize;
|
RangesSectionSize += 2 * AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the terminator entry.
|
// Add the terminator entry.
|
||||||
MS->EmitIntValue(0, AddressSize);
|
MS->emitIntValue(0, AddressSize);
|
||||||
MS->EmitIntValue(0, AddressSize);
|
MS->emitIntValue(0, AddressSize);
|
||||||
RangesSectionSize += 2 * AddressSize;
|
RangesSectionSize += 2 * AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,15 +394,15 @@ void DwarfStreamer::emitUnitRangesEntries(CompileUnit &Unit,
|
|||||||
for (auto Range = Ranges.begin(), End = Ranges.end(); Range != End;
|
for (auto Range = Ranges.begin(), End = Ranges.end(); Range != End;
|
||||||
++Range) {
|
++Range) {
|
||||||
uint64_t RangeStart = Range->first;
|
uint64_t RangeStart = Range->first;
|
||||||
MS->EmitIntValue(RangeStart, AddressSize);
|
MS->emitIntValue(RangeStart, AddressSize);
|
||||||
while ((Range + 1) != End && Range->second == (Range + 1)->first)
|
while ((Range + 1) != End && Range->second == (Range + 1)->first)
|
||||||
++Range;
|
++Range;
|
||||||
MS->EmitIntValue(Range->second - RangeStart, AddressSize);
|
MS->emitIntValue(Range->second - RangeStart, AddressSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit terminator
|
// Emit terminator
|
||||||
Asm->OutStreamer->EmitIntValue(0, AddressSize);
|
Asm->OutStreamer->emitIntValue(0, AddressSize);
|
||||||
Asm->OutStreamer->EmitIntValue(0, AddressSize);
|
Asm->OutStreamer->emitIntValue(0, AddressSize);
|
||||||
Asm->OutStreamer->emitLabel(EndLabel);
|
Asm->OutStreamer->emitLabel(EndLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,16 +414,16 @@ void DwarfStreamer::emitUnitRangesEntries(CompileUnit &Unit,
|
|||||||
int64_t PcOffset = -Unit.getLowPc();
|
int64_t PcOffset = -Unit.getLowPc();
|
||||||
// Emit coalesced ranges.
|
// Emit coalesced ranges.
|
||||||
for (auto Range = Ranges.begin(), End = Ranges.end(); Range != End; ++Range) {
|
for (auto Range = Ranges.begin(), End = Ranges.end(); Range != End; ++Range) {
|
||||||
MS->EmitIntValue(Range->first + PcOffset, AddressSize);
|
MS->emitIntValue(Range->first + PcOffset, AddressSize);
|
||||||
while (Range + 1 != End && Range->second == (Range + 1)->first)
|
while (Range + 1 != End && Range->second == (Range + 1)->first)
|
||||||
++Range;
|
++Range;
|
||||||
MS->EmitIntValue(Range->second + PcOffset, AddressSize);
|
MS->emitIntValue(Range->second + PcOffset, AddressSize);
|
||||||
RangesSectionSize += 2 * AddressSize;
|
RangesSectionSize += 2 * AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the terminator entry.
|
// Add the terminator entry.
|
||||||
MS->EmitIntValue(0, AddressSize);
|
MS->emitIntValue(0, AddressSize);
|
||||||
MS->EmitIntValue(0, AddressSize);
|
MS->emitIntValue(0, AddressSize);
|
||||||
RangesSectionSize += 2 * AddressSize;
|
RangesSectionSize += 2 * AddressSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,22 +464,22 @@ void DwarfStreamer::emitLocationsForUnit(
|
|||||||
LocSectionSize += 2 * AddressSize;
|
LocSectionSize += 2 * AddressSize;
|
||||||
// End of list entry.
|
// End of list entry.
|
||||||
if (Low == 0 && High == 0) {
|
if (Low == 0 && High == 0) {
|
||||||
Asm->OutStreamer->EmitIntValue(0, AddressSize);
|
Asm->OutStreamer->emitIntValue(0, AddressSize);
|
||||||
Asm->OutStreamer->EmitIntValue(0, AddressSize);
|
Asm->OutStreamer->emitIntValue(0, AddressSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Base address selection entry.
|
// Base address selection entry.
|
||||||
if (Low == BaseAddressMarker) {
|
if (Low == BaseAddressMarker) {
|
||||||
Asm->OutStreamer->EmitIntValue(BaseAddressMarker, AddressSize);
|
Asm->OutStreamer->emitIntValue(BaseAddressMarker, AddressSize);
|
||||||
Asm->OutStreamer->EmitIntValue(High + Attr.second, AddressSize);
|
Asm->OutStreamer->emitIntValue(High + Attr.second, AddressSize);
|
||||||
LocPcOffset = 0;
|
LocPcOffset = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Location list entry.
|
// Location list entry.
|
||||||
Asm->OutStreamer->EmitIntValue(Low + LocPcOffset, AddressSize);
|
Asm->OutStreamer->emitIntValue(Low + LocPcOffset, AddressSize);
|
||||||
Asm->OutStreamer->EmitIntValue(High + LocPcOffset, AddressSize);
|
Asm->OutStreamer->emitIntValue(High + LocPcOffset, AddressSize);
|
||||||
uint64_t Length = Data.getU16(&Offset);
|
uint64_t Length = Data.getU16(&Offset);
|
||||||
Asm->OutStreamer->EmitIntValue(Length, 2);
|
Asm->OutStreamer->emitIntValue(Length, 2);
|
||||||
// Copy the bytes into to the buffer, process them, emit them.
|
// Copy the bytes into to the buffer, process them, emit them.
|
||||||
Buffer.reserve(Length);
|
Buffer.reserve(Length);
|
||||||
Buffer.resize(0);
|
Buffer.resize(0);
|
||||||
@ -540,10 +540,10 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
|
|||||||
|
|
||||||
int64_t AddressDelta;
|
int64_t AddressDelta;
|
||||||
if (Address == -1ULL) {
|
if (Address == -1ULL) {
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_extended_op, 1);
|
MS->emitIntValue(dwarf::DW_LNS_extended_op, 1);
|
||||||
MS->emitULEB128IntValue(PointerSize + 1);
|
MS->emitULEB128IntValue(PointerSize + 1);
|
||||||
MS->EmitIntValue(dwarf::DW_LNE_set_address, 1);
|
MS->emitIntValue(dwarf::DW_LNE_set_address, 1);
|
||||||
MS->EmitIntValue(Row.Address.Address, PointerSize);
|
MS->emitIntValue(Row.Address.Address, PointerSize);
|
||||||
LineSectionSize += 2 + PointerSize + getULEB128Size(PointerSize + 1);
|
LineSectionSize += 2 + PointerSize + getULEB128Size(PointerSize + 1);
|
||||||
AddressDelta = 0;
|
AddressDelta = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -557,13 +557,13 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
|
|||||||
|
|
||||||
if (FileNum != Row.File) {
|
if (FileNum != Row.File) {
|
||||||
FileNum = Row.File;
|
FileNum = Row.File;
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_set_file, 1);
|
MS->emitIntValue(dwarf::DW_LNS_set_file, 1);
|
||||||
MS->emitULEB128IntValue(FileNum);
|
MS->emitULEB128IntValue(FileNum);
|
||||||
LineSectionSize += 1 + getULEB128Size(FileNum);
|
LineSectionSize += 1 + getULEB128Size(FileNum);
|
||||||
}
|
}
|
||||||
if (Column != Row.Column) {
|
if (Column != Row.Column) {
|
||||||
Column = Row.Column;
|
Column = Row.Column;
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_set_column, 1);
|
MS->emitIntValue(dwarf::DW_LNS_set_column, 1);
|
||||||
MS->emitULEB128IntValue(Column);
|
MS->emitULEB128IntValue(Column);
|
||||||
LineSectionSize += 1 + getULEB128Size(Column);
|
LineSectionSize += 1 + getULEB128Size(Column);
|
||||||
}
|
}
|
||||||
@ -573,27 +573,27 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
|
|||||||
|
|
||||||
if (Isa != Row.Isa) {
|
if (Isa != Row.Isa) {
|
||||||
Isa = Row.Isa;
|
Isa = Row.Isa;
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_set_isa, 1);
|
MS->emitIntValue(dwarf::DW_LNS_set_isa, 1);
|
||||||
MS->emitULEB128IntValue(Isa);
|
MS->emitULEB128IntValue(Isa);
|
||||||
LineSectionSize += 1 + getULEB128Size(Isa);
|
LineSectionSize += 1 + getULEB128Size(Isa);
|
||||||
}
|
}
|
||||||
if (IsStatement != Row.IsStmt) {
|
if (IsStatement != Row.IsStmt) {
|
||||||
IsStatement = Row.IsStmt;
|
IsStatement = Row.IsStmt;
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_negate_stmt, 1);
|
MS->emitIntValue(dwarf::DW_LNS_negate_stmt, 1);
|
||||||
LineSectionSize += 1;
|
LineSectionSize += 1;
|
||||||
}
|
}
|
||||||
if (Row.BasicBlock) {
|
if (Row.BasicBlock) {
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_set_basic_block, 1);
|
MS->emitIntValue(dwarf::DW_LNS_set_basic_block, 1);
|
||||||
LineSectionSize += 1;
|
LineSectionSize += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Row.PrologueEnd) {
|
if (Row.PrologueEnd) {
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_set_prologue_end, 1);
|
MS->emitIntValue(dwarf::DW_LNS_set_prologue_end, 1);
|
||||||
LineSectionSize += 1;
|
LineSectionSize += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Row.EpilogueBegin) {
|
if (Row.EpilogueBegin) {
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
|
MS->emitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
|
||||||
LineSectionSize += 1;
|
LineSectionSize += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,12 +608,12 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
|
|||||||
RowsSinceLastSequence++;
|
RowsSinceLastSequence++;
|
||||||
} else {
|
} else {
|
||||||
if (LineDelta) {
|
if (LineDelta) {
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_advance_line, 1);
|
MS->emitIntValue(dwarf::DW_LNS_advance_line, 1);
|
||||||
MS->emitSLEB128IntValue(LineDelta);
|
MS->emitSLEB128IntValue(LineDelta);
|
||||||
LineSectionSize += 1 + getSLEB128Size(LineDelta);
|
LineSectionSize += 1 + getSLEB128Size(LineDelta);
|
||||||
}
|
}
|
||||||
if (AddressDelta) {
|
if (AddressDelta) {
|
||||||
MS->EmitIntValue(dwarf::DW_LNS_advance_pc, 1);
|
MS->emitIntValue(dwarf::DW_LNS_advance_pc, 1);
|
||||||
MS->emitULEB128IntValue(AddressDelta);
|
MS->emitULEB128IntValue(AddressDelta);
|
||||||
LineSectionSize += 1 + getULEB128Size(AddressDelta);
|
LineSectionSize += 1 + getULEB128Size(AddressDelta);
|
||||||
}
|
}
|
||||||
@ -813,9 +813,9 @@ void DwarfStreamer::emitFDE(uint32_t CIEOffset, uint32_t AddrSize,
|
|||||||
uint32_t Address, StringRef FDEBytes) {
|
uint32_t Address, StringRef FDEBytes) {
|
||||||
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
|
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
|
||||||
|
|
||||||
MS->EmitIntValue(FDEBytes.size() + 4 + AddrSize, 4);
|
MS->emitIntValue(FDEBytes.size() + 4 + AddrSize, 4);
|
||||||
MS->EmitIntValue(CIEOffset, 4);
|
MS->emitIntValue(CIEOffset, 4);
|
||||||
MS->EmitIntValue(Address, AddrSize);
|
MS->emitIntValue(Address, AddrSize);
|
||||||
MS->emitBytes(FDEBytes);
|
MS->emitBytes(FDEBytes);
|
||||||
FrameSectionSize += FDEBytes.size() + 8 + AddrSize;
|
FrameSectionSize += FDEBytes.size() + 8 + AddrSize;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ static void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
|
|||||||
while (Offset < Size) {
|
while (Offset < Size) {
|
||||||
auto OldOffset = Data.getU32(&Offset);
|
auto OldOffset = Data.getU32(&Offset);
|
||||||
auto NewOffset = OffsetRemapping[OldOffset];
|
auto NewOffset = OffsetRemapping[OldOffset];
|
||||||
Out.EmitIntValue(NewOffset, 4);
|
Out.emitIntValue(NewOffset, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ writeIndexTable(MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
|
|||||||
for (const auto &E : IndexEntries)
|
for (const auto &E : IndexEntries)
|
||||||
for (size_t i = 0; i != array_lengthof(E.second.Contributions); ++i)
|
for (size_t i = 0; i != array_lengthof(E.second.Contributions); ++i)
|
||||||
if (ContributionOffsets[i])
|
if (ContributionOffsets[i])
|
||||||
Out.EmitIntValue(E.second.Contributions[i].*Field, 4);
|
Out.emitIntValue(E.second.Contributions[i].*Field, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -317,23 +317,23 @@ writeIndex(MCStreamer &Out, MCSection *Section,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Out.SwitchSection(Section);
|
Out.SwitchSection(Section);
|
||||||
Out.EmitIntValue(2, 4); // Version
|
Out.emitIntValue(2, 4); // Version
|
||||||
Out.EmitIntValue(Columns, 4); // Columns
|
Out.emitIntValue(Columns, 4); // Columns
|
||||||
Out.EmitIntValue(IndexEntries.size(), 4); // Num Units
|
Out.emitIntValue(IndexEntries.size(), 4); // Num Units
|
||||||
Out.EmitIntValue(Buckets.size(), 4); // Num Buckets
|
Out.emitIntValue(Buckets.size(), 4); // Num Buckets
|
||||||
|
|
||||||
// Write the signatures.
|
// Write the signatures.
|
||||||
for (const auto &I : Buckets)
|
for (const auto &I : Buckets)
|
||||||
Out.EmitIntValue(I ? IndexEntries.begin()[I - 1].first : 0, 8);
|
Out.emitIntValue(I ? IndexEntries.begin()[I - 1].first : 0, 8);
|
||||||
|
|
||||||
// Write the indexes.
|
// Write the indexes.
|
||||||
for (const auto &I : Buckets)
|
for (const auto &I : Buckets)
|
||||||
Out.EmitIntValue(I, 4);
|
Out.emitIntValue(I, 4);
|
||||||
|
|
||||||
// Write the column headers (which sections will appear in the table)
|
// Write the column headers (which sections will appear in the table)
|
||||||
for (size_t i = 0; i != ContributionOffsets.size(); ++i)
|
for (size_t i = 0; i != ContributionOffsets.size(); ++i)
|
||||||
if (ContributionOffsets[i])
|
if (ContributionOffsets[i])
|
||||||
Out.EmitIntValue(i + DW_SECT_INFO, 4);
|
Out.emitIntValue(i + DW_SECT_INFO, 4);
|
||||||
|
|
||||||
// Write the offsets.
|
// Write the offsets.
|
||||||
writeIndexTable(Out, ContributionOffsets, IndexEntries,
|
writeIndexTable(Out, ContributionOffsets, IndexEntries,
|
||||||
|
@ -247,7 +247,7 @@ void dwarfgen::LineTable::writeData(ArrayRef<ValueAndLength> Data,
|
|||||||
case Half:
|
case Half:
|
||||||
case Long:
|
case Long:
|
||||||
case Quad:
|
case Quad:
|
||||||
Asm.OutStreamer->EmitIntValue(Entry.Value, Entry.Length);
|
Asm.OutStreamer->emitIntValue(Entry.Value, Entry.Length);
|
||||||
continue;
|
continue;
|
||||||
case ULEB:
|
case ULEB:
|
||||||
Asm.emitULEB128(Entry.Value);
|
Asm.emitULEB128(Entry.Value);
|
||||||
|
Loading…
Reference in New Issue
Block a user