Selaa lähdekoodia

+ Xtensa: CALL0 abi started

git-svn-id: trunk@44328 -
florian 5 vuotta sitten
vanhempi
commit
ad99285fec

+ 2 - 0
compiler/systems.inc

@@ -329,6 +329,8 @@
               may still be removed by the callee (and then the stack needs to
               may still be removed by the callee (and then the stack needs to
               be restored by the caller) }
               be restored by the caller) }
             ,abi_i386_dynalignedstack
             ,abi_i386_dynalignedstack
+            ,abi_xtensa_windowed
+            ,abi_xtensa_call0
        );
        );
 
 
      const
      const

+ 3 - 1
compiler/systems.pas

@@ -438,7 +438,9 @@ interface
          (name: 'OLDWIN32GNU'; supported:{$ifdef I386}true{$else}false{$endif}),
          (name: 'OLDWIN32GNU'; supported:{$ifdef I386}true{$else}false{$endif}),
          (name: 'AARCH64IOS'; supported:{$ifdef aarch64}true{$else}false{$endif}),
          (name: 'AARCH64IOS'; supported:{$ifdef aarch64}true{$else}false{$endif}),
          (name: 'RISCVHF'; supported:{$if defined(riscv32) or defined(riscv64)}true{$else}false{$endif}),
          (name: 'RISCVHF'; supported:{$if defined(riscv32) or defined(riscv64)}true{$else}false{$endif}),
-         (name: 'LINUX386_SYSV'; supported:{$if defined(i386)}true{$else}false{$endif})
+         (name: 'LINUX386_SYSV'; supported:{$if defined(i386)}true{$else}false{$endif}),
+         (name: 'WINDOWED'; supported:{$if defined(xtensa)}true{$else}false{$endif}),
+         (name: 'CALL0'; supported:{$if defined(xtensa)}true{$else}false{$endif})
        );
        );
 
 
        { x86 asm modes with an Intel-style syntax }
        { x86 asm modes with an Intel-style syntax }

+ 6 - 2
compiler/xtensa/cgcpu.pas

@@ -434,14 +434,18 @@ implementation
     procedure tcgcpu.g_proc_entry(list : TAsmList; localsize : longint;
     procedure tcgcpu.g_proc_entry(list : TAsmList; localsize : longint;
      nostackframe : boolean);
      nostackframe : boolean);
       begin
       begin
-        list.Concat(taicpu.op_reg_const(A_ENTRY,NR_STACK_POINTER_REG,32));
+        if target_info.abi=abi_xtensa_windowed then
+          list.Concat(taicpu.op_reg_const(A_ENTRY,NR_STACK_POINTER_REG,32));
       end;
       end;
 
 
 
 
     procedure tcgcpu.g_proc_exit(list : TAsmList; parasize : longint;
     procedure tcgcpu.g_proc_exit(list : TAsmList; parasize : longint;
      nostackframe : boolean);
      nostackframe : boolean);
       begin
       begin
-        list.Concat(taicpu.op_none(A_RETW));
+        if target_info.abi=abi_xtensa_windowed then
+          list.Concat(taicpu.op_none(A_RETW))
+        else
+          list.Concat(taicpu.op_none(A_RET));
       end;
       end;
 
 
 
 

+ 14 - 8
compiler/xtensa/cpuinfo.pas

@@ -19,7 +19,8 @@ Unit CPUInfo;
 Interface
 Interface
 
 
   uses
   uses
-    globtype;
+    globtype,
+    systems;
 
 
 Type
 Type
    bestreal = double;
    bestreal = double;
@@ -35,6 +36,7 @@ Type
    { possible supported processors for this target }
    { possible supported processors for this target }
    tcputype =
    tcputype =
       (cpu_none,
       (cpu_none,
+       cpu_lx106,
        cpu_lx6
        cpu_lx6
       );
       );
 
 
