2009-10-14 17:57:32 +00:00
|
|
|
//===- lib/MC/MCNullStreamer.cpp - Dummy Streamer Implementation ----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/MC/MCStreamer.h"
|
|
|
|
#include "llvm/MC/MCContext.h"
|
|
|
|
#include "llvm/MC/MCInst.h"
|
|
|
|
#include "llvm/MC/MCSectionMachO.h"
|
|
|
|
#include "llvm/MC/MCSymbol.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class MCNullStreamer : public MCStreamer {
|
|
|
|
public:
|
2013-04-08 18:41:23 +00:00
|
|
|
MCNullStreamer(MCContext &Context) : MCStreamer(SK_NullStreamer, Context) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
|
|
|
|
/// @name MCStreamer Interface
|
|
|
|
/// @{
|
|
|
|
|
2013-04-08 18:41:23 +00:00
|
|
|
virtual void InitToTextSection() {
|
|
|
|
}
|
|
|
|
|
2011-02-20 12:57:14 +00:00
|
|
|
virtual void InitSections() {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ChangeSection(const MCSection *Section) {
|
2009-10-14 17:57:32 +00:00
|
|
|
}
|
|
|
|
|
2010-03-10 17:45:15 +00:00
|
|
|
virtual void EmitLabel(MCSymbol *Symbol) {
|
|
|
|
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
2011-02-20 12:57:14 +00:00
|
|
|
assert(getCurrentSection() && "Cannot emit before setting section!");
|
|
|
|
Symbol->setSection(*getCurrentSection());
|
2010-03-10 17:45:15 +00:00
|
|
|
}
|
2013-04-08 18:41:23 +00:00
|
|
|
virtual void EmitDebugLabel(MCSymbol *Symbol) {
|
|
|
|
EmitLabel(Symbol);
|
|
|
|
}
|
2010-01-23 11:09:33 +00:00
|
|
|
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
|
2011-02-20 12:57:14 +00:00
|
|
|
virtual void EmitThumbFunc(MCSymbol *Func) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
|
|
|
|
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
|
2011-02-20 12:57:14 +00:00
|
|
|
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
|
|
|
|
virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
|
|
|
|
const MCSymbol *LastLabel,
|
2011-07-17 15:36:56 +00:00
|
|
|
const MCSymbol *Label,
|
|
|
|
unsigned PointerSize) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
|
2010-01-23 11:09:33 +00:00
|
|
|
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
|
2009-10-14 17:57:32 +00:00
|
|
|
|
|
|
|
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
|
2010-05-27 15:15:58 +00:00
|
|
|
|
|
|
|
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
|
|
|
|
virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
|
|
|
|
virtual void EmitCOFFSymbolType(int Type) {}
|
|
|
|
virtual void EndCOFFSymbolDef() {}
|
2012-04-14 13:54:10 +00:00
|
|
|
virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {}
|
2010-05-27 15:15:58 +00:00
|
|
|
|
2010-02-16 09:30:23 +00:00
|
|
|
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
|
2010-01-23 11:09:33 +00:00
|
|
|
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2009-10-14 17:57:32 +00:00
|
|
|
unsigned ByteAlignment) {}
|
2011-10-20 21:10:27 +00:00
|
|
|
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|
|
|
unsigned ByteAlignment) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
|
2012-08-15 19:34:23 +00:00
|
|
|
uint64_t Size = 0, unsigned ByteAlignment = 0) {}
|
2010-05-27 15:15:58 +00:00
|
|
|
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
|
|
|
uint64_t Size, unsigned ByteAlignment) {}
|
2010-01-23 11:09:33 +00:00
|
|
|
virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
|
2011-02-20 12:57:14 +00:00
|
|
|
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
2011-05-02 19:34:44 +00:00
|
|
|
unsigned AddrSpace) {}
|
|
|
|
virtual void EmitULEB128Value(const MCExpr *Value) {}
|
|
|
|
virtual void EmitSLEB128Value(const MCExpr *Value) {}
|
2010-02-16 09:30:23 +00:00
|
|
|
virtual void EmitGPRel32Value(const MCExpr *Value) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
|
|
|
|
unsigned ValueSize = 1,
|
|
|
|
unsigned MaxBytesToEmit = 0) {}
|
|
|
|
|
2010-03-03 17:27:15 +00:00
|
|
|
virtual void EmitCodeAlignment(unsigned ByteAlignment,
|
|
|
|
unsigned MaxBytesToEmit = 0) {}
|
|
|
|
|
2012-04-14 13:54:10 +00:00
|
|
|
virtual bool EmitValueToOffset(const MCExpr *Offset,
|
|
|
|
unsigned char Value = 0) { return false; }
|
2012-08-15 19:34:23 +00:00
|
|
|
|
2010-02-16 09:30:23 +00:00
|
|
|
virtual void EmitFileDirective(StringRef Filename) {}
|
2012-04-14 13:54:10 +00:00
|
|
|
virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
|
2013-04-08 18:41:23 +00:00
|
|
|
StringRef Filename, unsigned CUID = 0) {
|
2011-02-20 12:57:14 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
|
|
|
unsigned Column, unsigned Flags,
|
2011-05-02 19:34:44 +00:00
|
|
|
unsigned Isa, unsigned Discriminator,
|
|
|
|
StringRef FileName) {}
|
2009-10-14 17:57:32 +00:00
|
|
|
virtual void EmitInstruction(const MCInst &Inst) {}
|
|
|
|
|
2013-04-08 18:41:23 +00:00
|
|
|
virtual void EmitBundleAlignMode(unsigned AlignPow2) {}
|
|
|
|
virtual void EmitBundleLock(bool AlignToEnd) {}
|
|
|
|
virtual void EmitBundleUnlock() {}
|
|
|
|
|
2012-04-14 13:54:10 +00:00
|
|
|
virtual void FinishImpl() {}
|
|
|
|
|
|
|
|
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
|
|
|
|
RecordProcEnd(Frame);
|
|
|
|
}
|
2012-08-15 19:34:23 +00:00
|
|
|
|
2009-10-14 17:57:32 +00:00
|
|
|
/// @}
|
2013-04-08 18:41:23 +00:00
|
|
|
|
|
|
|
static bool classof(const MCStreamer *S) {
|
|
|
|
return S->getKind() == SK_NullStreamer;
|
|
|
|
}
|
|
|
|
|
2009-10-14 17:57:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2012-08-15 19:34:23 +00:00
|
|
|
|
2009-10-14 17:57:32 +00:00
|
|
|
MCStreamer *llvm::createNullStreamer(MCContext &Context) {
|
|
|
|
return new MCNullStreamer(Context);
|
|
|
|
}
|