Sfoglia il codice sorgente

* fix compilation of ARM compiler for LLVM

git-svn-id: branches/debug_eh@41210 -
Jonas Maebe 6 anni fa
parent
commit
9d07e4948f

+ 3 - 3
compiler/Makefile

@@ -513,11 +513,11 @@ endif
 endif
 endif
 override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG
 override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG
 ifdef LLVM
 ifdef LLVM
-ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64),)
-$(error The $(PPC_TARGET) architecture is not (yet) support by the FPC/LLVM code generator)
+ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64 arm),)
+$(error The $(PPC_TARGET) architecture is not (yet) supported by the FPC/LLVM code generator)
 endif
 endif
 ifeq ($(findstring $(OS_TARGET),darwin iphonesim linux),)
 ifeq ($(findstring $(OS_TARGET),darwin iphonesim linux),)
-$(error The $(PPC_TARGET) target OS is not (yet) support by the FPC/LLVM code generator)
+$(error The $(PPC_TARGET) target OS is not (yet) supported by the FPC/LLVM code generator)
 endif
 endif
 override LOCALOPT+=-dllvm -Fullvm
 override LOCALOPT+=-dllvm -Fullvm
 endif
 endif

+ 3 - 3
compiler/Makefile.fpc

@@ -261,12 +261,12 @@ override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG
 
 
 #include LLVM define/directory if requested
 #include LLVM define/directory if requested
 ifdef LLVM
 ifdef LLVM
-ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64),)
-$(error The $(PPC_TARGET) architecture is not (yet) support by the FPC/LLVM code generator)
+ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64 arm),)
+$(error The $(PPC_TARGET) architecture is not (yet) supported by the FPC/LLVM code generator)
 endif
 endif
 
 
 ifeq ($(findstring $(OS_TARGET),darwin iphonesim linux),)
 ifeq ($(findstring $(OS_TARGET),darwin iphonesim linux),)
-$(error The $(PPC_TARGET) target OS is not (yet) support by the FPC/LLVM code generator)
+$(error The $(PPC_TARGET) target OS is not (yet) supported by the FPC/LLVM code generator)
 endif
 endif
 
 
 override LOCALOPT+=-dllvm -Fullvm
 override LOCALOPT+=-dllvm -Fullvm

+ 3 - 3
compiler/arm/aasmcpu.pas

@@ -198,7 +198,7 @@ uses
          roundingmode : troundingmode;
          roundingmode : troundingmode;
          procedure loadshifterop(opidx:longint;const so:tshifterop);
          procedure loadshifterop(opidx:longint;const so:tshifterop);
          procedure loadregset(opidx:longint; regsetregtype: tregistertype; regsetsubregtype: tsubregister; const s:tcpuregisterset; ausermode: boolean=false);
          procedure loadregset(opidx:longint; regsetregtype: tregistertype; regsetsubregtype: tsubregister; const s:tcpuregisterset; ausermode: boolean=false);
-         procedure loadconditioncode(opidx:longint;const cond:tasmcond);
+         procedure loadconditioncode(opidx:longint;const acond:tasmcond);
          procedure loadmodeflags(opidx:longint;const flags:tcpumodeflags);
          procedure loadmodeflags(opidx:longint;const flags:tcpumodeflags);
          procedure loadspecialreg(opidx:longint;const areg:tregister; const aflags:tspecialregflags);
          procedure loadspecialreg(opidx:longint;const areg:tregister; const aflags:tspecialregflags);
          procedure loadrealconst(opidx:longint;const _value:bestreal);
          procedure loadrealconst(opidx:longint;const _value:bestreal);
@@ -386,14 +386,14 @@ implementation
       end;
       end;
 
 
 
 
-    procedure taicpu.loadconditioncode(opidx:longint;const cond:tasmcond);
+    procedure taicpu.loadconditioncode(opidx:longint;const acond:tasmcond);
       begin
       begin
         allocate_oper(opidx+1);
         allocate_oper(opidx+1);
         with oper[opidx]^ do
         with oper[opidx]^ do
          begin
          begin
            if typ<>top_conditioncode then
            if typ<>top_conditioncode then
              clearop(opidx);
              clearop(opidx);
-           cc:=cond;
+           cc:=acond;
            typ:=top_conditioncode;
            typ:=top_conditioncode;
          end;
          end;
       end;
       end;

+ 15 - 0
compiler/arm/cpuinfo.pas

@@ -71,6 +71,21 @@ Type
       fpu_vfpv4
       fpu_vfpv4
      );
      );
 
 
+Const
+  fputypestrllvm : array[tfputype] of string[13] = ('',
+    '',
+    '',
+    '',
+    '',
+    '',
+    'fpu=vfpv2',
+    'fpu=vfpv3',
+    'fpu=vfpv3-d16',
+    'fpu=vfpv4-s16',
+    'fpu=vfpv4'
+  );
+
+Type
    tcontrollertype =
    tcontrollertype =
      (ct_none,
      (ct_none,
 
 

+ 8 - 4
compiler/arm/cpunode.pas

@@ -30,10 +30,14 @@ unit cpunode;
     uses
     uses
        { generic nodes }
        { generic nodes }
        ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl,ncgopt,ncgmat,ncgobjc,
        ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl,ncgopt,ncgmat,ncgobjc,
+       { symtable }
+       symcpu,
+       aasmdef,
        { to be able to only parts of the generic code,
        { to be able to only parts of the generic code,
          the processor specific nodes must be included
          the processor specific nodes must be included
          after the generic one (FK)
          after the generic one (FK)
        }
        }
+{$ifndef llvm}
        narmadd,
        narmadd,
        narmcal,
        narmcal,
        narmmat,
        narmmat,
@@ -42,10 +46,10 @@ unit cpunode;
        narmcnv,
        narmcnv,
        narmcon,
        narmcon,
        narmset,
        narmset,
-       narmmem,
-       { symtable }
-       symcpu,
-       aasmdef
+       narmmem
+{$else}
+       llvmnode
+{$endif}
        ;
        ;
 
 
 
 

+ 2 - 0
compiler/fpcdefs.inc

@@ -318,6 +318,8 @@
 }
 }
 {$ifdef llvm}
 {$ifdef llvm}
   {$undef SUPPORT_MMX}
   {$undef SUPPORT_MMX}