@@ -49,6 +51,7 @@ Type
 Type
 Type
    tcontrollertype =
    tcontrollertype =
      (ct_none,
      (ct_none,
+      ct_esp8266,
       ct_esp32_d0wd,
       ct_esp32_d0wd,
       ct_esp32_d2wd,
       ct_esp32_d2wd,
       ct_esp32_sOwd
       ct_esp32_sOwd
@@ -56,7 +59,7 @@ Type
 
 
    tcontrollerdatatype = record
    tcontrollerdatatype = record
       controllertypestr, controllerunitstr: string[20];
       controllertypestr, controllerunitstr: string[20];
-      cputype: tcputype; fputype: tfputype;
+      cputype: tcputype; fputype: tfputype; abi: tabi;
       flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
       flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
    end;
    end;
 
 
@@ -86,6 +89,7 @@ Const
 
 
    cputypestr : array[tcputype] of string[8] = (
    cputypestr : array[tcputype] of string[8] = (
      '',
      '',
+     'LX106',
      'LX6'
      'LX6'
    );
    );
 
 
@@ -102,10 +106,11 @@ Const
 
 
    embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
    embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
    (
    (
-      (controllertypestr:'';		controllerunitstr:'';	cputype:cpu_none; fputype:fpu_none; flashbase:0),
-      (controllertypestr:'ESP32_D0WD';	controllerunitstr:'ESP32_D0WD';	cputype:cpu_lx6; fputype:fpu_none; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024),
-      (controllertypestr:'ESP32_D2WD';	controllerunitstr:'ESP32_D2WD';	cputype:cpu_lx6; fputype:fpu_none; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024),
-      (controllertypestr:'ESP32_S0WD';	controllerunitstr:'ESP32_S0WD';	cputype:cpu_lx6; fputype:fpu_none; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024)
+      (controllertypestr:'';		controllerunitstr:'';	cputype:cpu_none; fputype:fpu_none; abi: abi_default; flashbase:0),
+      (controllertypestr:'ESP8266';	controllerunitstr:'ESP8266';	cputype:cpu_lx106; fputype:fpu_none; abi: abi_xtensa_call0; { flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024 }),
+      (controllertypestr:'ESP32_D0WD';	controllerunitstr:'ESP32_D0WD';	cputype:cpu_lx6; fputype:fpu_none; abi: abi_xtensa_windowed; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024),
+      (controllertypestr:'ESP32_D2WD';	controllerunitstr:'ESP32_D2WD';	cputype:cpu_lx6; fputype:fpu_none; abi: abi_xtensa_windowed; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024),
+      (controllertypestr:'ESP32_S0WD';	controllerunitstr:'ESP32_S0WD';	cputype:cpu_lx6; fputype:fpu_none; abi: abi_xtensa_windowed; flashbase:$40000000; flashsize:448*1024; srambase:$40070000; sramsize: 520*1024)
    );
    );
 
 
    { Supported optimizations, only used for information }
    { Supported optimizations, only used for information }
@@ -126,7 +131,7 @@ Const
  type
  type
    tcpuflags =
    tcpuflags =
       (
       (
-        CPUXTENSA_DUMMY
+        CPUXTENSA_REGWINDOW
       );
       );
 
 
    tfpuflags =
    tfpuflags =
@@ -138,7 +143,8 @@ Const
    cpu_capabilities : array[tcputype] of set of tcpuflags =
    cpu_capabilities : array[tcputype] of set of tcpuflags =
      (
      (
        { cpu_none     } [],
        { cpu_none     } [],
-       { cpu_lx6      } []
+       { cpu_lx106    } [],
+       { cpu_lx6      } [CPUXTENSA_REGWINDOW]
      );
      );
 
 
    fpu_capabilities : array[tfputype] of set of tfpuflags =
    fpu_capabilities : array[tfputype] of set of tfpuflags =

+ 10 - 2
compiler/xtensa/cpupi.pas

@@ -65,8 +65,16 @@ unit cpupi;
         inherited create(aparent);
         inherited create(aparent);
         maxpushedparasize := 0;
         maxpushedparasize := 0;
         framepointer:=NR_FRAME_POINTER_REG;
         framepointer:=NR_FRAME_POINTER_REG;
-        callins:=A_CALL8;
-        callxins:=A_CALLX8;
+        if target_info.abi=abi_xtensa_windowed then
+          begin
+            callins:=A_CALL8;
+            callxins:=A_CALLX8;
+          end
+        else
+          begin
+            callins:=A_CALL0;
+            callxins:=A_CALLX0;
+          end
       end;
       end;