mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01: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. llvm-svn: 205989
This commit is contained in:
parent
24a37167ab
commit
99744346e4
@ -52,7 +52,6 @@ public:
|
||||
enum FragmentType {
|
||||
FT_Align,
|
||||
FT_Data,
|
||||
FT_Compressed,
|
||||
FT_CompactEncodedInst,
|
||||
FT_Fill,
|
||||
FT_Relaxable,
|
||||
@ -162,7 +161,6 @@ public:
|
||||
return false;
|
||||
case MCFragment::FT_Relaxable:
|
||||
case MCFragment::FT_CompactEncodedInst:
|
||||
case MCFragment::FT_Compressed:
|
||||
case MCFragment::FT_Data:
|
||||
return true;
|
||||
}
|
||||
@ -197,8 +195,7 @@ public:
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
MCFragment::FragmentType Kind = F->getKind();
|
||||
return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data ||
|
||||
Kind == MCFragment::FT_Compressed;
|
||||
return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data;
|
||||
}
|
||||
};
|
||||
|
||||
@ -217,11 +214,6 @@ class MCDataFragment : public MCEncodedFragmentWithFixups {
|
||||
|
||||
/// Fixups - The list of fixups in this fragment.
|
||||
SmallVector<MCFixup, 4> Fixups;
|
||||
protected:
|
||||
MCDataFragment(MCFragment::FragmentType FType, MCSectionData *SD = 0)
|
||||
: MCEncodedFragmentWithFixups(FType, SD), HasInstructions(false),
|
||||
AlignToBundleEnd(false) {}
|
||||
|
||||
public:
|
||||
MCDataFragment(MCSectionData *SD = 0)
|
||||
: MCEncodedFragmentWithFixups(FT_Data, SD),
|
||||
@ -255,21 +247,10 @@ public:
|
||||
const_fixup_iterator fixup_end() const override {return Fixups.end();}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_Data ||
|
||||
F->getKind() == MCFragment::FT_Compressed;
|
||||
return F->getKind() == MCFragment::FT_Data;
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
/// instruction (non-relaxable) that has no fixups registered. When applicable,
|
||||
/// it can be used instead of MCDataFragment and lead to lower memory
|
||||
|
@ -28,9 +28,6 @@
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/Support/TargetRegistry.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;
|
||||
|
||||
@ -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(const MCSection &_Section, MCAssembler *A)
|
||||
@ -467,8 +431,6 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
|
||||
case MCFragment::FT_Relaxable:
|
||||
case MCFragment::FT_CompactEncodedInst:
|
||||
return cast<MCEncodedFragment>(F).getContents().size();
|
||||
case MCFragment::FT_Compressed:
|
||||
return cast<MCCompressedFragment>(F).getCompressedContents().size();
|
||||
case MCFragment::FT_Fill:
|
||||
return cast<MCFillFragment>(F).getSize();
|
||||
|
||||
@ -657,11 +619,6 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||
break;
|
||||
}
|
||||
|
||||
case MCFragment::FT_Compressed:
|
||||
++stats::EmittedDataFragments;
|
||||
OW->WriteBytes(cast<MCCompressedFragment>(F).getCompressedContents());
|
||||
break;
|
||||
|
||||
case MCFragment::FT_Data:
|
||||
++stats::EmittedDataFragments;
|
||||
writeFragmentContents(F, OW);
|
||||
@ -738,7 +695,6 @@ void MCAssembler::writeSectionData(const MCSectionData *SD,
|
||||
ie = SD->end(); it != ie; ++it) {
|
||||
switch (it->getKind()) {
|
||||
default: llvm_unreachable("Invalid fragment in virtual section!");
|
||||
case MCFragment::FT_Compressed:
|
||||
case MCFragment::FT_Data: {
|
||||
// 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
|
||||
@ -1070,8 +1026,6 @@ void MCFragment::dump() {
|
||||
switch (getKind()) {
|
||||
case MCFragment::FT_Align: OS << "MCAlignFragment"; break;
|
||||
case MCFragment::FT_Data: OS << "MCDataFragment"; break;
|
||||
case MCFragment::FT_Compressed:
|
||||
OS << "MCCompressedFragment"; break;
|
||||
case MCFragment::FT_CompactEncodedInst:
|
||||
OS << "MCCompactEncodedInstFragment"; break;
|
||||
case MCFragment::FT_Fill: OS << "MCFillFragment"; break;
|
||||
@ -1098,7 +1052,6 @@ void MCFragment::dump() {
|
||||
<< " MaxBytesToEmit:" << AF->getMaxBytesToEmit() << ">";
|
||||
break;
|
||||
}
|
||||
case MCFragment::FT_Compressed:
|
||||
case MCFragment::FT_Data: {
|
||||
const MCDataFragment *DF = cast<MCDataFragment>(this);
|
||||
OS << "\n ";
|
||||
|
@ -258,11 +258,6 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
|
||||
ELFUniquingMap = new ELFUniqueMapTy();
|
||||
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.
|
||||
std::pair<ELFUniqueMapTy::iterator, bool> Entry = Map.insert(
|
||||
std::make_pair(SectionGroupPair(Section, Group), (MCSectionELF *)0));
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
using namespace llvm;
|
||||
|
||||
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||
@ -64,11 +63,7 @@ MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {
|
||||
// When bundling is enabled, we don't want to add data to a fragment that
|
||||
// already has instructions (see MCELFStreamer::EmitInstToData for details)
|
||||
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);
|
||||
}
|
||||
return 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
|
||||
|
||||
// XFAIL: *
|
||||
|
||||
// REQUIRES: zlib
|
||||
|
||||
// CHECK: Contents of section .debug_line:
|
||||
|
Loading…
Reference in New Issue
Block a user