[patch][commit] Additional cgen ops

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[patch][commit] Additional cgen ops

Dave Brolley-2
Hi,

I've committed the attached patch which implements the cgen ops
SUBWORDDIHI, SUBWORDDIQI and SUBWORDDFDI. The patch also initializes the
existing member cgen_bi_endian_cpu::branch_was_return in the constructor.

Dave

2006-05-11  Dave Brolley  <[hidden email]>

        * cgen-ops.h (SUBWORDDIHI, SUBWORDDIQI, SUBWORDDFDI): New functions.
        * compCGEN.cxx (cgen_bi_endian_cpu): Initialize branch_was_return.


Index: sid/component/cgen-cpu/cgen-ops.h
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/cgen-ops.h,v
retrieving revision 1.12
diff -c -p -r1.12 cgen-ops.h
*** sid/component/cgen-cpu/cgen-ops.h 16 Feb 2005 21:19:34 -0000 1.12
--- sid/component/cgen-cpu/cgen-ops.h 11 May 2006 14:31:27 -0000
***************
*** 1,6 ****
  // cgen-ops.h - CGEN semantic ops.  -*- C++ -*-
 
! // Copyright (C) 1999, 2000, 2002 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-ops.h - CGEN semantic ops.  -*- C++ -*-
 
! // Copyright (C) 1999, 2000, 2002, 2006 Red Hat.
  // This file is part of SID and is licensed under the GPL.
  // See the file COPYING.SID for conditions for redistribution.
 
*************** SUBWORDDIDF (DI in)
*** 560,565 ****
--- 560,587 ----
    return *out;
  }
 
+ inline HI
+ SUBWORDDIHI (DI in, int word)
+ {
+   assert (word >= 0 && word <= 3);
+   return (UHI) (in >> (16 * (3 - word))) & 0xFFFF;
+ }
+
+ inline QI
+ SUBWORDDIQI (DI in, int byte)
+ {
+   assert (byte >= 0 && byte <= 7);
+   return (UQI) (in >> (8 * (7 - byte))) & 0xFF;
+ }
+
+ inline DI
+ SUBWORDDFDI (DF in)
+ {
+   union { DF in; DI out; } x;
+   x.in = in;
+   return x.out;
+ }
+
  inline SI
  SUBWORDDFSI (DF in, int word)
  {
Index: sid/component/cgen-cpu/compCGEN.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/compCGEN.cxx,v
retrieving revision 1.17
diff -c -p -r1.17 compCGEN.cxx
*** sid/component/cgen-cpu/compCGEN.cxx 1 Mar 2006 21:07:00 -0000 1.17
--- sid/component/cgen-cpu/compCGEN.cxx 11 May 2006 14:31:27 -0000
***************
*** 1,6 ****
  // compCGEN.cxx - CPU components.  -*- C++ -*-
 
! // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 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 ----
  // compCGEN.cxx - CPU components.  -*- C++ -*-
 
! // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2006 Red Hat.
  // This file is part of SID and is licensed under the GPL.
  // See the file COPYING.SID for conditions for redistribution.
 
*************** using namespace cgen;
*** 42,47 ****
--- 42,48 ----
  // ----------------------------------------------------------------------------
  cgen_bi_endian_cpu::cgen_bi_endian_cpu ()
  {
+   branch_was_return = false;
    warnings_enabled = false;
    add_attribute ("enable-warnings?", & warnings_enabled, "setting");
    this->engine_type = ENGINE_UNKNOWN;