Skip to content

Commit

Permalink
Revert "[CodeView] Use assembler directives for line tables"
Browse files Browse the repository at this point in the history
This reverts commit r259117.

The LineInfo constructor is defined in the codeview library and we have
to link against it now. Doing that isn't trivial, so reverting for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259126 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rnk committed Jan 29, 2016
1 parent 99d459d commit ae8e139
Show file tree
Hide file tree
Showing 25 changed files with 779 additions and 1,113 deletions.
35 changes: 11 additions & 24 deletions include/llvm/DebugInfo/CodeView/Line.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,17 @@ using llvm::support::ulittle32_t;

class LineInfo {
public:
enum : uint32_t {
AlwaysStepIntoLineNumber = 0xfeefee,
NeverStepIntoLineNumber = 0xf00f00
};

enum : int { EndLineDeltaShift = 24 };

enum : uint32_t {
StartLineMask = 0x00ffffff,
EndLineDeltaMask = 0x7f000000,
StatementFlag = 0x80000000u
};

LineInfo(uint32_t StartLine, uint32_t EndLine, bool IsStatement) {
LineData = StartLine & StartLineMask;
uint32_t Delta = EndLine - StartLine;
LineData |= (Delta << EndLineDeltaShift) & EndLineDeltaShift;
if (IsStatement)
LineData |= StatementFlag;
}
static const uint32_t AlwaysStepIntoLineNumber = 0xfeefee;
static const uint32_t NeverStepIntoLineNumber = 0xf00f00;

private:
static const uint32_t StartLineMask = 0x00ffffff;
static const uint32_t EndLineDeltaMask = 0x7f000000;
static const int EndLineDeltaShift = 24;
static const uint32_t StatementFlag = 0x80000000u;

public:
LineInfo(uint32_t StartLine, uint32_t EndLine, bool IsStatement);

uint32_t getStartLine() const { return LineData & StartLineMask; }

Expand Down Expand Up @@ -160,10 +151,6 @@ struct FileChecksum {
// Checksum bytes follow.
};

enum LineFlags : uint32_t {
HaveColumns = 1, // CV_LINES_HAVE_COLUMNS
};

} // namespace codeview
} // namespace llvm

Expand Down
162 changes: 0 additions & 162 deletions include/llvm/MC/MCCodeView.h

This file was deleted.

