OSDN Git Service

003-04-16 Dave Brolley <brolley@redhat.com>
authorbrolley <brolley>
Wed, 16 Apr 2003 18:13:51 +0000 (18:13 +0000)
committerbrolley <brolley>
Wed, 16 Apr 2003 18:13:51 +0000 (18:13 +0000)
        * common-xml/interface.xml: Document trace-count? and
        final-insn-count?.
        * CGEN.sh.in: Implement generation of model.cxx and model.h
        * cgen-model.h: New file.

sid/component/cgen-cpu/CGEN.sh.in
sid/component/cgen-cpu/ChangeLog
sid/component/cgen-cpu/cgen-model.h [new file with mode: 0644]

index 1d0e70a..b7553bf 100644 (file)
@@ -13,6 +13,8 @@
 #      defs.h             - generate defs.h file (cpu-family specific decls)
 #      decode.h           - generate decoder header file
 #      decode.cxx         - generate decoder
+#      model.h            - generate model header file
+#      model.cxx          - generate model
 #      semantics.cxx      - generate semantics
 #      sem-switch.cxx     - generate semantics, pbb switch version
 #
@@ -83,6 +85,8 @@ do
     defs.h) fileopts="$fileopts -E tmp-defs-$$.h1" ;;
     decode.h) fileopts="$fileopts -T tmp-dec-$$.h1" ;;
     decode.cxx) fileopts="$fileopts -D tmp-dec-$$.cxx1" ;;
+    model.h) fileopts="$fileopts -N tmp-mod-$$.h1" ;;
+    model.cxx) fileopts="$fileopts -M tmp-mod-$$.cxx1" ;;
     semantics.cxx) fileopts="$fileopts -S tmp-sem-$$.cxx1" ;;
     sem-switch.cxx) fileopts="$fileopts -X tmp-semsw-$$.cxx1" ;;
     write.cxx) fileopts="$fileopts -W tmp-write-$$.cxx1" ;;
@@ -141,6 +145,20 @@ do
            < tmp-dec-$$.cxx1 > tmp-dec-$$.cxx
        ${rootdir}/move-if-change tmp-dec-$$.cxx ${srcdir}/${fileprefix}decode.cxx
        ;;
+    model.h)
+       sed -e "s=@ARCH@=${ARCH}=g" -e "s=@arch@=${arch}=g" \
+           -e "s=@CPU@=${CPU}=g" -e "s=@cpu@=${cpu}=g" \
+           -e "s=@PREFIX@=${PREFIX}=g" -e "s=@"prefix"@=${prefix}=g" \
+           < tmp-mod-$$.h1 > tmp-mod-$$.h
+       ${rootdir}/move-if-change tmp-mod-$$.h ${srcdir}/${fileprefix}model.h
+       ;;
+    model.cxx)
+       sed -e "s=@ARCH@=${ARCH}=g" -e "s=@arch@=${arch}=g" \
+           -e "s=@CPU@=${CPU}=g" -e "s=@cpu@=${cpu}=g" \
+           -e "s=@PREFIX@=${PREFIX}=g" -e "s=@"prefix"@=${prefix}=g" \
+           < tmp-mod-$$.cxx1 > tmp-mod-$$.cxx
+       ${rootdir}/move-if-change tmp-mod-$$.cxx ${srcdir}/${fileprefix}model.cxx
+       ;;
     semantics.cxx)
        sed -e "s=@ARCH@=${ARCH}=g" -e "s=@arch@=${arch}=g" \
            -e "s=@CPU@=${CPU}=g" -e "s=@cpu@=${cpu}=g" \
@@ -173,5 +191,7 @@ rm -f tmp-semsw-$$.cxx1 tmp-semsw-$$.cxx
 rm -f tmp-write-$$.cxx1 tmp-write-$$.cxx
 rm -f tmp-dec-$$.h1 tmp-dec-$$.h
 rm -f tmp-dec-$$.cxx1 tmp-dec-$$.cxx
+rm -f tmp-mod-$$.h1 tmp-mod-$$.h
+rm -f tmp-mod-$$.cxx1 tmp-mod-$$.cxx
 
 exit 0
index 94edbb6..c8945d4 100644 (file)
@@ -1,3 +1,10 @@
+2003-04-16  Dave Brolley  <brolley@redhat.com>
+
+       * common-xml/interface.xml: Document trace-count? and
+       final-insn-count?.
+       * CGEN.sh.in: Implement generation of model.cxx and model.h
+       * cgen-model.h: New file.
+
 2003-02-06  Frank Ch. Eigler  <fche@redhat.com>
 
        * cgen-engine.h: C++ namespace cleanup.
diff --git a/sid/component/cgen-cpu/cgen-model.h b/sid/component/cgen-cpu/cgen-model.h
new file mode 100644 (file)
index 0000000..b769f62
--- /dev/null
@@ -0,0 +1,39 @@
+// cgen-model.h  -*- C++ -*-
+
+// Copyright (C) 2003 Red Hat.
+// This file is part of SID and is licensed under the GPL.
+// See the file COPYING.SID for conditions for redistribution.
+
+#ifndef CGEN_MODEL_H
+#define CGEN_MODEL_H
+
+#include "cgen-cpu.h"
+
+namespace cgen
+{
+
+class cgen_model
+{
+public:
+  cgen_model (cgen_bi_endian_cpu *c) : cpu (c) {}
+
+  // 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
+
+#endif /* CGEN_MODEL_H */