+  {$undef cpuneedsmulhelper}
+  {$undef cpuneedsdivhelper}
   {$define cpuhighleveltarget}
   {$define cpuhighleveltarget}
   {$define cpucg64shiftsupport}
   {$define cpucg64shiftsupport}
   {$define symansistr}
   {$define symansistr}

+ 2 - 2
compiler/llvm/agllvm.pas

@@ -1584,7 +1584,7 @@ implementation
           idtxt  : 'LLVM-LLC';
           idtxt  : 'LLVM-LLC';
           asmbin : 'llc';
           asmbin : 'llc';
           asmcmd: '$OPT -o $OBJ $ASM';
           asmcmd: '$OPT -o $OBJ $ASM';
-          supported_targets : [system_x86_64_linux,system_x86_64_darwin,system_aarch64_linux];
+          supported_targets : [system_x86_64_linux,system_x86_64_darwin,system_aarch64_linux,system_arm_linux];
           flags : [af_smartlink_sections];
           flags : [af_smartlink_sections];
           labelprefix : 'L';
           labelprefix : 'L';
           comment : '; ';
           comment : '; ';
@@ -1598,7 +1598,7 @@ implementation
           idtxt  : 'LLVM-CLANG';
           idtxt  : 'LLVM-CLANG';
           asmbin : 'clang';
           asmbin : 'clang';
           asmcmd: '$OPT -c -o $OBJ $ASM';
           asmcmd: '$OPT -c -o $OBJ $ASM';
-          supported_targets : [system_x86_64_linux,system_x86_64_darwin,system_aarch64_linux];
+          supported_targets : [system_x86_64_linux,system_x86_64_darwin,system_aarch64_linux,system_arm_linux];
           flags : [af_smartlink_sections];
           flags : [af_smartlink_sections];
           labelprefix : 'L';
           labelprefix : 'L';
           comment : '; ';
           comment : '; ';

+ 7 - 2
compiler/llvm/llvmbase.pas

@@ -111,6 +111,7 @@ implementation
     systems;
     systems;
 
 
 {$j-}
 {$j-}
+{$ifndef arm}
   const
   const
     llvmsystemcpu: array[tsystemcpu] of ansistring =
     llvmsystemcpu: array[tsystemcpu] of ansistring =
       ('unknown',
       ('unknown',
@@ -135,6 +136,7 @@ implementation
        'riscv32',
        'riscv32',
        'riscv64'
        'riscv64'
       );
       );
+{$endif}
 
 
   function llvm_target_name: ansistring;
   function llvm_target_name: ansistring;
     begin
     begin
@@ -154,7 +156,7 @@ implementation
             llvm_target_name:=llvm_target_name+'-ios'+iPhoneOSVersionMin;
             llvm_target_name:=llvm_target_name+'-ios'+iPhoneOSVersionMin;
         end
         end
       else if target_info.system in (systems_linux+systems_android) then
       else if target_info.system in (systems_linux+systems_android) then
-        llvm_target_name:=llvm_target_name+'-unknown-linux-gnu'
+        llvm_target_name:=llvm_target_name+'-unknown-linux'
       else if target_info.system in systems_windows then
       else if target_info.system in systems_windows then
         begin
         begin
           { WinCE isn't supported (yet) by llvm, but if/when added this is
           { WinCE isn't supported (yet) by llvm, but if/when added this is
@@ -191,7 +193,10 @@ implementation
         llvm_target_name:=llvm_target_name+'-android' }
         llvm_target_name:=llvm_target_name+'-android' }
       else
       else
         llvm_target_name:=llvm_target_name+'-gnueabi';
         llvm_target_name:=llvm_target_name+'-gnueabi';
-{$endif FPC_ARM_HF}
+{$else}
+      if target_info.system in systems_linux then
+        llvm_target_name:=llvm_target_name+'-gnu';
+{$endif}
     end;
     end;
 
 
 end.
 end.

+ 1 - 1
compiler/options.pas

@@ -4386,7 +4386,7 @@ begin
     end;
     end;
 {$endif defined(i386) or defined(x86_64)}
 {$endif defined(i386) or defined(x86_64)}
 
 
-{$if defined(arm)}
+{$if defined(arm) and not defined(llvm)}
   { it is determined during system unit compilation if clz is used for bsf or not,
   { it is determined during system unit compilation if clz is used for bsf or not,
     this is not perfect but the current implementation bsf/bsr does not allow another
     this is not perfect but the current implementation bsf/bsr does not allow another
     solution }
     solution }

+ 3 - 0
compiler/systems/i_linux.pas

@@ -597,6 +597,9 @@ unit i_linux;
 {$ifdef tls_threadvars}
 {$ifdef tls_threadvars}
                             tf_section_threadvars,
                             tf_section_threadvars,
 {$endif tls_threadvars}
 {$endif tls_threadvars}
+{$ifdef llvm}
+                            tf_use_psabieh,
+{$endif llvm}
                             tf_smartlink_sections,tf_pic_uses_got,
                             tf_smartlink_sections,tf_pic_uses_got,
                             tf_has_winlike_resources];
                             tf_has_winlike_resources];
             cpu          : cpu_arm;
             cpu          : cpu_arm;