2009-08-14 07:36:34 +08: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-16 05:48:40 +08:00
|
|
|
virtual void InitSections() {
|
|
|
|
}
|
|
|
|
|
2011-02-16 09:08:29 +08:00
|
|
|
virtual void ChangeSection(const MCSection *Section) {
|
2009-08-19 00:46:29 +08:00
|
|
|
}
|
2009-08-14 07:36:34 +08:00
|
|
|
|
2010-03-10 07:12:18 +08:00
|
|
|
virtual void EmitLabel(MCSymbol *Symbol) {
|
|
|
|
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
2011-02-16 09:08:29 +08:00
|
|
|
assert(getCurrentSection() && "Cannot emit before setting section!");
|
|
|
|
Symbol->setSection(*getCurrentSection());
|
2010-03-10 07:12:18 +08:00
|
|
|
}
|
2009-08-14 07:36:34 +08:00
|
|
|
|
2010-01-23 14:39:22 +08:00
|
|
|
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
|
2010-11-06 06:08:08 +08:00
|
|
|
virtual void EmitThumbFunc(MCSymbol *Func) {}
|
2009-08-14 07:36:34 +08:00
|
|
|
|
2009-08-31 16:09:28 +08:00
|
|
|
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
|
2010-11-01 22:28:48 +08:00
|
|
|
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
|
2010-12-03 08:55:40 +08:00
|
|
|
virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
|
|
|
|
const MCSymbol *LastLabel,
|
2011-07-14 13:43:07 +08:00
|
|
|
const MCSymbol *Label,
|
|
|
|
unsigned PointerSize) {}
|
2009-08-14 07:36:34 +08:00
|
|
|
|
2010-01-23 14:39:22 +08:00
|
|
|
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
|
2009-08-14 07:36:34 +08:00
|
|
|
|
|
|
|
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
|
2010-05-09 03:54:22 +08:00
|
|
|
|
|
|
|
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
|
|
|
|
virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
|
|
|
|
virtual void EmitCOFFSymbolType(int Type) {}
|
|
|
|
virtual void EndCOFFSymbolDef() {}
|
2011-12-17 09:14:52 +08:00
|
|
|
virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {}
|
2010-05-09 03:54:22 +08:00
|
|
|
|
2010-01-25 15:52:13 +08:00
|
|
|
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
|
2010-01-23 15:47:02 +08:00
|
|
|
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2009-08-30 14:17:16 +08:00
|
|
|
unsigned ByteAlignment) {}
|
2011-09-02 07:04:27 +08:00
|
|
|
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|
|
|
unsigned ByteAlignment) {}
|
2009-08-28 13:48:22 +08:00
|
|
|
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
|
2009-08-30 14:17:16 +08:00
|
|
|
unsigned Size = 0, unsigned ByteAlignment = 0) {}
|
2010-05-19 05:16:04 +08:00
|
|
|
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
|
|
|
uint64_t Size, unsigned ByteAlignment) {}
|
2010-01-20 03:46:13 +08:00
|
|
|
virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
|
2009-08-14 07:36:34 +08:00
|
|
|
|
2010-12-10 15:39:47 +08:00
|
|
|
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
2011-05-01 11:50:49 +08:00
|
|
|
unsigned AddrSpace) {}
|
2011-04-22 07:39:26 +08:00
|
|
|
virtual void EmitULEB128Value(const MCExpr *Value) {}
|
|
|
|
virtual void EmitSLEB128Value(const MCExpr *Value) {}
|
2010-01-26 05:28:50 +08:00
|
|
|
virtual void EmitGPRel32Value(const MCExpr *Value) {}
|
2009-08-14 07:36:34 +08:00
|
|
|
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
|
|
|
|
unsigned ValueSize = 1,
|
|
|
|
unsigned MaxBytesToEmit = 0) {}
|
|
|
|
|
2010-02-24 02:26:34 +08:00
|
|
|
virtual void EmitCodeAlignment(unsigned ByteAlignment,
|
|
|
|
unsigned MaxBytesToEmit = 0) {}
|
|
|
|
|
2012-01-27 08:37:08 +08:00
|
|
|
virtual bool EmitValueToOffset(const MCExpr *Offset,
|
|
|
|
unsigned char Value = 0) { return false; }
|
2012-05-11 09:41:30 +08:00
|
|
|
|
2010-01-26 02:58:59 +08:00
|
|
|
virtual void EmitFileDirective(StringRef Filename) {}
|
2011-10-18 07:05:28 +08:00
|
|
|
virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
|
|
|
|
StringRef Filename) {
|
2010-11-17 05:20:32 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
|
|
|
unsigned Column, unsigned Flags,
|
2011-04-19 04:26:49 +08:00
|
|
|
unsigned Isa, unsigned Discriminator,
|
|
|
|
StringRef FileName) {}
|
2009-08-14 07:36:34 +08:00
|
|
|
virtual void EmitInstruction(const MCInst &Inst) {}
|
|
|
|
|
2012-01-07 11:13:18 +08:00
|
|
|
virtual void FinishImpl() {}
|
2012-02-23 07:49:50 +08:00
|
|
|
|
|
|
|
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
|
|
|
|
RecordProcEnd(Frame);
|
|
|
|
}
|
2012-05-11 09:41:30 +08:00
|
|
|
|
2009-08-14 07:36:34 +08:00
|
|
|
/// @}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2012-05-11 09:41:30 +08:00
|
|
|
|
2009-08-14 07:36:34 +08:00
|
|
|
MCStreamer *llvm::createNullStreamer(MCContext &Context) {
|
|
|
|
return new MCNullStreamer(Context);
|
|
|
|
}
|