public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* [patch][rfa] Improve cgen profile modelling for VLIW
@ 2003-10-21 17:49 Dave Brolley
       [not found] ` <20031021175406.GG19126@redhat.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Brolley @ 2003-10-21 17:49 UTC (permalink / raw)
  To: sid

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Hi,

This patch expands the recently-added cgen model support for cgen-cpu to 
handle generic VLIW issues.  It accumulates the maximum number of cycles 
used by all insns in a VLIW bundle and then calls a virtual function 
(step_latency) to allow the cpu to account for those cycles.

Tested against our internal port but generally useful for other 
architectures.

ok to commit?

Dave

[-- Attachment #2: model.ChangeLog --]
[-- Type: text/plain, Size: 502 bytes --]

2003-10-07  Dave Brolley  <brolley@redhat.com>

	* cgen-model.h (class cgen_model): step_cycles and step_latency
	now public.

2003-10-07  Dave Brolley  <brolley@redhat.com>

	* cgen-model.h (sidtypes.h): #include it.
	(model_insn_before): Call step_latency. Initialize vliw_cycles.
	(model_insn_after): Call step_cycles. Update vliw_cycles.
	(step_cycles): New method.
	(step_latency): New method.
	(vliw_cycles): New member of cgen_model.
	* cgen-engine.h (enum sem_status): Add SEM_STATUS_STALLED.


[-- Attachment #3: model.patch.txt --]
[-- Type: text/plain, Size: 4131 bytes --]

Index: sid/component/cgen-cpu/cgen-engine.h
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/cgen-engine.h,v
retrieving revision 1.4
diff -c -p -r1.4 cgen-engine.h
*** sid/component/cgen-cpu/cgen-engine.h	6 Feb 2003 20:44:34 -0000	1.4
--- sid/component/cgen-cpu/cgen-engine.h	21 Oct 2003 17:21:28 -0000
***************
*** 1,6 ****
  // cgen-engine.h - CGEN engine support.  -*- C++ -*-
  
! // Copyright (C) 1999, 2000 Red Hat.
  // This file is part of SID and is licensed under the GPL.
  // See the file COPYING.SID for conditions for redistribution.
  
--- 1,6 ----
  // cgen-engine.h - CGEN engine support.  -*- C++ -*-
  
! // Copyright (C) 1999, 2000, 2003 Red Hat.
  // This file is part of SID and is licensed under the GPL.
  // See the file COPYING.SID for conditions for redistribution.
  
*************** enum sem_status
*** 15,21 ****
  {
    SEM_STATUS_NORMAL,
    SEM_STATUS_BRANCH_TAKEN,
!   SEM_STATUS_DELAYED_BRANCH_TAKEN
  };
  
  // Exceptions used to exit the cpu's "main loop".
--- 15,22 ----
  {
    SEM_STATUS_NORMAL,
    SEM_STATUS_BRANCH_TAKEN,
!   SEM_STATUS_DELAYED_BRANCH_TAKEN,
!   SEM_STATUS_STALLED
  };
  
  // Exceptions used to exit the cpu's "main loop".
Index: sid/component/cgen-cpu/cgen-model.h
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/cgen-model.h,v
retrieving revision 1.1
diff -c -p -r1.1 cgen-model.h
*** sid/component/cgen-cpu/cgen-model.h	16 Apr 2003 18:13:51 -0000	1.1
--- sid/component/cgen-cpu/cgen-model.h	21 Oct 2003 17:21:28 -0000
***************
*** 7,12 ****
--- 7,13 ----
  #ifndef CGEN_MODEL_H
  #define CGEN_MODEL_H
  
+ #include <sidtypes.h>
  #include "cgen-cpu.h"
  
  namespace cgen
*************** public:
*** 19,37 ****
  
    // To be overridden as needed. Call before each insn is executed. first_p is
    // true when the insn is the first of a group of parallel insns.
!   virtual void model_insn_before (bool first_p = true) {}
  
    // To be overridden as needed. Call after each insn is executed. last_p is
    // true when the insn is the first of a group of parallel insns. cycles is the
    // number of cycles used by each particular insn.
    virtual void model_insn_after (bool last_p = true, sid::host_int_4 cycles = 1)
      {
!       if (last_p && cycles > 0)
  	cpu->update_total_latency (cycles - 1);
      }
  
  protected:
    cgen_bi_endian_cpu *cpu;
  };
  
  } // namespace cgen
--- 20,69 ----
  
    // To be overridden as needed. Call before each insn is executed. first_p is
    // true when the insn is the first of a group of parallel insns.
!   virtual void model_insn_before (bool first_p = true)
!   {
!     if (first_p)
!       {
! 	// There may be latency from insn fetch.
! 	step_latency ();
! 	this->vliw_cycles = 1;
!       }
!   }
  
    // To be overridden as needed. Call after each insn is executed. last_p is
    // true when the insn is the first of a group of parallel insns. cycles is the
    // number of cycles used by each particular insn.
    virtual void model_insn_after (bool last_p = true, sid::host_int_4 cycles = 1)
      {
!       // Accumulate the max cycles used by any one vliw insn.
!       if (cycles > this->vliw_cycles)
! 	this->vliw_cycles = cycles;
! 
!       // Account for the latency of this group of insns.
!       if (last_p)
! 	step_cycles (vliw_cycles);
!     }
! 
!   // To be overridden as needed. Update any state associated with an
!   // insn using the given number of cycles.
!   virtual void step_cycles (sid::host_int_4 cycles)
!   {
!     if (cycles > 0)
!       {
! 	// The cpu counts cycles as number of insns + total latency.
  	cpu->update_total_latency (cycles - 1);
+ 	step_latency (1);
      }
+   }
+ 
+   // To be overridden as needed. Update any state associated with an
+   // insn having latency. Insn latency is tracked using the cpu's
+   // get_total_latency () method.
+   virtual void step_latency (sid::host_int_4 = 0) {}
  
  protected:
    cgen_bi_endian_cpu *cpu;
+   sid::host_int_4 vliw_cycles;
  };
  
  } // namespace cgen

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch][rfa] Improve cgen profile modelling for VLIW
       [not found] ` <20031021175406.GG19126@redhat.com>
@ 2003-10-21 22:13   ` Dave Brolley
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Brolley @ 2003-10-21 22:13 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: sid

committed.

Frank Ch. Eigler wrote:

>>This patch expands the recently-added cgen model support for cgen-cpu to 
>>handle generic VLIW issues.  [...]
>>    
>>
>
>Can't see anything wrong with it.
>
>- FChE
>  
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-21 22:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-21 17:49 [patch][rfa] Improve cgen profile modelling for VLIW Dave Brolley
     [not found] ` <20031021175406.GG19126@redhat.com>
2003-10-21 22:13   ` Dave Brolley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).