Ver código fonte

attinst.inc --> strinst.inc

mazen 23 anos atrás
pai
commit
b2c63fb6ca

+ 0 - 72
compiler/sparc/attinstr.inc

@@ -1,72 +0,0 @@
-{*****************************************************************************}
-{ File                   : attinstr.inc                                       }
-{ Author                 : Mazen NEIFER                                       }
-{ Project                : Free Pascal Compiler (FPC)                         }
-{ Creation date          : 2002\05\08                                         }
-{ Last modification date : 2002\07\01                                         }
-{ Licence                : GPL                                                }
-{ Bug report             : [email protected]                        }
-{*****************************************************************************}
-          'NONE',
-          'ABCD',
-          'ADD','ADDcc','ADDX','ADDXcc',
-          'AND','ANDcc','ANDN','ADDNcc',
-          'BN','BNE','BE','BG','BLE','BGE','BI','BGU','BLEU','BCC',
-          'BCS','BPOS','NEG','BVC','BVS','BA',
-          'CALL',
-          'CBccc',
-          'FBN','FBU','FBG','FBUG','FBL','FBUL','FBLG','FBNE',
-          'FBE','FBUE','FBGE','FBUGE','FBLE','FBULE','FBO','FBA',
-          'FLUSH',
-          'JMPL',
-          'LDSB','LDSH','LDSTUB',
-          'LDUB','LDUH','LD','LDD','LDF','LDFSR','LDDF','LDC','LDCSR','LDDC',
-          'LDSBA','LDSHA','LDUBA','LDUHA','LDA','LDDA',
-          'LDSTUBA',
-          'MULScc',
-          'NOP',
-          'OR','ORcc','ORN','ORNcc',
-          'RDASR','RDY','RDPSR','RDWIM','RDTBR',
-          'RESTORE',
-          'RETT',
-          'SAVE',
-          'SDIV','SDIVcc',
-          'SMUL','SMULcc',
-          'SETHI',
-          'SLL','SRL','SRA',
-          'STB','STH','ST','STD','STF','STDF','STFSR','STDFQ',
-          'STC','STDC','STCSR','STDCQ',
-          'STBA','STHA','STA','STDA',
-          'SUB','SUBcc','SUBX','SUBXcc',
-          'SWAP','SWAPA','Ticc','TADDcc','TSUBcc','TADDccTV','TSUBccTV',
-          'UDIV','UDIVcc',
-          'UMUL','UMULcc',
-          'UNMP',
-          'WRASR','WRY','WRPSR','WRWIM','WRTBR',
-          'XNOR','XNORcc',
-          'XOR','XORcc',
-          {Floating-point instructions}
-          'FiTOs','FiTOd','FiTOq',
-          'FsTOi','FdTOi','FqTOi',
-          'FsTOd','FsTOq',
-          'FdTOs','FdTOq',
-          'FqTOd','FqTOs',
-          'MOVs','NEGs','FABSs',
-          'FSQRTs','FSQRTd','FSQRTq',
-          'FADDs','FADDd','FADDq',
-          'FSUBs','FSUBd','FSUBq',
-          'FMULs','FMULd','FMULQ',
-          'FdMULq','FsMULd',
-          'DIVs','DIVd','FDIVq',
-          'FCMPs','FCMPd','FCMPq',
-          'FCPop1','CPop2',
-          {Synthetic instructions}
-          'btst','bset','bclr','btog',
-          'clr','clrb','clrh',
-          'cmp',
-          'dec','deccc',
-          'inc','inccc',
-          'not',
-          'set',
-          'skipz','skipnz',
-          'tst'

+ 33 - 26
compiler/sparc/cgcpu.pas

@@ -790,43 +790,47 @@ stack as in the Intel architecture,
 standard calling sequence does not define a maximum stack frame size, nor does
 standard calling sequence does not define a maximum stack frame size, nor does
 it restrict how a language system uses the "unspecified" areas of the standard
 it restrict how a language system uses the "unspecified" areas of the standard
 stack frame.}
 stack frame.}
-	  Dec(LocalSize,(16+1+5)*4);
+		Dec(LocalSize,(16+1+5)*4);
 {Althogh the SPARC architecture require only word alignment, software
 {Althogh the SPARC architecture require only word alignment, software
 convention and the operating system require every stack frame to be double word
 convention and the operating system require every stack frame to be double word
 aligned}
 aligned}
 		if(LocalSize and $00000003)<>0
 		if(LocalSize and $00000003)<>0
 		then
 		then
 			LocalSize:=(LocalSize and $FFFFFFFC)+4;
 			LocalSize:=(LocalSize and $FFFFFFFC)+4;
