Author: lattner
Date: Tue Jan 15 19:19:03 2008
New Revision: 46042

URL: http://llvm.org/viewvc/llvm-project?rev=46042&view=rev
Log:
The final ultimate(?) fix for the silly objc .reference thing.  Instead of 
ignoring
them, we now queue them up as a file-scope inline asm block.  This allows us to 
emit the same directives as gcc.



Modified:
    llvm-gcc-4.0/trunk/gcc/config/darwin.h
    llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.0/trunk/gcc/llvm.h
    llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
    llvm-gcc-4.0/trunk/gcc/varasm.c

Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=46042&r1=46041&r2=46042&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Tue Jan 15 19:19:03 2008
@@ -1381,7 +1381,22 @@
 #undef  TARGET_ASM_FUNCTION_RODATA_SECTION
 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
 
-
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
+#define ASM_DECLARE_UNRESOLVED_REFERENCE(FILE,NAME)                    \
+    do {                                                               \
+        if (FILE) {                                                    \
+           char Buffer[strlen(NAME)+30];                               \
+           sprintf(Buffer, "\t.lazy_reference %s", NAME);              \
+          if (MACHOPIC_INDIRECT)                                       \
+             sprintf(Buffer, "\t.lazy_reference %s", NAME);            \
+          else                                                         \
+             sprintf(Buffer, "\t.reference %s", NAME);                 \
+          llvm_emit_file_scope_asm(Buffer);                            \
+        }                                                              \
+       } while (0)
+#else
+/* LLVM LOCAL end */
 #define ASM_DECLARE_UNRESOLVED_REFERENCE(FILE,NAME)                    \
     do {                                                               \
         if (FILE) {                                                    \
@@ -1393,6 +1408,8 @@
           fprintf (FILE, "\n");                                        \
         }                                                              \
        } while (0)
+/* LLVM LOCAL */
+#endif /*ENABLE_LLVM*/
 
 #define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME)                         \
     do {                                                               \

Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=46042&r1=46041&r2=46042&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Tue Jan 15 19:19:03 2008
@@ -1212,14 +1212,12 @@
 // llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline
 // asm block.
 //
-void llvm_emit_file_scope_asm(tree string) {
-  if (TREE_CODE(string) == ADDR_EXPR)
-    string = TREE_OPERAND(string, 0);
+void llvm_emit_file_scope_asm(const char *string) {
   if (TheModule->getModuleInlineAsm().empty())
-    TheModule->setModuleInlineAsm(TREE_STRING_POINTER(string));
+    TheModule->setModuleInlineAsm(string);
   else
     TheModule->setModuleInlineAsm(TheModule->getModuleInlineAsm() + "\n" +
-                                  TREE_STRING_POINTER(string));
+                                  string);
 }
 
 

Modified: llvm-gcc-4.0/trunk/gcc/llvm.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm.h?rev=46042&r1=46041&r2=46042&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm.h (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm.h Tue Jan 15 19:19:03 2008
@@ -73,7 +73,7 @@
 /* llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline
  * asm block.
  */
-void llvm_emit_file_scope_asm(union tree_node*);
+void llvm_emit_file_scope_asm(const char*);
 
 /* llvm_emit_typedef - Emit the specified TYPE_DECL if desired.
  */

Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=46042&r1=46041&r2=46042&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Tue Jan 15 19:19:03 2008
@@ -18365,11 +18365,7 @@
 #ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
   if (flag_next_runtime)
     {
-  /* APPLE LOCAL begin LLVM */
-#ifdef ENABLE_LLVM
       ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
-#endif
-  /* APPLE LOCAL end LLVM */
       return;
     }
 #endif

Modified: llvm-gcc-4.0/trunk/gcc/varasm.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/varasm.c?rev=46042&r1=46041&r2=46042&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/varasm.c (original)
+++ llvm-gcc-4.0/trunk/gcc/varasm.c Tue Jan 15 19:19:03 2008
@@ -1064,7 +1064,9 @@
 {
   /* APPLE LOCAL begin LLVM */
 #ifdef ENABLE_LLVM
-  llvm_emit_file_scope_asm(string);
+  if (TREE_CODE(string) == ADDR_EXPR)
+    string = TREE_OPERAND(string, 0);
+  llvm_emit_file_scope_asm(TREE_STRING_POINTER(string));
   return;
 #endif
   /* APPLE LOCAL end LLVM */


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to