summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-09 00:17:58 +0000
committerChris Lattner <sabre@nondot.org>2010-03-09 00:17:58 +0000
commit292ec6c299e9aae7427d2480244a3d720a2b6eec (patch)
tree258ea5170cfb5e461ad319514b3cedbf79cc312e /llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
parentf6fb1e0d93879efe689003c2c7bb5e6dae86ebb8 (diff)
downloadbcm5719-llvm-292ec6c299e9aae7427d2480244a3d720a2b6eec.tar.gz
bcm5719-llvm-292ec6c299e9aae7427d2480244a3d720a2b6eec.zip
eliminate an argument from PrintRelDirective, sinking
the one special case into EmitSectionOffset. MCize the non-special case in EmitSectionOffset. llvm-svn: 98014
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index a40bd54f8cf..8dd72c44964 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -77,10 +77,8 @@ unsigned DwarfPrinter::SizeOfEncodedValue(unsigned Encoding) const {
return 0;
}
-void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
- if (isInSection && MAI->getDwarfSectionOffsetDirective())
- O << MAI->getDwarfSectionOffsetDirective();
- else if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
+void DwarfPrinter::PrintRelDirective(bool Force32Bit) const {
+ if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
O << MAI->getData32bitsDirective();
else
O << MAI->getData64bitsDirective();
@@ -253,17 +251,23 @@ void DwarfPrinter::EmitDifference(const MCSymbol *TagHi, const MCSymbol *TagLo,
void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
const MCSymbol *Section,
bool IsSmall, bool isEH) {
- bool printAbsolute = false;
+ bool isAbsolute;
if (isEH)
- printAbsolute = MAI->isAbsoluteEHSectionOffsets();
+ isAbsolute = MAI->isAbsoluteEHSectionOffsets();
else
- printAbsolute = MAI->isAbsoluteDebugSectionOffsets();
+ isAbsolute = MAI->isAbsoluteDebugSectionOffsets();
- if (!printAbsolute)
+ if (!isAbsolute)
return EmitDifference(Label, Section, IsSmall);
- PrintRelDirective(IsSmall, true);
- PrintLabelName(Label);
+ // On COFF targets, we have to emit the weird .secrel32 directive.
+ 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
OpenPOWER on IntegriCloud