mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
Revert debug info compression support.
To support compression for debug_line and debug_frame a different approach is required. To simplify review, revert the old implementation and XFAIL the test case. New implementation to follow shortly. Reverts r205059 and r204958. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205989 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -52,7 +52,6 @@ public:
|
|||||||
enum FragmentType {
|
enum FragmentType {
|
||||||
FT_Align,
|
FT_Align,
|
||||||
FT_Data,
|
FT_Data,
|
||||||
FT_Compressed,
|
|
||||||
FT_CompactEncodedInst,
|
FT_CompactEncodedInst,
|
||||||
FT_Fill,
|
FT_Fill,
|
||||||
FT_Relaxable,
|
FT_Relaxable,
|
||||||
@@ -162,7 +161,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
case MCFragment::FT_Relaxable:
|
case MCFragment::FT_Relaxable:
|
||||||
case MCFragment::FT_CompactEncodedInst:
|
case MCFragment::FT_CompactEncodedInst:
|
||||||
case MCFragment::FT_Compressed:
|
|
||||||
case MCFragment::FT_Data:
|
case MCFragment::FT_Data:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -197,8 +195,7 @@ public:
|
|||||||
|
|
||||||
static bool classof(const MCFragment *F) {
|
static bool classof(const MCFragment *F) {
|
||||||
MCFragment::FragmentType Kind = F->getKind();
|
MCFragment::FragmentType Kind = F->getKind();
|
||||||
return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data ||
|
return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data;
|
||||||
Kind == MCFragment::FT_Compressed;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -217,11 +214,6 @@ class MCDataFragment : public MCEncodedFragmentWithFixups {
|
|||||||
|
|
||||||
/// Fixups - The list of fixups in this fragment.
|
/// Fixups - The list of fixups in this fragment.
|
||||||
SmallVector<MCFixup, 4> Fixups;
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
protected:
|
|
||||||
MCDataFragment(MCFragment::FragmentType FType, MCSectionData *SD = 0)
|
|
||||||
: MCEncodedFragmentWithFixups(FType, SD), HasInstructions(false),
|
|
||||||
AlignToBundleEnd(false) {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MCDataFragment(MCSectionData *SD = 0)
|
MCDataFragment(MCSectionData *SD = 0)
|
||||||
: MCEncodedFragmentWithFixups(FT_Data, SD),
|
: MCEncodedFragmentWithFixups(FT_Data, SD),
|
||||||
@@ -255,21 +247,10 @@ public:
|
|||||||
const_fixup_iterator fixup_end() const override {return Fixups.end();}
|
const_fixup_iterator fixup_end() const override {return Fixups.end();}
|
||||||
|
|
||||||
static bool classof(const MCFragment *F) {
|
static bool classof(const MCFragment *F) {
|
||||||
return F->getKind() == MCFragment::FT_Data ||
|
return F->getKind() == MCFragment::FT_Data;
|
||||||
F->getKind() == MCFragment::FT_Compressed;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MCCompressedFragment: public MCDataFragment {
|
|
||||||
mutable SmallVector<char, 32> CompressedContents;
|
|
||||||
public:
|
|
||||||
MCCompressedFragment(MCSectionData *SD = nullptr)
|
|
||||||
: MCDataFragment(FT_Compressed, SD) {}
|
|
||||||
const SmallVectorImpl<char> &getCompressedContents() const;
|
|
||||||
using MCDataFragment::getContents;
|
|
||||||
SmallVectorImpl<char> &getContents() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is a compact (memory-size-wise) fragment for holding an encoded
|
/// This is a compact (memory-size-wise) fragment for holding an encoded
|
||||||
/// instruction (non-relaxable) that has no fixups registered. When applicable,
|
/// instruction (non-relaxable) that has no fixups registered. When applicable,
|
||||||
/// it can be used instead of MCDataFragment and lead to lower memory
|
/// it can be used instead of MCDataFragment and lead to lower memory
|
||||||
|
@@ -28,9 +28,6 @@
|
|||||||
#include "llvm/Support/LEB128.h"
|
#include "llvm/Support/LEB128.h"
|
||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
|
||||||
#include "llvm/Support/Compression.h"
|
|
||||||
#include "llvm/Support/Host.h"
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@@ -233,39 +230,6 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
|
|||||||
|
|
||||||
/* *** */
|
/* *** */
|
||||||
|
|
||||||
const SmallVectorImpl<char> &MCCompressedFragment::getCompressedContents() const {
|
|
||||||
assert(getParent()->size() == 1 &&
|
|
||||||
"Only compress sections containing a single fragment");
|
|
||||||
if (CompressedContents.empty()) {
|
|
||||||
// FIXME: could be more efficient if we let zlib::compress append to a
|
|
||||||
// buffer rather than always from the start.
|
|
||||||
zlib::Status Success =
|
|
||||||
zlib::compress(StringRef(getContents().data(), getContents().size()),
|
|
||||||
CompressedContents);
|
|
||||||
(void)Success;
|
|
||||||
assert(Success == zlib::StatusOK);
|
|
||||||
static const StringRef Magic = "ZLIB";
|
|
||||||
uint64_t Size = getContents().size();
|
|
||||||
if (sys::IsLittleEndianHost)
|
|
||||||
Size = sys::SwapByteOrder(Size);
|
|
||||||
CompressedContents.insert(CompressedContents.begin(),
|
|
||||||
Magic.size() + sizeof(Size));
|
|
||||||
std::copy(Magic.begin(), Magic.end(), CompressedContents.begin());
|
|
||||||
std::copy(reinterpret_cast<char *>(&Size),
|
|
||||||
reinterpret_cast<char *>(&Size + 1),
|
|
||||||
CompressedContents.begin() + Magic.size());
|
|
||||||
}
|
|
||||||
return CompressedContents;
|
|
||||||
}
|
|
||||||
|
|
||||||
SmallVectorImpl<char> &MCCompressedFragment::getContents() {
|
|
||||||
assert(CompressedContents.empty() &&
|
|
||||||
"Fragment contents should not be altered after compression");
|
|
||||||
return MCDataFragment::getContents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* *** */
|
|
||||||
|
|
||||||
MCSectionData::MCSectionData() : Section(0) {}
|
MCSectionData::MCSectionData() : Section(0) {}
|
||||||
|
|
||||||
MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
|
MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
|
||||||
@@ -467,8 +431,6 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
|
|||||||
case MCFragment::FT_Relaxable:
|
case MCFragment::FT_Relaxable:
|
||||||
case MCFragment::FT_CompactEncodedInst:
|
case MCFragment::FT_CompactEncodedInst:
|
||||||
return cast<MCEncodedFragment>(F).getContents().size();
|
return cast<MCEncodedFragment>(F).getContents().size();
|
||||||
case MCFragment::FT_Compressed:
|
|
||||||
return cast<MCCompressedFragment>(F).getCompressedContents().size();
|
|
||||||
case MCFragment::FT_Fill:
|
case MCFragment::FT_Fill:
|
||||||
return cast<MCFillFragment>(F).getSize();
|
return cast<MCFillFragment>(F).getSize();
|
||||||
|
|
||||||
@@ -657,11 +619,6 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MCFragment::FT_Compressed:
|
|
||||||
++stats::EmittedDataFragments;
|
|
||||||
OW->WriteBytes(cast<MCCompressedFragment>(F).getCompressedContents());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCFragment::FT_Data:
|
case MCFragment::FT_Data:
|
||||||
++stats::EmittedDataFragments;
|
++stats::EmittedDataFragments;
|
||||||
writeFragmentContents(F, OW);
|
writeFragmentContents(F, OW);
|
||||||
@@ -738,7 +695,6 @@ void MCAssembler::writeSectionData(const MCSectionData *SD,
|
|||||||
ie = SD->end(); it != ie; ++it) {
|
ie = SD->end(); it != ie; ++it) {
|
||||||
switch (it->getKind()) {
|
switch (it->getKind()) {
|
||||||
default: llvm_unreachable("Invalid fragment in virtual section!");
|
default: llvm_unreachable("Invalid fragment in virtual section!");
|
||||||
case MCFragment::FT_Compressed:
|
|
||||||
case MCFragment::FT_Data: {
|
case MCFragment::FT_Data: {
|
||||||
// Check that we aren't trying to write a non-zero contents (or fixups)
|
// Check that we aren't trying to write a non-zero contents (or fixups)
|
||||||
// into a virtual section. This is to support clients which use standard
|
// into a virtual section. This is to support clients which use standard
|
||||||
@@ -1070,8 +1026,6 @@ void MCFragment::dump() {
|
|||||||
switch (getKind()) {
|
switch (getKind()) {
|
||||||
case MCFragment::FT_Align: OS << "MCAlignFragment"; break;
|
case MCFragment::FT_Align: OS << "MCAlignFragment"; break;
|
||||||
case MCFragment::FT_Data: OS << "MCDataFragment"; break;
|
case MCFragment::FT_Data: OS << "MCDataFragment"; break;
|
||||||
case MCFragment::FT_Compressed:
|
|
||||||
OS << "MCCompressedFragment"; break;
|
|
||||||
case MCFragment::FT_CompactEncodedInst:
|
case MCFragment::FT_CompactEncodedInst:
|
||||||
OS << "MCCompactEncodedInstFragment"; break;
|
OS << "MCCompactEncodedInstFragment"; break;
|
||||||
case MCFragment::FT_Fill: OS << "MCFillFragment"; break;
|
case MCFragment::FT_Fill: OS << "MCFillFragment"; break;
|
||||||
@@ -1098,7 +1052,6 @@ void MCFragment::dump() {
|
|||||||
<< " MaxBytesToEmit:" << AF->getMaxBytesToEmit() << ">";
|
<< " MaxBytesToEmit:" << AF->getMaxBytesToEmit() << ">";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MCFragment::FT_Compressed:
|
|
||||||
case MCFragment::FT_Data: {
|
case MCFragment::FT_Data: {
|
||||||
const MCDataFragment *DF = cast<MCDataFragment>(this);
|
const MCDataFragment *DF = cast<MCDataFragment>(this);
|
||||||
OS << "\n ";
|
OS << "\n ";
|
||||||
|
@@ -258,11 +258,6 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
|
|||||||
ELFUniquingMap = new ELFUniqueMapTy();
|
ELFUniquingMap = new ELFUniqueMapTy();
|
||||||
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
|
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
|
||||||
|
|
||||||
SmallString<32> ZDebugName;
|
|
||||||
if (MAI->compressDebugSections() && Section.startswith(".debug_") &&
|
|
||||||
Section != ".debug_frame" && Section != ".debug_line")
|
|
||||||
Section = (".z" + Section.drop_front(1)).toStringRef(ZDebugName);
|
|
||||||
|
|
||||||
// Do the lookup, if we have a hit, return it.
|
// Do the lookup, if we have a hit, return it.
|
||||||
std::pair<ELFUniqueMapTy::iterator, bool> Entry = Map.insert(
|
std::pair<ELFUniqueMapTy::iterator, bool> Entry = Map.insert(
|
||||||
std::make_pair(SectionGroupPair(Section, Group), (MCSectionELF *)0));
|
std::make_pair(SectionGroupPair(Section, Group), (MCSectionELF *)0));
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
#include "llvm/MC/MCSection.h"
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/MC/MCSectionELF.h"
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
@@ -64,10 +63,6 @@ MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {
|
|||||||
// When bundling is enabled, we don't want to add data to a fragment that
|
// When bundling is enabled, we don't want to add data to a fragment that
|
||||||
// already has instructions (see MCELFStreamer::EmitInstToData for details)
|
// already has instructions (see MCELFStreamer::EmitInstToData for details)
|
||||||
if (!F || (Assembler->isBundlingEnabled() && F->hasInstructions())) {
|
if (!F || (Assembler->isBundlingEnabled() && F->hasInstructions())) {
|
||||||
const auto *Sec = dyn_cast<MCSectionELF>(&getCurrentSectionData()->getSection());
|
|
||||||
if (Sec && Sec->getSectionName().startswith(".zdebug_"))
|
|
||||||
F = new MCCompressedFragment();
|
|
||||||
else
|
|
||||||
F = new MCDataFragment();
|
F = new MCDataFragment();
|
||||||
insert(F);
|
insert(F);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
// RUN: llvm-mc -filetype=obj -compress-debug-sections -triple x86_64-pc-linux-gnu %s -o - | llvm-objdump -s - | FileCheck %s
|
// RUN: llvm-mc -filetype=obj -compress-debug-sections -triple x86_64-pc-linux-gnu %s -o - | llvm-objdump -s - | FileCheck %s
|
||||||
|
|
||||||
|
// XFAIL: *
|
||||||
|
|
||||||
// REQUIRES: zlib
|
// REQUIRES: zlib
|
||||||
|
|
||||||
// CHECK: Contents of section .debug_line:
|
// CHECK: Contents of section .debug_line:
|
||||||
|
Reference in New Issue
Block a user