[llvm-commits] [llvm] r78960 - in /llvm/trunk: include/llvm/MC/MCStreamer.h include/llvm/Target/TargetRegistry.h lib/MC/MCAsmStreamer.cpp lib/MC/MCNullStreamer.cpp
Daniel Dunbar
daniel at zuster.org
Thu Aug 13 16:36:35 PDT 2009
Author: ddunbar
Date: Thu Aug 13 18:36:34 2009
New Revision: 78960
URL: http://llvm.org/viewvc/llvm-project?rev=78960&view=rev
Log:
llvm-mc: Add dummy MCStreamer implementation, (eventually) for use in profiling.
- Currently unused.
- A few other random comment fixes lumped in.
Added:
llvm/trunk/lib/MC/MCNullStreamer.cpp
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/include/llvm/Target/TargetRegistry.h
llvm/trunk/lib/MC/MCAsmStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=78960&r1=78959&r2=78960&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Thu Aug 13 18:36:34 2009
@@ -221,6 +221,10 @@
virtual void Finish() = 0;
};
+ /// createNullStreamer - Create a dummy machine code streamer, which does
+ /// nothing. This is useful for timing the assembler front end.
+ MCStreamer *createNullStreamer(MCContext &Ctx);
+
/// createAsmStreamer - Create a machine code streamer which will print out
/// assembly for the native target, suitable for compiling with a native
/// assembler.
Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegistry.h?rev=78960&r1=78959&r2=78960&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegistry.h Thu Aug 13 18:36:34 2009
@@ -217,7 +217,7 @@
/// the current host. If no close target can be found, this returns null
/// and sets the Error string to a reason.
///
- /// Mainted for compatibility through 2.6.
+ /// Maintained for compatibility through 2.6.
static const Target *getClosestTargetForJIT(std::string &Error);
/// @}
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=78960&r1=78959&r2=78960&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Aug 13 18:36:34 2009
@@ -155,6 +155,7 @@
void MCAsmStreamer::EmitAssemblerFlag(AssemblerFlag Flag) {
switch (Flag) {
+ default: assert(0 && "Invalid flag!");
case SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
}
OS << '\n';
@@ -215,10 +216,7 @@
void MCAsmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
unsigned Size, unsigned Pow2Alignment) {
- // Note: a .zerofill directive does not switch sections
- // FIXME: Really we would like the segment and section names as well as the
- // section type to be separate values instead of embedded in the name. Not
- // all assemblers understand all this stuff though.
+ // Note: a .zerofill directive does not switch sections.
OS << ".zerofill ";
// This is a mach-o specific directive.
@@ -226,7 +224,6 @@
OS << '"' << MOSection->getSegmentName() << ","
<< MOSection->getSectionName() << '"';
-
if (Symbol != NULL) {
OS << ',' << Symbol << ',' << Size;
if (Pow2Alignment != 0)
Added: llvm/trunk/lib/MC/MCNullStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=78960&view=auto
==============================================================================
--- llvm/trunk/lib/MC/MCNullStreamer.cpp (added)
+++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Aug 13 18:36:34 2009
@@ -0,0 +1,72 @@
+//===- 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"
+#include "llvm/MC/MCValue.h"
+
+using namespace llvm;
+
+namespace {
+
+ class MCNullStreamer : public MCStreamer {
+ public:
+ MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
+
+ /// @name MCStreamer Interface
+ /// @{
+
+ virtual void SwitchSection(MCSection *Section) {}
+
+ virtual void EmitLabel(MCSymbol *Symbol) {}
+
+ virtual void EmitAssemblerFlag(AssemblerFlag Flag) {}
+
+ virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value,
+ bool MakeAbsolute = false) {}
+
+ virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) {}
+
+ virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
+
+ virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) {}
+
+ virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+ unsigned Pow2Alignment, bool IsLocal) {}
+
+ virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = NULL,
+ unsigned Size = 0, unsigned Pow2Alignment = 0) {}
+
+ virtual void EmitBytes(const StringRef &Data) {}
+
+ virtual void EmitValue(const MCValue &Value, unsigned Size) {}
+
+ virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
+ unsigned ValueSize = 1,
+ unsigned MaxBytesToEmit = 0) {}
+
+ virtual void EmitValueToOffset(const MCValue &Offset,
+ unsigned char Value = 0) {}
+
+ virtual void EmitInstruction(const MCInst &Inst) {}
+
+ virtual void Finish() {}
+
+ /// @}
+ };
+
+}
+
+MCStreamer *llvm::createNullStreamer(MCContext &Context) {
+ return new MCNullStreamer(Context);
+}
More information about the llvm-commits
mailing list