[llvm-commits] [llvm-gcc-4.2] r43740 - in /llvm-gcc-4.2/trunk/gcc: c-common.c llvm-convert.cpp

Dale Johannesen dalej at apple.com
Mon Nov 5 14:27:26 PST 2007


Author: johannes
Date: Mon Nov  5 16:27:26 2007
New Revision: 43740

URL: http://llvm.org/viewvc/llvm-project?rev=43740&view=rev
Log:
Make labels in asm blocks work.


Modified:
    llvm-gcc-4.2/trunk/gcc/c-common.c
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/c-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=43740&r1=43739&r2=43740&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.c Mon Nov  5 16:27:26 2007
@@ -8211,12 +8211,18 @@
 tree
 iasm_label (tree labid, bool atsign)
 {
-  tree sexpr;
-  tree inputs = NULL_TREE, outputs = NULL_TREE, clobbers = NULL_TREE;
-  tree stmt;
-  tree label, l;
-  tree str, one;
-
+/* LLVM LOCAL begin */
+/* Unused variables resulting from code change below. */
+#if 1
+  tree stmt, label;
+#else
+   tree sexpr;
+   tree inputs = NULL_TREE, outputs = NULL_TREE, clobbers = NULL_TREE;
+   tree stmt;
+   tree label, l;
+   tree str, one;
+#endif
+/* LLVM LOCAL end */
   STRIP_NOPS (labid);
 
   if (iasm_buffer == NULL)
@@ -8236,7 +8242,9 @@
 
   iasm_buffer[0] = '\0';
   label = iasm_get_label (labid);
-#if 0
+/* LLVM LOCAL begin */
+#if 1
+/* LLVM LOCAL end */
   /* Ideally I'd like to do this, but, it moves the label in:
 
 	nop

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43740&r1=43739&r2=43740&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Nov  5 16:27:26 2007
@@ -3593,7 +3593,14 @@
 
       Value *Op = 0;
       if (LLVMTy->isFirstClassType()) {
-        Op = Emit(Val, 0);
+        if (TREE_CODE(Val)==ADDR_EXPR &&
+            TREE_CODE(TREE_OPERAND(Val,0))==LABEL_DECL) {
+          // Emit the label, but do not assume it is going to be the target
+          // of an indirect branch.  Having this logic here is a hack; there
+          // should be a bit in the label identifying it as in an asm.
+          Op = getLabelDeclBlock(TREE_OPERAND(Val, 0));
+        } else
+          Op = Emit(Val, 0);
       } else {
         LValue LV = EmitLV(Val);
         assert(!LV.isBitfield() && "Inline asm can't have bitfield operand");





More information about the llvm-commits mailing list