mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 16:39:24 +01:00 
			
		
		
		
	* moved setting the call result to a separate method, so it can still be
used across multiple levels of inheritance such as on MIPS (and the code
    has to be reusable for a_call_ref/reeg in the future anyway)
git-svn-id: trunk@21906 -
			
			
This commit is contained in:
		
							parent
							
								
									e5ee1c9f67
								
							
						
					
					
						commit
						7717e43929
					
				@ -459,7 +459,7 @@ implementation
 | 
			
		||||
  function thlcg2ll.a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; forceresdef: tdef; weak: boolean): tcgpara;
 | 
			
		||||
    begin
 | 
			
		||||
      cg.a_call_name(list,s,weak);
 | 
			
		||||
      result:=inherited;
 | 
			
		||||
      result:=get_call_result_cgpara(pd,forceresdef);
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
  procedure thlcg2ll.a_call_reg(list: TAsmList; pd: tabstractprocdef; reg: tregister);
 | 
			
		||||
@ -475,7 +475,7 @@ implementation
 | 
			
		||||
  function thlcg2ll.a_call_name_static(list: TAsmList; pd: tprocdef; const s: TSymStr; forceresdef: tdef): tcgpara;
 | 
			
		||||
    begin
 | 
			
		||||
      cg.a_call_name_static(list,s);
 | 
			
		||||
      result:=inherited a_call_name(list,pd,s,forceresdef,false);
 | 
			
		||||
      result:=get_call_result_cgpara(pd,forceresdef);
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
  procedure thlcg2ll.a_load_const_reg(list: TAsmList; tosize: tdef; a: aint; register: tregister);
 | 
			
		||||
 | 
			
		||||
@ -194,7 +194,7 @@ unit hlcgobj;
 | 
			
		||||
             Returns the function result location.
 | 
			
		||||
             This routine must be overridden for each new target cpu.
 | 
			
		||||
          }
 | 
			
		||||
          function a_call_name(list : TAsmList;pd : tprocdef;const s : TSymStr; forceresdef: tdef; weak: boolean): tcgpara;virtual;
 | 
			
		||||
          function a_call_name(list : TAsmList;pd : tprocdef;const s : TSymStr; forceresdef: tdef; weak: boolean): tcgpara;virtual;abstract;
 | 
			
		||||
          procedure a_call_reg(list : TAsmList;pd : tabstractprocdef;reg : tregister);virtual;abstract;
 | 
			
		||||
          procedure a_call_ref(list : TAsmList;pd : tabstractprocdef;const ref : treference);virtual;
 | 
			
		||||
          { same as a_call_name, might be overridden on certain architectures to emit
 | 
			
		||||
@ -261,6 +261,7 @@ unit hlcgobj;
 | 
			
		||||
          procedure a_bit_set_const_loc(list: TAsmList; doset: boolean; tosize: tdef; bitnumber: aint; const loc: tlocation);virtual;
 | 
			
		||||
 | 
			
		||||
         protected
 | 
			
		||||
           function  get_call_result_cgpara(pd: tprocdef; forceresdef: tdef): tcgpara;
 | 
			
		||||
           procedure get_subsetref_load_info(const sref: tsubsetreference; out loadsize: torddef; out extra_load: boolean);
 | 
			
		||||
           procedure a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tdef; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister); virtual;
 | 
			
		||||
           procedure a_load_subsetref_regs_index(list: TAsmList; subsetsize: tdef; loadbitsize: byte; const sref: tsubsetreference; valuereg: tregister); virtual;
 | 
			
		||||
@ -873,19 +874,6 @@ implementation
 | 
			
		||||
         end;
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
  function thlcgobj.a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; forceresdef: tdef; weak: boolean): tcgpara;
 | 
			
		||||
    begin
 | 
			
		||||
      { this is incomplete, it only sets the default function result location;
 | 
			
		||||
        for use by descendants }
 | 
			
		||||
      if not assigned(forceresdef) then
 | 
			
		||||
        begin
 | 
			
		||||
          pd.init_paraloc_info(callerside);
 | 
			
		||||
          result:=pd.funcretloc[callerside];
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        result:=paramanager.get_funcretloc(pd,callerside,forceresdef);
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
  procedure thlcgobj.a_call_ref(list: TAsmList; pd: tabstractprocdef; const ref: treference);
 | 
			
		||||
    var
 | 
			
		||||
      reg: tregister;
 | 
			
		||||
@ -1586,6 +1574,18 @@ implementation
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  function thlcgobj.get_call_result_cgpara(pd: tprocdef; forceresdef: tdef): tcgpara;
 | 
			
		||||
    begin
 | 
			
		||||
      if not assigned(forceresdef) then
 | 
			
		||||
        begin
 | 
			
		||||
          pd.init_paraloc_info(callerside);
 | 
			
		||||
          result:=pd.funcretloc[callerside];
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        result:=paramanager.get_funcretloc(pd,callerside,forceresdef);
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  (*
 | 
			
		||||
    Subsetrefs are used for (bit)packed arrays and (bit)packed records stored
 | 
			
		||||
    in memory. They are like a regular reference, but contain an extra bit
 | 
			
		||||
 | 
			
		||||
@ -2343,7 +2343,7 @@ implementation
 | 
			
		||||
          pd.init_paraloc_info(calleeside);
 | 
			
		||||
          list.concat(taicpu.op_sym_const(opc,current_asmdata.RefAsmSymbol(s),pd.calleeargareasize));
 | 
			
		||||
        end;
 | 
			
		||||
      result:=inherited a_call_name(list,pd,s,forceresdef,false);
 | 
			
		||||
      result:=get_call_result_cgpara(pd,forceresdef);
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
  procedure create_hlcodegen;
 | 
			
		||||
 | 
			
		||||
@ -73,8 +73,8 @@ implementation
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        cg.a_call_name(list,s,weak);
 | 
			
		||||
      { the default implementation only determines the result location }
 | 
			
		||||
      result:=inherited;
 | 
			
		||||
      { set the result location }
 | 
			
		||||
      result:=get_call_result_cgpara(pd,forceresdef);
 | 
			
		||||
    end;
 | 
			
		||||
 | 
			
		||||
  procedure thlcgmips.a_call_reg(list: TAsmList; pd: tabstractprocdef; reg: tregister);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user