2009-08-13 23:36:34 +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:
|
|
|
|
MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
|
|
|
|
|
|
|
|
/// @name MCStreamer Interface
|
|
|
|
/// @{
|
|
|
|
|
2010-09-15 21:48:40 +00:00
|
|
|
virtual void InitSections() {
|
|
|
|
}
|
|
|
|
|
2009-08-18 16:46:29 +00:00
|
|
|
virtual void SwitchSection(const MCSection *Section) {
|
2010-09-02 18:53:37 +00:00
|
|
|
PrevSection = CurSection;
|
2009-08-18 16:46:29 +00:00
|
|
|
CurSection = Section;
|
|
|
|
}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
2010-03-09 23:12:18 +00:00
|
|
|
virtual void EmitLabel(MCSymbol *Symbol) {
|
|
|
|
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
|
|
|
assert(CurSection && "Cannot emit before setting section!");
|
|
|
|
Symbol->setSection(*CurSection);
|
|
|
|
}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
2010-01-23 06:39:22 +00:00
|
|
|
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
|
2010-11-05 22:08:08 +00:00
|
|
|
virtual void EmitThumbFunc(MCSymbol *Func) {}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
2009-08-31 08:09:28 +00:00
|
|
|
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
|
2010-11-01 14:28:48 +00:00
|
|
|
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
2010-01-23 06:39:22 +00:00
|
|
|
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
|
|
|
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
|
2010-05-08 19:54:22 +00:00
|
|
|
|
|
|
|
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
|
|
|
|
virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
|
|
|
|
virtual void EmitCOFFSymbolType(int Type) {}
|
|
|
|
virtual void EndCOFFSymbolDef() {}
|
|
|
|
|
2010-01-25 07:52:13 +00:00
|
|
|
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
|
2010-01-23 07:47:02 +00:00
|
|
|
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2009-08-30 06:17:16 +00:00
|
|
|
unsigned ByteAlignment) {}
|
2010-01-23 07:47:02 +00:00
|
|
|
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
2009-08-28 05:48:22 +00:00
|
|
|
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
|
2009-08-30 06:17:16 +00:00
|
|
|
unsigned Size = 0, unsigned ByteAlignment = 0) {}
|
2010-05-18 21:16:04 +00:00
|
|
|
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
|
|
|
uint64_t Size, unsigned ByteAlignment) {}
|
2010-01-19 19:46:13 +00:00
|
|
|
virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
|
2009-08-13 23:36:34 +00:00
|
|
|
|
2010-01-19 19:46:13 +00:00
|
|
|
virtual void EmitValue(const MCExpr *Value, unsigned Size,
|
|
|
|
unsigned AddrSpace) {}
|
2010-11-02 17:22:24 +00:00
|
|
|
virtual void EmitULEB128Value(const MCExpr *Value,
|
|
|
|
unsigned AddrSpace = 0) {}
|
|
|
|
virtual void EmitSLEB128Value(const MCExpr *Value,
|
|
|
|
unsigned AddrSpace = 0) {}
|
2010-01-25 21:28:50 +00:00
|
|
|
virtual void EmitGPRel32Value(const MCExpr *Value) {}
|
2009-08-13 23:36:34 +00:00
|
|
|
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
|
|
|
|
unsigned ValueSize = 1,
|
|
|
|
unsigned MaxBytesToEmit = 0) {}
|
|
|
|
|
2010-02-23 18:26:34 +00:00
|
|
|
virtual void EmitCodeAlignment(unsigned ByteAlignment,
|
|
|
|
unsigned MaxBytesToEmit = 0) {}
|
|
|
|
|
2009-08-31 08:09:28 +00:00
|
|
|
virtual void EmitValueToOffset(const MCExpr *Offset,
|
2009-08-13 23:36:34 +00:00
|
|
|
unsigned char Value = 0) {}
|
|
|
|
|
2010-01-25 18:58:59 +00:00
|
|
|
virtual void EmitFileDirective(StringRef Filename) {}
|
|
|
|
virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) {}
|
2009-08-13 23:36:34 +00:00
|
|
|
virtual void EmitInstruction(const MCInst &Inst) {}
|
|
|
|
|
|
|
|
virtual void Finish() {}
|
|
|
|
|
|
|
|
/// @}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MCStreamer *llvm::createNullStreamer(MCContext &Context) {
|
|
|
|
return new MCNullStreamer(Context);
|
|
|
|
}
|