Refactor DebugLocDWARFExpression so it doesn't require access to the

TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes
of the pre-calculated DWARF expression.

Ought to be NFC, but it does slightly alter the output format of the
textual assembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-03-02 02:38:18 +00:00
parent 6cad61163a
commit d21acaf6a1
11 changed files with 169 additions and 153 deletions

View File

@@ -30,13 +30,14 @@ class DIELoc;
/// entry.
class DwarfExpression {
protected:
const AsmPrinter ≈
// Various convenience accessors that extract things out of AsmPrinter.
const TargetRegisterInfo *getTRI() const;
unsigned getDwarfVersion() const;
const TargetRegisterInfo &TRI;
unsigned DwarfVersion;
public:
DwarfExpression(const AsmPrinter &AP) : AP(AP) {}
DwarfExpression(const TargetRegisterInfo &TRI,
unsigned DwarfVersion)
: TRI(TRI), DwarfVersion(DwarfVersion) {}
virtual ~DwarfExpression() {}
/// Output a dwarf operand and an optional assembler comment.
@@ -105,8 +106,9 @@ class DebugLocDwarfExpression : public DwarfExpression {
ByteStreamer &BS;
public:
DebugLocDwarfExpression(const AsmPrinter &AP, ByteStreamer &BS)
: DwarfExpression(AP), BS(BS) {}
DebugLocDwarfExpression(const TargetRegisterInfo &TRI,
unsigned DwarfVersion, ByteStreamer &BS)
: DwarfExpression(TRI, DwarfVersion), BS(BS) {}
void EmitOp(uint8_t Op, const char *Comment = nullptr) override;
void EmitSigned(int Value) override;
@@ -116,13 +118,12 @@ public:
/// DwarfExpression implementation for singular DW_AT_location.
class DIEDwarfExpression : public DwarfExpression {
const AsmPrinter ≈
DwarfUnit &DU;
DIELoc ¨
public:
DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE)
: DwarfExpression(AP), DU(DU), DIE(DIE) {}
DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE);
void EmitOp(uint8_t Op, const char *Comment = nullptr) override;
void EmitSigned(int Value) override;
void EmitUnsigned(unsigned Value) override;