[llvm-commits] [llvm] r80427 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Bill Wendling
isanbard at gmail.com
Sat Aug 29 05:17:54 PDT 2009
Author: void
Date: Sat Aug 29 07:17:53 2009
New Revision: 80427
URL: http://llvm.org/viewvc/llvm-project?rev=80427&view=rev
Log:
Add a form of EOL which emits the text version of a DWARF format encoding. This
doesn't handle all values of the formatting. Those can be added as needed.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=80427&r1=80426&r2=80427&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sat Aug 29 07:17:53 2009
@@ -268,7 +268,9 @@
void EOL() const;
void EOL(const std::string &Comment) const;
void EOL(const char* Comment) const;
-
+ void EOL(const std::string &Comment, unsigned Encoding) const;
+ void EOL(const char *Comment, unsigned Encoding) const;
+
/// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
/// unsigned leb128 value.
void EmitULEB128Bytes(unsigned Value) const;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=80427&r1=80426&r2=80427&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sat Aug 29 07:17:53 2009
@@ -604,6 +604,56 @@
O << '\n';
}
+static const char *DecodeDWARFEncoding(unsigned Encoding) {
+ switch (Encoding) {
+ case dwarf::DW_EH_PE_absptr:
+ return "absptr";
+ case dwarf::DW_EH_PE_omit:
+ return "omit";
+ case dwarf::DW_EH_PE_pcrel:
+ return "pcrel";
+ case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata4:
+ return "pcrel udata4";
+ case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4:
+ return "pcrel sdata4";
+ case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8:
+ return "pcrel udata8";
+ case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8:
+ return "pcrel sdata8";
+ case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata4:
+ return "indirect pcrel udata4";
+ case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata4:
+ return "indirect pcrel sdata4";
+ case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata8:
+ return "indirect pcrel udata8";
+ case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata8:
+ return "indirect pcrel sdata8";
+ }
+
+ return 0;
+}
+
+void AsmPrinter::EOL(const std::string &Comment, unsigned Encoding) const {
+ if (VerboseAsm && !Comment.empty()) {
+ EOL(Comment.c_str(), Encoding);
+ return;
+ }
+ O << '\n';
+}
+
+void AsmPrinter::EOL(const char *Comment, unsigned Encoding) const {
+ if (VerboseAsm && *Comment) {
+ O.PadToColumn(MAI->getCommentColumn());
+ O << MAI->getCommentString()
+ << ' '
+ << Comment;
+
+ if (const char *EncStr = DecodeDWARFEncoding(Encoding))
+ O << " (" << EncStr << ')';
+ }
+ O << '\n';
+}
+
/// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
/// unsigned leb128 value.
void AsmPrinter::EmitULEB128Bytes(unsigned Value) const {
More information about the llvm-commits
mailing list