[llvm-commits] CVS: llvm-gcc/gcc/llvm-representation.c

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 27 15:00:50 PST 2004



Changes in directory llvm-gcc/gcc:

llvm-representation.c updated: 1.12 -> 1.13
---
Log message:

Avoid calling MarkNameUsed unless we haven't already.


---
Diffs of the changes:  (+13 -2)

Index: llvm-gcc/gcc/llvm-representation.c
diff -u llvm-gcc/gcc/llvm-representation.c:1.12 llvm-gcc/gcc/llvm-representation.c:1.13
--- llvm-gcc/gcc/llvm-representation.c:1.12	Sat Nov 27 14:32:49 2004
+++ llvm-gcc/gcc/llvm-representation.c	Sat Nov 27 17:00:36 2004
@@ -256,9 +256,20 @@
     abort();
   }
 
-  /* This horrible code mirrors code found in varasm.c:assemble_name */
-  if (llvm_value_is_global(V))
+  /* This horrible code mirrors code found in varasm.c:assemble_name.  This code
+   * allows GCC to notice that we are emitting a reference to a function or
+   * global.  If the fn/global is inline, this will cause its body to be
+   * compiled to LLVM and emitted.  We only need to do this once for each
+   * global, and the MarkNameAsUsed code isn't particularly fast, so keep track
+   * of whether we've done this already or not.
+   */
+  if (V->VTy == Function && !V2F(V)->MarkedNameUsed) {
+    V2F(V)->MarkedNameUsed = 1;
+    MarkNameAsUsed(V->Name);
+  } else if (V->VTy == GlobalVariable && !V2GV(V)->MarkedNameUsed) {
+    V2GV(V)->MarkedNameUsed = 1;
     MarkNameAsUsed(V->Name);
+  }
 }
 
 /* llvm_constant implementation ********************************************






More information about the llvm-commits mailing list