Browse Source

* enable LLVM support Linux/AArch64
o also put the regular function result before the partfpstruct parameter

git-svn-id: branches/debug_eh@40577 -

Jonas Maebe 6 years ago
parent
commit
f26ac9026e

+ 1 - 1
compiler/Makefile

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

+ 1 - 1
compiler/Makefile.fpc

@@ -261,7 +261,7 @@ override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG
 
 #include LLVM define/directory if requested
 ifdef LLVM
-ifeq ($(findstring $(PPC_TARGET),x86_64),)
+ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64),)
 $(error The $(PPC_TARGET) architecture is not (yet) support by the FPC/LLVM code generator)
 endif
 

+ 4 - 0
compiler/aarch64/cpuinfo.pas

@@ -56,6 +56,10 @@ Type
 
 
 Const
+   fputypestrllvm : array[tfputype] of string[6] = ('',
+     ''
+   );
+
    { Is there support for dealing with multiple microcontrollers available }
    { for this platform? }
    ControllerSupport = false; (* Not yet at least ;-) *)

+ 7 - 4
compiler/aarch64/cpunode.pas

@@ -31,11 +31,14 @@ implementation
 
   uses
     ncgbas,ncgflw,ncgcal,ncgcnv,ncgld,ncgmem,ncgcon,ncgset,ncgobjc,
-    ncpuadd,ncpumat,ncpumem,ncpuinl,ncpucnv,ncpuset,
-    { this not really a node }
-    rgcpu,
     { symtable }
     symcpu,
-    aasmdef;
+    aasmdef,
+{$ifndef llvm}
+    ncpuadd,ncpumat,ncpumem,ncpuinl,ncpucnv,ncpuset
+{$else llvm}
+    llvmnode
+{$endif llvm}
+    ;
 
 end.

+ 2 - 2
compiler/llvm/agllvm.pas

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

+ 3 - 2
compiler/symconst.pas

@@ -122,16 +122,17 @@ const
     and will increase with 10 for each parameter. The high parameters
     will be inserted with n+1 }
   paranr_blockselfpara = 1;
-  paranr_parentfp = 2;
   paranr_parentfp_delphi_cc_leftright = 2;
 {$if defined(aarch64) and defined(llvm)}
   { for AArch64 on LLVM, the "sret" parameter
     must always be the first -> give it a higher number; can't do it for other
     platforms, because that would change the register assignment/parameter order
     and the current one is presumably Delphi-compatible }
-  paranr_result = 3;
+  paranr_result = 2;
+  paranr_parentfp = 3;
   paranr_self = 4;
 {$else}
+  paranr_parentfp = 2;
   paranr_self = 3;
   paranr_result = 4;
 {$endif}

+ 5 - 1
compiler/systems/i_linux.pas

@@ -880,7 +880,11 @@ unit i_linux;
                             tf_files_case_sensitive,
                             tf_requires_proper_alignment,
                             tf_smartlink_sections,tf_pic_uses_got,
-                            tf_has_winlike_resources];
+                            tf_has_winlike_resources
+{$ifdef llvm}
+                            ,tf_use_psabieh
+{$endif llvm}
+                            ];
             cpu          : cpu_aarch64;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';