39 changes: 0 additions & 39 deletions include/llvm/MC/MCContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/SectionKind.h"
Expand All @@ -43,7 +42,6 @@ namespace llvm {
class MCSectionMachO;
class MCSectionELF;
class MCSectionCOFF;
class CodeViewContext;

/// Context object for machine code objects. This class owns all of the
/// sections that it creates.
Expand All @@ -68,8 +66,6 @@ namespace llvm {
/// The MCObjectFileInfo for this target.
const MCObjectFileInfo *MOFI;

std::unique_ptr<CodeViewContext> CVContext;

/// Allocator object used for creating machine code objects.
///
/// We use a bump pointer allocator to avoid the need to track all allocated
Expand Down Expand Up @@ -139,10 +135,6 @@ namespace llvm {
MCDwarfLoc CurrentDwarfLoc;
bool DwarfLocSeen;

/// The current CodeView line information from the last .cv_loc directive.
MCCVLoc CurrentCVLoc = MCCVLoc(0, 0, 0, 0, false, true);
bool CVLocSeen = false;

/// Generate dwarf debugging info for assembly source files.
bool GenDwarfForAssembly;

Expand Down Expand Up @@ -245,8 +237,6 @@ namespace llvm {

const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; }

CodeViewContext &getCVContext();

void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }

Expand Down Expand Up @@ -515,35 +505,6 @@ namespace llvm {

/// @}


/// \name CodeView Management
/// @{

/// Creates an entry in the cv file table.
unsigned getCVFile(StringRef FileName, unsigned FileNumber);

/// Saves the information from the currently parsed .cv_loc directive
/// and sets CVLocSeen. When the next instruction is assembled an entry
/// in the line number table with this information and the address of the
/// instruction will be created.
void setCurrentCVLoc(unsigned FunctionId, unsigned FileNo, unsigned Line,
unsigned Column, bool PrologueEnd, bool IsStmt) {
CurrentCVLoc.setFunctionId(FunctionId);
CurrentCVLoc.setFileNum(FileNo);
CurrentCVLoc.setLine(Line);
CurrentCVLoc.setColumn(Column);
CurrentCVLoc.setPrologueEnd(PrologueEnd);
CurrentCVLoc.setIsStmt(IsStmt);
CVLocSeen = true;
}
void clearCVLocSeen() { CVLocSeen = false; }

bool getCVLocSeen() { return CVLocSeen; }
const MCCVLoc &getCurrentCVLoc() { return CurrentCVLoc; }

bool isValidCVFileNumber(unsigned FileNumber);
/// @}

char *getSecureLogFile() { return SecureLogFile; }
raw_fd_ostream *getSecureLog() { return SecureLog.get(); }
bool getSecureLogUsed() { return SecureLogUsed; }
Expand Down
9 changes: 1 addition & 8 deletions include/llvm/MC/MCObjectStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class MCObjectStreamer : public MCStreamer {
void EmitFrames(MCAsmBackend *MAB);
void EmitCFISections(bool EH, bool Debug) override;

protected:
MCFragment *getCurrentFragment() const;

void insert(MCFragment *F) {
Expand All @@ -72,7 +73,6 @@ class MCObjectStreamer : public MCStreamer {
/// fragment is not a data fragment.
MCDataFragment *getOrCreateDataFragment();

protected:
bool changeSectionImpl(MCSection *Section, const MCExpr *Subsection);

/// If any labels have been emitted but not assigned fragments, ensure that
Expand Down Expand Up @@ -122,13 +122,6 @@ class MCObjectStreamer : public MCStreamer {
unsigned PointerSize);
void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
const MCSymbol *Label);
void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line,
unsigned Column, bool PrologueEnd, bool IsStmt,
StringRef FileName) override;
void EmitCVLinetableDirective(unsigned FunctionId, const MCSymbol *Begin,
const MCSymbol *End) override;
void EmitCVStringTableDirective() override;
void EmitCVFileChecksumsDirective() override;
void EmitGPRel32Value(const MCExpr *Value) override;
void EmitGPRel64Value(const MCExpr *Value) override;
bool EmitRelocDirective(const MCExpr &Offset, StringRef Name,
Expand Down
21 changes: 0 additions & 21 deletions include/llvm/MC/MCStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,27 +640,6 @@ class MCStreamer {
unsigned Isa, unsigned Discriminator,
StringRef FileName);

/// \brief Associate a filename with a specified logical file number. This
/// implements the '.cv_file 4 "foo.c"' assembler directive.
virtual unsigned EmitCVFileDirective(unsigned FileNo, StringRef Filename);

/// \brief This implements the CodeView '.cv_loc' assembler directive.
virtual void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo,
unsigned Line, unsigned Column,
bool PrologueEnd, bool IsStmt,
StringRef FileName);

/// \brief This implements the CodeView '.cv_linetable' assembler directive.
virtual void EmitCVLinetableDirective(unsigned FunctionId,
const MCSymbol *FnStart,
const MCSymbol *FnEnd);

/// \brief This implements the CodeView '.cv_stringtable' assembler directive.
virtual void EmitCVStringTableDirective() {}

/// \brief This implements the CodeView '.cv_filechecksums' assembler directive.
virtual void EmitCVFileChecksumsDirective() {}

/// Emit the absolute difference between two symbols.
///
/// \pre Offset of \c Hi is greater than the offset \c Lo.
Expand Down
6 changes: 0 additions & 6 deletions include/llvm/MC/StringTableBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class StringTableBuilder {
size_t Size = 0;
Kind K;

void finalizeStringTable(bool Optimize);

public:
StringTableBuilder(Kind K);

Expand All @@ -41,10 +39,6 @@ class StringTableBuilder {
/// be added after this point.
void finalize();

/// Finalize the string table without reording it. In this mode, offsets
/// returned by add will still be valid.
void finalizeInOrder();

/// \brief Retrieve the string table data. Can only be used after the table
/// is finalized.
StringRef data() const {
Expand Down
10 changes: 10 additions & 0 deletions include/llvm/Support/COFF.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,17 @@ namespace COFF {
}
};

enum CodeViewLine : unsigned {
CVL_LineNumberStartBits = 24,
CVL_LineNumberEndDeltaBits = 7,
CVL_LineNumberEndDeltaMask = (1U << CVL_LineNumberEndDeltaBits) - 1,
CVL_MaxLineNumber = (1U << CVL_LineNumberStartBits) - 1,
CVL_IsStatement = 1U << 31,
CVL_MaxColumnNumber = UINT16_MAX,
};

enum CodeViewIdentifiers {
DEBUG_LINE_TABLES_HAVE_COLUMN_RECORDS = 0x1,
DEBUG_SECTION_MAGIC = 0x4,
};

Expand Down
Loading

0 comments on commit ae8e139

Please sign in to comment.