Fixed version of 121434 with no new memory leaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121471 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2010-12-10 07:39:47 +00:00
parent c2ef828616
commit 89b9372605
33 changed files with 554 additions and 176 deletions

View File

@@ -29,6 +29,7 @@ namespace llvm {
class MCLineSection;
class StringRef;
class Twine;
class TargetAsmInfo;
class MCSectionMachO;
class MCSectionELF;
@@ -42,6 +43,8 @@ namespace llvm {
/// The MCAsmInfo for this target.
const MCAsmInfo &MAI;
const TargetAsmInfo *TAI;
/// Symbols - Bindings of names to symbols.
StringMap<MCSymbol*> Symbols;
@@ -99,11 +102,13 @@ namespace llvm {
MCSymbol *CreateSymbol(StringRef Name);
public:
explicit MCContext(const MCAsmInfo &MAI);
explicit MCContext(const MCAsmInfo &MAI, const TargetAsmInfo *TAI);
~MCContext();
const MCAsmInfo &getAsmInfo() const { return MAI; }
const TargetAsmInfo &getTargetAsmInfo() const { return *TAI; }
/// @name Symbol Management
/// @{

View File

@@ -22,6 +22,7 @@
#include <vector>
namespace llvm {
class MachineMove;
class MCContext;
class MCSection;
class MCSectionData;
@@ -208,7 +209,7 @@ namespace llvm {
//
// This emits the Dwarf file and the line tables.
//
static void Emit(MCStreamer *MCOS, const MCSection *DwarfLineSection);
static void Emit(MCStreamer *MCOS);
};
class MCDwarfLineAddr {
@@ -224,6 +225,21 @@ namespace llvm {
static void Write(MCObjectWriter *OW,
int64_t LineDelta, uint64_t AddrDelta);
};
struct MCDwarfFrameInfo {
MCSymbol *Begin;
MCSymbol *End;
const MCSymbol *Personality;
const MCSymbol *Lsda;
};
class MCDwarfFrameEmitter {
public:
//
// This emits the frame info section.
//
static void Emit(MCStreamer &streamer);
};
} // end namespace llvm
#endif

View File

@@ -59,7 +59,8 @@ public:
/// @{
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
bool isPCRel, unsigned AddrSpace);
virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
virtual void EmitSLEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);

View File

@@ -16,6 +16,7 @@
#include "llvm/Support/DataTypes.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCDwarf.h"
namespace llvm {
class MCAsmInfo;
@@ -48,6 +49,9 @@ namespace llvm {
MCStreamer(const MCStreamer&); // DO NOT IMPLEMENT
MCStreamer &operator=(const MCStreamer&); // DO NOT IMPLEMENT
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
bool isPCRel, unsigned AddrSpace);
protected:
MCStreamer(MCContext &Ctx);
@@ -59,11 +63,23 @@ namespace llvm {
/// is kept up to date by SwitchSection.
const MCSection *PrevSection;
std::vector<MCDwarfFrameInfo> FrameInfos;
MCDwarfFrameInfo *getCurrentFrameInfo();
void EnsureValidFrame();
public:
virtual ~MCStreamer();
MCContext &getContext() const { return Context; }
unsigned getNumFrameInfos() {
return FrameInfos.size();
}
const MCDwarfFrameInfo &getFrameInfo(unsigned i) {
return FrameInfos[i];
}
/// @name Assembly File Formatting.
/// @{
@@ -241,8 +257,13 @@ namespace llvm {
/// @param Value - The value to emit.
/// @param Size - The size of the integer (in bytes) to emit. This must
/// match a native machine width.
virtual void EmitValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace = 0) = 0;
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
bool isPCRel, unsigned AddrSpace) = 0;
void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
void EmitPCRelValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace = 0);
/// EmitIntValue - Special case of EmitValue that avoids the client having
/// to pass in a MCExpr for constant integers.
@@ -275,6 +296,9 @@ namespace llvm {
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
unsigned AddrSpace = 0);
void EmitPCRelSymbolValue(const MCSymbol *Sym, unsigned Size,
unsigned AddrSpace = 0);
/// EmitGPRel32Value - Emit the expression @p Value into the output as a
/// gprel32 (32-bit GP relative) value.
///
@@ -405,19 +429,12 @@ namespace llvm {
/// \param ShowInst - Whether to show the MCInst representation inline with
/// the assembly.
MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isLittleEndian, bool isVerboseAsm,
bool isVerboseAsm,
bool useLoc,
MCInstPrinter *InstPrint = 0,
MCCodeEmitter *CE = 0,
bool ShowInst = false);
MCStreamer *createAsmStreamerNoLoc(MCContext &Ctx, formatted_raw_ostream &OS,
bool isLittleEndian, bool isVerboseAsm,
const TargetLoweringObjectFile *TLOF,
int PointerSize,
MCInstPrinter *InstPrint = 0,
MCCodeEmitter *CE = 0,
bool ShowInst = false);
/// createMachOStreamer - Create a machine code streamer which will generate
/// Mach-O format object files.
///