[llvm-commits] [gcc-plugin] r83375 - /gcc-plugin/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Tue Oct 6 01:40:03 PDT 2009


Author: baldrick
Date: Tue Oct  6 03:40:03 2009
New Revision: 83375

URL: http://llvm.org/viewvc/llvm-project?rev=83375&view=rev
Log:
Only give basic blocks the GCC names if compiling with
-fverbose-asm.  These verbose names take up a lot of
space in the bitcode.

Modified:
    gcc-plugin/trunk/llvm-convert.cpp

Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=83375&r1=83374&r2=83375&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Tue Oct  6 03:40:03 2009
@@ -888,27 +888,32 @@
   // while generating code must be nameless.  That way, artificial blocks
   // can be easily identified.
 
-  // Give the basic block a name.  If BB contains labels, name the LLVM basic
-  // block after the first label.
-  gimple stmt = first_stmt(bb);
-  if (stmt && gimple_code(stmt) == GIMPLE_LABEL) {
-    tree label = gimple_label_label(stmt);
-    if (tree name = DECL_NAME(label)) {
-      // If the label has a name then use it.
-      BB->setName(IDENTIFIER_POINTER(name));
-    } else if (LABEL_DECL_UID(label) != -1) {
-      // If the label has a UID then use it.
-      Twine UID(LABEL_DECL_UID(label));
-      BB->setName("<L" + UID + ">");
+  // Give the basic block a name.  If the user specified -fverbose-asm then
+  // use the same naming scheme as GCC.
+  if (flag_verbose_asm) {
+    // If BB contains labels, name the LLVM basic block after the first label.
+    gimple stmt = first_stmt(bb);
+    if (stmt && gimple_code(stmt) == GIMPLE_LABEL) {
+      tree label = gimple_label_label(stmt);
+      if (tree name = DECL_NAME(label)) {
+        // If the label has a name then use it.
+        BB->setName(IDENTIFIER_POINTER(name));
+      } else if (LABEL_DECL_UID(label) != -1) {
+        // If the label has a UID then use it.
+        Twine UID(LABEL_DECL_UID(label));
+        BB->setName("<L" + UID + ">");
+      } else {
+        // Otherwise use the generic UID.
+        Twine UID(DECL_UID(label));
+        BB->setName("<D." + UID + ">");
+      }
     } else {
-      // Otherwise use the generic UID.
-      Twine UID(DECL_UID(label));
-      BB->setName("<D." + UID + ">");
+      // When there is no label, use the same naming scheme as the GCC tree dumps.
+      Twine Index(bb->index);
+      BB->setName("<bb " + Index + ">");
     }
   } else {
-    // When there is no label, use the same naming scheme as the GCC tree dumps.
-    Twine Index(bb->index);
-    BB->setName("<bb " + Index + ">");
+    BB->setName("bb");
   }
 
   return BasicBlocks[bb] = BB;





More information about the llvm-commits mailing list