changeset 533:2fe2d4518618

Reverted some changes in the Tango patch, splitting asm block is simply not supported by llvm.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 24 Aug 2008 16:51:17 +0200
parents 0beebf923322
children 8a73062f934e
files gen/asmstmt.cpp runtime/llvmdc.diff
diffstat 2 files changed, 54 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/gen/asmstmt.cpp	Thu Aug 21 15:35:39 2008 +0200
+++ b/gen/asmstmt.cpp	Sun Aug 24 16:51:17 2008 +0200
@@ -177,6 +177,9 @@
     Logger::println("AsmStatement::toIR(): %s", loc.toChars());
     LOG_SCOPE;
 
+    // sanity check
+    assert(irs->func()->decl->inlineAsm);
+
     // get asm block
     IRAsmBlock* asmblock = irs->asmBlock;
     assert(asmblock);
--- a/runtime/llvmdc.diff	Thu Aug 21 15:35:39 2008 +0200
+++ b/runtime/llvmdc.diff	Sun Aug 24 16:51:17 2008 +0200
@@ -88,33 +88,54 @@
 ===================================================================
 --- lib/common/tango/core/Thread.d	(revision 3899)
 +++ lib/common/tango/core/Thread.d	(working copy)
-@@ -255,6 +255,10 @@
+@@ -244,8 +244,30 @@
+         }
+         body
+         {
+-            version( D_InlineAsm_X86 )
++            version( LLVMDC)
              {
-                 __builtin_unwind_init();
++                version(X86)
++                {
++                    uint eax,ecx,edx,ebx,ebp,esi,edi;
++                    asm
++                    {
++                        //pushad              ;
++                        mov eax[EBP], EAX      ;
++                        mov ecx[EBP], ECX      ;
++                        mov edx[EBP], EDX      ;
++                        mov ebx[EBP], EBX      ;
++                        mov ebp[EBP], EBP      ;
++                        mov esi[EBP], ESI      ;
++                        mov edi[EBP], EDI      ;
++                    }
++                }
++                else
++                {
++                    static assert( false, "Architecture not supported." );
++                }
++            }
++            else version( D_InlineAsm_X86 )
++            {
+                 asm
+                 {
+                     pushad;
+@@ -297,6 +319,10 @@
+                 }
              }
-+            else version( LLVMDC )
+ 
++            version( LLVMDC)
 +            {
-+                pragma(msg, "don't know how to push registers on the stack for this architecture with LLVMDC");
++                // nothing to pop
 +            }
-             else
+             version( D_InlineAsm_X86 )
              {
-                 static assert( false, "Architecture not supported." );
-@@ -308,6 +312,10 @@
-             {
-                 // registers will be popped automatically
-             }
-+            else version( LLVMDC )
-+            {
-+                // TODO
-+            }
-             else
-             {
-                 static assert( false, "Architecture not supported." );
+                 asm
 Index: lib/gc/basic/gcx.d
 ===================================================================
 --- lib/gc/basic/gcx.d	(revision 3899)
 +++ lib/gc/basic/gcx.d	(working copy)
-@@ -2178,6 +2178,21 @@
+@@ -2178,6 +2178,29 @@
              __builtin_unwind_init();
              sp = & sp;
          }
@@ -122,37 +143,35 @@
 +        {
 +            version(X86)
 +            {
++                uint eax,ecx,edx,ebx,ebp,esi,edi;
 +                asm
 +                {
-+                    pushad              ;
++                    pushad                 ;
++                    mov eax[EBP], EAX      ;
++                    mov ecx[EBP], ECX      ;
++                    mov edx[EBP], EDX      ;
++                    mov ebx[EBP], EBX      ;
++                    mov ebp[EBP], EBP      ;
++                    mov esi[EBP], ESI      ;
++                    mov edi[EBP], EDI      ;
 +                    mov sp[EBP],ESP     ;
 +                }
 +            }
 +            else
 +            {
-+                pragma(msg, "don't know how to push registers on the stack for this architecture with llvmdc");
++                static assert( false, "Architecture not supported." );
 +            }
 +        }
          else
          {
          asm
-@@ -2191,6 +2206,20 @@
+@@ -2191,6 +2214,10 @@
          {
              // nothing to do
          }
 +        else version(LLVMDC)
 +        {
-+            version(X86)
-+            {
-+                asm
-+                {
-+                    popad               ;
-+                }
-+            }
-+            else
-+            {
-+                // TODO
-+            }
++            // nothing to do
 +        }
          else
          {