mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
change SizeOf to take AsmPrinter instead of TargetData,
simplifying a bunch of code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100373 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d38fee8ddc
commit
a37d5387a5
@ -208,7 +208,7 @@ void DIEInteger::EmitValue(AsmPrinter *Asm, unsigned Form) const {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of integer value in bytes.
|
/// SizeOf - Determine size of integer value in bytes.
|
||||||
///
|
///
|
||||||
unsigned DIEInteger::SizeOf(const TargetData *TD, unsigned Form) const {
|
unsigned DIEInteger::SizeOf(AsmPrinter *AP, unsigned Form) const {
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
case dwarf::DW_FORM_flag: // Fall thru
|
case dwarf::DW_FORM_flag: // Fall thru
|
||||||
case dwarf::DW_FORM_ref1: // Fall thru
|
case dwarf::DW_FORM_ref1: // Fall thru
|
||||||
@ -258,16 +258,14 @@ void DIEString::print(raw_ostream &O) {
|
|||||||
/// EmitValue - Emit label value.
|
/// EmitValue - Emit label value.
|
||||||
///
|
///
|
||||||
void DIELabel::EmitValue(AsmPrinter *AP, unsigned Form) const {
|
void DIELabel::EmitValue(AsmPrinter *AP, unsigned Form) const {
|
||||||
bool IsSmall = Form == dwarf::DW_FORM_data4;
|
AP->OutStreamer.EmitSymbolValue(Label, SizeOf(AP, Form), 0/*AddrSpace*/);
|
||||||
unsigned Size = IsSmall ? 4 : AP->getTargetData().getPointerSize();
|
|
||||||
AP->OutStreamer.EmitSymbolValue(Label, Size, 0/*AddrSpace*/);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SizeOf - Determine size of label value in bytes.
|
/// SizeOf - Determine size of label value in bytes.
|
||||||
///
|
///
|
||||||
unsigned DIELabel::SizeOf(const TargetData *TD, unsigned Form) const {
|
unsigned DIELabel::SizeOf(AsmPrinter *AP, unsigned Form) const {
|
||||||
if (Form == dwarf::DW_FORM_data4) return 4;
|
if (Form == dwarf::DW_FORM_data4) return 4;
|
||||||
return TD->getPointerSize();
|
return AP->getTargetData().getPointerSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -283,15 +281,14 @@ void DIELabel::print(raw_ostream &O) {
|
|||||||
/// EmitValue - Emit delta value.
|
/// EmitValue - Emit delta value.
|
||||||
///
|
///
|
||||||
void DIEDelta::EmitValue(AsmPrinter *AP, unsigned Form) const {
|
void DIEDelta::EmitValue(AsmPrinter *AP, unsigned Form) const {
|
||||||
AP->EmitLabelDifference(LabelHi, LabelLo,
|
AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
|
||||||
SizeOf(&AP->getTargetData(), Form));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SizeOf - Determine size of delta value in bytes.
|
/// SizeOf - Determine size of delta value in bytes.
|
||||||
///
|
///
|
||||||
unsigned DIEDelta::SizeOf(const TargetData *TD, unsigned Form) const {
|
unsigned DIEDelta::SizeOf(AsmPrinter *AP, unsigned Form) const {
|
||||||
if (Form == dwarf::DW_FORM_data4) return 4;
|
if (Form == dwarf::DW_FORM_data4) return 4;
|
||||||
return TD->getPointerSize();
|
return AP->getTargetData().getPointerSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -322,11 +319,11 @@ void DIEEntry::print(raw_ostream &O) {
|
|||||||
|
|
||||||
/// ComputeSize - calculate the size of the block.
|
/// ComputeSize - calculate the size of the block.
|
||||||
///
|
///
|
||||||
unsigned DIEBlock::ComputeSize(const TargetData *TD) {
|
unsigned DIEBlock::ComputeSize(AsmPrinter *AP) {
|
||||||
if (!Size) {
|
if (!Size) {
|
||||||
const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData();
|
const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData();
|
||||||
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
||||||
Size += Values[i]->SizeOf(TD, AbbrevData[i].getForm());
|
Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Size;
|
return Size;
|
||||||
@ -350,7 +347,7 @@ void DIEBlock::EmitValue(AsmPrinter *Asm, unsigned Form) const {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of block data in bytes.
|
/// SizeOf - Determine size of block data in bytes.
|
||||||
///
|
///
|
||||||
unsigned DIEBlock::SizeOf(const TargetData *TD, unsigned Form) const {
|
unsigned DIEBlock::SizeOf(AsmPrinter *AP, unsigned Form) const {
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
|
case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
|
||||||
case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
|
case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class AsmPrinter;
|
class AsmPrinter;
|
||||||
class TargetData;
|
|
||||||
class MCSymbol;
|
class MCSymbol;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
@ -224,7 +223,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Return the size of a value in bytes.
|
/// SizeOf - Return the size of a value in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const = 0;
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const = 0;
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
static bool classof(const DIEValue *) { return true; }
|
static bool classof(const DIEValue *) { return true; }
|
||||||
@ -264,7 +263,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of integer value in bytes.
|
/// SizeOf - Determine size of integer value in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const;
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
|
||||||
|
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
@ -290,7 +289,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of string value in bytes.
|
/// SizeOf - Determine size of string value in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *, unsigned /*Form*/) const {
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned /*Form*/) const {
|
||||||
return Str.size() + sizeof(char); // sizeof('\0');
|
return Str.size() + sizeof(char); // sizeof('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +316,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of label value in bytes.
|
/// SizeOf - Determine size of label value in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const;
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
static bool classof(const DIELabel *) { return true; }
|
static bool classof(const DIELabel *) { return true; }
|
||||||
@ -344,7 +343,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of delta value in bytes.
|
/// SizeOf - Determine size of delta value in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const;
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
static bool classof(const DIEDelta *) { return true; }
|
static bool classof(const DIEDelta *) { return true; }
|
||||||
@ -372,7 +371,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of debug information entry in bytes.
|
/// SizeOf - Determine size of debug information entry in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const {
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const {
|
||||||
return sizeof(int32_t);
|
return sizeof(int32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +396,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// ComputeSize - calculate the size of the block.
|
/// ComputeSize - calculate the size of the block.
|
||||||
///
|
///
|
||||||
unsigned ComputeSize(const TargetData *TD);
|
unsigned ComputeSize(AsmPrinter *AP);
|
||||||
|
|
||||||
/// BestForm - Choose the best form for data.
|
/// BestForm - Choose the best form for data.
|
||||||
///
|
///
|
||||||
@ -414,7 +413,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SizeOf - Determine size of block data in bytes.
|
/// SizeOf - Determine size of block data in bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const;
|
virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
static bool classof(const DIEBlock *) { return true; }
|
static bool classof(const DIEBlock *) { return true; }
|
||||||
|
@ -403,7 +403,7 @@ void DwarfDebug::addDelta(DIE *Die, unsigned Attribute, unsigned Form,
|
|||||||
///
|
///
|
||||||
void DwarfDebug::addBlock(DIE *Die, unsigned Attribute, unsigned Form,
|
void DwarfDebug::addBlock(DIE *Die, unsigned Attribute, unsigned Form,
|
||||||
DIEBlock *Block) {
|
DIEBlock *Block) {
|
||||||
Block->ComputeSize(&Asm->getTargetData());
|
Block->ComputeSize(Asm);
|
||||||
DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on.
|
DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on.
|
||||||
Die->addValue(Attribute, Block->BestForm(), Block);
|
Die->addValue(Attribute, Block->BestForm(), Block);
|
||||||
}
|
}
|
||||||
@ -2413,7 +2413,7 @@ DwarfDebug::computeSizeAndOffset(DIE *Die, unsigned Offset, bool Last) {
|
|||||||
// Size the DIE attribute values.
|
// Size the DIE attribute values.
|
||||||
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
||||||
// Size attribute value.
|
// Size attribute value.
|
||||||
Offset += Values[i]->SizeOf(&Asm->getTargetData(), AbbrevData[i].getForm());
|
Offset += Values[i]->SizeOf(Asm, AbbrevData[i].getForm());
|
||||||
|
|
||||||
// Size the DIE children if any.
|
// Size the DIE children if any.
|
||||||
if (!Children.empty()) {
|
if (!Children.empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user