eliminate an argument from PrintRelDirective, sinking

the one special case into EmitSectionOffset.  MCize
the non-special case in EmitSectionOffset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-03-09 00:17:58 +00:00
parent 8f03d75161
commit ef6b14f51c
2 changed files with 17 additions and 12 deletions

View File

@ -77,10 +77,8 @@ unsigned DwarfPrinter::SizeOfEncodedValue(unsigned Encoding) const {
return 0; return 0;
} }
void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const { void DwarfPrinter::PrintRelDirective(bool Force32Bit) const {
if (isInSection && MAI->getDwarfSectionOffsetDirective()) if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
O << MAI->getDwarfSectionOffsetDirective();
else if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
O << MAI->getData32bitsDirective(); O << MAI->getData32bitsDirective();
else else
O << MAI->getData64bitsDirective(); O << MAI->getData64bitsDirective();
@ -253,17 +251,23 @@ void DwarfPrinter::EmitDifference(const MCSymbol *TagHi, const MCSymbol *TagLo,
void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label, void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
const MCSymbol *Section, const MCSymbol *Section,
bool IsSmall, bool isEH) { bool IsSmall, bool isEH) {
bool printAbsolute = false; bool isAbsolute;
if (isEH) if (isEH)
printAbsolute = MAI->isAbsoluteEHSectionOffsets(); isAbsolute = MAI->isAbsoluteEHSectionOffsets();
else else
printAbsolute = MAI->isAbsoluteDebugSectionOffsets(); isAbsolute = MAI->isAbsoluteDebugSectionOffsets();
if (!printAbsolute) if (!isAbsolute)
return EmitDifference(Label, Section, IsSmall); return EmitDifference(Label, Section, IsSmall);
PrintRelDirective(IsSmall, true); // On COFF targets, we have to emit the weird .secrel32 directive.
PrintLabelName(Label); if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective())
O << SecOffDir << Label->getName();
else {
unsigned Size = IsSmall ? 4 : TD->getPointerSize();
Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(Label, Asm->OutContext),
Size, 0/*AddrSpace*/);
}
} }
/// EmitFrameMoves - Emit frame instructions to describe the layout of the /// EmitFrameMoves - Emit frame instructions to describe the layout of the

View File

@ -89,8 +89,7 @@ public:
unsigned SizeOfEncodedValue(unsigned Encoding) const; unsigned SizeOfEncodedValue(unsigned Encoding) const;
void PrintRelDirective(unsigned Encoding) const; void PrintRelDirective(unsigned Encoding) const;
void PrintRelDirective(bool Force32Bit = false, void PrintRelDirective(bool Force32Bit = false) const;
bool isInSection = false) const;
/// EOL - Print a newline character to asm stream. If a comment is present /// EOL - Print a newline character to asm stream. If a comment is present
/// then it will be printed first. Comments should not contain '\n'. /// then it will be printed first. Comments should not contain '\n'.
@ -130,6 +129,8 @@ public:
void EmitDifference(const MCSymbol *LabelHi, const MCSymbol *LabelLo, void EmitDifference(const MCSymbol *LabelHi, const MCSymbol *LabelLo,
bool IsSmall = false); bool IsSmall = false);
/// EmitSectionOffset - Emit Label-Section or use a special purpose directive
/// to emit a section offset if the target has one.
void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section, void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section,
bool IsSmall = false, bool isEH = false); bool IsSmall = false, bool isEH = false);