add comment support to the rest of the directives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-22 07:36:39 +00:00
parent d5a7e357a2
commit 7d1e49c983

View File

@@ -157,7 +157,8 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
assert(CurSection && "Cannot emit before setting section!"); assert(CurSection && "Cannot emit before setting section!");
OS << *Symbol << ":\n"; OS << *Symbol << ":";
EmitEOL();
Symbol->setSection(*CurSection); Symbol->setSection(*CurSection);
} }
@@ -166,7 +167,7 @@ void MCAsmStreamer::EmitAssemblerFlag(AssemblerFlag Flag) {
default: assert(0 && "Invalid flag!"); default: assert(0 && "Invalid flag!");
case SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break; case SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
} }
OS << '\n'; EmitEOL();
} }
void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
@@ -174,7 +175,8 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
assert((Symbol->isUndefined() || Symbol->isAbsolute()) && assert((Symbol->isUndefined() || Symbol->isAbsolute()) &&
"Cannot define a symbol twice!"); "Cannot define a symbol twice!");
OS << *Symbol << " = " << *Value << '\n'; OS << *Symbol << " = " << *Value;
EmitEOL();
// FIXME: Lift context changes into super class. // FIXME: Lift context changes into super class.
// FIXME: Set associated section. // FIXME: Set associated section.
@@ -198,11 +200,13 @@ void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
case WeakReference: OS << ".weak_reference "; break; case WeakReference: OS << ".weak_reference "; break;
} }
OS << *Symbol << '\n'; OS << *Symbol;
EmitEOL();
} }
void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
OS << ".desc" << ' ' << *Symbol << ',' << DescValue << '\n'; OS << ".desc" << ' ' << *Symbol << ',' << DescValue;
EmitEOL();
} }
void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
@@ -214,7 +218,7 @@ void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
else else
OS << ',' << Log2_32(ByteAlignment); OS << ',' << Log2_32(ByteAlignment);
} }
OS << '\n'; EmitEOL();
} }
void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol, void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
@@ -231,14 +235,16 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
if (ByteAlignment != 0) if (ByteAlignment != 0)
OS << ',' << Log2_32(ByteAlignment); OS << ',' << Log2_32(ByteAlignment);
} }
OS << '\n'; EmitEOL();
} }
void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) { void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
assert(CurSection && "Cannot emit contents before setting section!"); assert(CurSection && "Cannot emit contents before setting section!");
const char *Directive = MAI.getData8bitsDirective(AddrSpace); const char *Directive = MAI.getData8bitsDirective(AddrSpace);
for (unsigned i = 0, e = Data.size(); i != e; ++i) for (unsigned i = 0, e = Data.size(); i != e; ++i) {
OS << Directive << (unsigned)(unsigned char)Data[i] << '\n'; OS << Directive << (unsigned)(unsigned char)Data[i];
EmitEOL();
}
} }
/// EmitIntValue - Special case of EmitValue that avoids the client having /// EmitIntValue - Special case of EmitValue that avoids the client having
@@ -334,7 +340,7 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
if (MaxBytesToEmit) if (MaxBytesToEmit)
OS << ", " << MaxBytesToEmit; OS << ", " << MaxBytesToEmit;
} }
OS << '\n'; EmitEOL();
return; return;
} }
@@ -352,13 +358,14 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
OS << ", " << truncateToSize(Value, ValueSize); OS << ", " << truncateToSize(Value, ValueSize);
if (MaxBytesToEmit) if (MaxBytesToEmit)
OS << ", " << MaxBytesToEmit; OS << ", " << MaxBytesToEmit;
OS << '\n'; EmitEOL();
} }
void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset, void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
unsigned char Value) { unsigned char Value) {
// FIXME: Verify that Offset is associated with the current section. // FIXME: Verify that Offset is associated with the current section.
OS << ".org " << *Offset << ", " << (unsigned) Value << '\n'; OS << ".org " << *Offset << ", " << (unsigned) Value;
EmitEOL();
} }
void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
@@ -367,7 +374,7 @@ void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
// If we have an AsmPrinter, use that to print. // If we have an AsmPrinter, use that to print.
if (InstPrinter) { if (InstPrinter) {
InstPrinter->printInst(&Inst); InstPrinter->printInst(&Inst);
OS << '\n'; EmitEOL();
// Show the encoding if we have a code emitter. // Show the encoding if we have a code emitter.
if (Emitter) { if (Emitter) {
@@ -392,7 +399,7 @@ void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
// Otherwise fall back to a structural printing for now. Eventually we should // Otherwise fall back to a structural printing for now. Eventually we should
// always have access to the target specific printer. // always have access to the target specific printer.
Inst.print(OS, &MAI); Inst.print(OS, &MAI);
OS << '\n'; EmitEOL();
} }
void MCAsmStreamer::Finish() { void MCAsmStreamer::Finish() {