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