[PATCH] ARM Streamer: print out tag names
Saleem Abdulrasool
compnerd at compnerd.org
Fri Dec 27 19:52:34 PST 2013
Hi logan, rengolin, t.p.northover,
If using verbose asm, print out the friendly name of the tag if possible.
http://llvm-reviews.chandlerc.com/D2485
Files:
lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
Index: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
===================================================================
--- lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -110,6 +110,7 @@
class ARMTargetAsmStreamer : public ARMTargetStreamer {
formatted_raw_ostream &OS;
MCInstPrinter &InstPrinter;
+ bool IsVerboseAsm;
virtual void emitFnStart();
virtual void emitFnEnd();
@@ -132,12 +133,14 @@
virtual void finishAttributeSection();
public:
- ARMTargetAsmStreamer(formatted_raw_ostream &OS, MCInstPrinter &InstPrinter);
+ ARMTargetAsmStreamer(formatted_raw_ostream &OS, MCInstPrinter &InstPrinter,
+ bool VerboseAsm);
};
ARMTargetAsmStreamer::ARMTargetAsmStreamer(formatted_raw_ostream &OS,
- MCInstPrinter &InstPrinter)
- : OS(OS), InstPrinter(InstPrinter) {}
+ MCInstPrinter &InstPrinter,
+ bool VerboseAsm)
+ : OS(OS), InstPrinter(InstPrinter), IsVerboseAsm(VerboseAsm) {}
void ARMTargetAsmStreamer::emitFnStart() { OS << "\t.fnstart\n"; }
void ARMTargetAsmStreamer::emitFnEnd() { OS << "\t.fnend\n"; }
void ARMTargetAsmStreamer::emitCantUnwind() { OS << "\t.cantunwind\n"; }
@@ -178,7 +181,13 @@
void ARMTargetAsmStreamer::switchVendor(StringRef Vendor) {
}
void ARMTargetAsmStreamer::emitAttribute(unsigned Attribute, unsigned Value) {
- OS << "\t.eabi_attribute\t" << Attribute << ", " << Twine(Value) << "\n";
+ OS << "\t.eabi_attribute\t" << Attribute << ", " << Twine(Value);
+ if (IsVerboseAsm) {
+ StringRef Name = ARMBuildAttrs::AttrTypeAsString(Attribute);
+ if (!Name.empty())
+ OS << "\t@ " << Name;
+ }
+ OS << "\n";
}
void ARMTargetAsmStreamer::emitTextAttribute(unsigned Attribute,
StringRef String) {
@@ -188,6 +197,11 @@
break;
default:
OS << "\t.eabi_attribute\t" << Attribute << ", \"" << String << "\"";
+ if (IsVerboseAsm) {
+ StringRef Name = ARMBuildAttrs::AttrTypeAsString(Attribute);
+ if (!Name.empty())
+ OS << "\t@ " << Name;
+ }
break;
}
OS << "\n";
@@ -201,6 +215,8 @@
OS << "\t.eabi_attribute\t" << Attribute << ", " << IntValue;
if (!StringValue.empty())
OS << ", \"" << StringValue << "\"";
+ if (IsVerboseAsm)
+ OS << "\t@ " << ARMBuildAttrs::AttrTypeAsString(Attribute);
break;
}
OS << "\n";
@@ -1173,7 +1189,8 @@
bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst) {
- ARMTargetAsmStreamer *S = new ARMTargetAsmStreamer(OS, *InstPrint);
+ ARMTargetAsmStreamer *S = new ARMTargetAsmStreamer(OS, *InstPrint,
+ isVerboseAsm);
return llvm::createAsmStreamer(Ctx, S, OS, isVerboseAsm, useLoc, useCFI,
useDwarfDirectory, InstPrint, CE, TAB,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2485.1.patch
Type: text/x-patch
Size: 3110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131227/07b77069/attachment.bin>
More information about the llvm-commits
mailing list