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

Duncan Sands baldrick at free.fr
Wed Oct 7 02:57:42 PDT 2009


Author: baldrick
Date: Wed Oct  7 04:57:41 2009
New Revision: 83459

URL: http://llvm.org/viewvc/llvm-project?rev=83459&view=rev
Log:
When not doing verbose naming, give basic blocks more useful
names: if the GCC basic block is <bb 8> name the LLVM basic
block "8" etc.  This is better than calling everything "bb".
Also, since the length of identifiers is known, make use of
this.

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=83459&r1=83458&r2=83459&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Wed Oct  7 04:57:41 2009
@@ -180,7 +180,9 @@
   case PARM_DECL:
   case VAR_DECL: {
     if (DECL_NAME(t)) {
-      V->setName(Prefix + IDENTIFIER_POINTER(DECL_NAME(t)) + Postfix);
+      StringRef Ident(IDENTIFIER_POINTER(DECL_NAME(t)),
+                      IDENTIFIER_LENGTH(DECL_NAME(t)));
+      V->setName(Prefix + Ident + Postfix);
       return;
     }
     const char *Annotation = TREE_CODE(t) == CONST_DECL ? "C." : "D.";
@@ -941,7 +943,8 @@
       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));
+        StringRef Ident(IDENTIFIER_POINTER(name), IDENTIFIER_LENGTH(name));
+        BB->setName(Ident);
       } else if (LABEL_DECL_UID(label) != -1) {
         // If the label has a UID then use it.
         Twine UID(LABEL_DECL_UID(label));
@@ -957,7 +960,8 @@
       BB->setName("<bb " + Index + ">");
     }
   } else {
-    BB->setName("bb");
+    Twine Index(bb->index);
+    BB->setName(Index);
   }
 
   return BasicBlocks[bb] = BB;





More information about the llvm-commits mailing list