-    with list do
-      concat(Taicpu.Op_reg_const_reg(A_SAVE,S_L,Stack_Pointer_Reg,localsize,Stack_Pointer_Reg));
-  end;
+{Execute the SAVE instruction to get a new register window and get a new stack
+frame. In the "SAVE %i6,size,%i6" the first %i6 is related to the state before
+execution of the SAVE instrucion so it is the caller %i6, when the %i6 after
+execution of that instrucion is the called function stack pointer}
+		with list do
+			concat(Taicpu.Op_reg_const_reg(A_SAVE,S_L,Stack_Pointer_Reg,localsize,Stack_Pointer_Reg));
+	end;
 procedure tcgSPARC.g_restore_frame_pointer(list:TAasmOutput);
 procedure tcgSPARC.g_restore_frame_pointer(list:TAasmOutput);
-  begin
+	begin
 {We use trivial restore, as we set result before}
 {We use trivial restore, as we set result before}
-    with list do
-      concat(Taicpu.Op_reg_const_reg(A_RESTORE,S_L,R_G0,0,R_G0));
-  end;
+		with list do
+			concat(Taicpu.Op_reg_const_reg(A_RESTORE,S_L,R_G0,0,R_G0));
+	end;
 procedure tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword);
 procedure tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword);
 	var
 	var
-	  RetReference:TReference;
-  begin
-    { Routines with the poclearstack flag set use only a ret }
-    { also routines with parasize=0     }
-    with list do
+		RetReference:TReference;
+	begin
+{According to the SPARC ABI, the stack is cleared using the RESTORE instruction
+which is genereted in the g_restore_frame_pointer. Notice that SPARC has no
+RETURN instruction and that JMPL is used instead. The JMPL instrucion have one
+delay slot, so an inversion is possible such as 
+	JMPL	%i6+8,%g0
+	RESTORE	%g0,0,%g0
+If no inversion we can use just
+	RESTORE	%g0,0,%g0
+	JMPL	%i6+8,%g0
+	NOP}
+		with list do
 			begin
 			begin
 				reference_reset_base(RetReference,R_I7,8);
 				reference_reset_base(RetReference,R_I7,8);
-	      concat(Taicpu.Op_ref_reg(A_JMPL,S_L,RetReference,R_G0));
-      	if(parasize<>0)
-      	then
-           { parameters are limited to 65535 bytes because }
-           { ret allows only imm16                    }
-          IF(parasize>65535)
-          THEN
-            CGMessage(cg_e_parasize_too_big);
+				concat(Taicpu.Op_ref_reg(A_JMPL,S_L,RetReference,R_G0));
 			end
 			end
-  end;
-
-     PROCEDURE tcgSPARC.a_loadaddr_ref_reg(list:TAasmOutput;CONST ref:TReference;r:tregister);
+	end;
+PROCEDURE tcgSPARC.a_loadaddr_ref_reg(list:TAasmOutput;CONST ref:TReference;r:tregister);
 
 
        begin
        begin
 //         list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,r));
 //         list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,r));
@@ -1075,6 +1079,9 @@ BEGIN
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2002-10-01 17:41:50  florian
+  Revision 1.7  2002-10-01 21:06:29  mazen
+  attinst.inc --> strinst.inc
+
+  Revision 1.6  2002/10/01 17:41:50  florian
     * fixed log and id
     * fixed log and id
-}
+}

+ 5 - 2
compiler/sparc/cpubase.pas

@@ -142,7 +142,7 @@ TYPE
 CONST
 CONST
   FirstOp=Low(TAsmOp);
   FirstOp=Low(TAsmOp);
   LastOp=High(TAsmOp);
   LastOp=High(TAsmOp);
-  std_op2str:op2strtable=({$INCLUDE attinstr.inc});
+  std_op2str:op2strtable=({$INCLUDE strinst.inc});
 {*****************************************************************************
 {*****************************************************************************
                                 Operand Sizes
                                 Operand Sizes
 *****************************************************************************}
 *****************************************************************************}
@@ -580,7 +580,10 @@ FUNCTION flags_to_cond(CONST f:TResFlags):TAsmCond;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2002-09-30 19:12:14  mazen
+  Revision 1.9  2002-10-01 21:06:29  mazen
+  attinst.inc --> strinst.inc
+
+  Revision 1.8  2002/09/30 19:12:14  mazen
   * function prologue fixed
   * function prologue fixed
 
 
   Revision 1.7  2002/09/27 04:30:53  mazen
   Revision 1.7  2002/09/27 04:30:53  mazen

+ 5 - 2
compiler/sparc/strinst.inc

@@ -8,7 +8,7 @@
 { Bug report             : [email protected]                        }
 { Bug report             : [email protected]                        }
 {*****************************************************************************}
 {*****************************************************************************}
 {
 {
-	Id:
+	$Id$
 }
 }
           'NONE',
           'NONE',
           'ABCD',
           'ABCD',
@@ -74,5 +74,8 @@
           'skipz','skipnz',
           'skipz','skipnz',
           'tst'
           'tst'
 {
 {
-	Log:
+	$Log$
+	Revision 1.2  2002-10-01 21:07:48  mazen
+	attinst.inc --> strinst.inc
+
 }
 }