* Removed all Id tags.
[cacao.git] / src / vm / jit / loop / graph.c
index 15248f5e77b4e13c4b667ca37b18e79e3dff3e68..09cd21d5384dca04ab91ecc15a5570d94a83763d 100644 (file)
@@ -1,9 +1,9 @@
-/* jit/loop/graph.c - control flow graph
+/* src/vm/jit/loop/graph.c - control flow graph
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Christopher Kruegel
 
    Contains the functions which build a list, that represents the
    control flow graph of the procedure, that is being analyzed.
 
-   $Id: graph.c 1454 2004-11-05 14:19:32Z twisti $
-
 */
 
 
-#include <stdio.h>
-#include "jit/jit.h"
-#include "jit/loop/graph.h"
-#include "jit/loop/loop.h"
-#include "toolbox/memory.h"
+#include <assert.h>
+
+#include "mm/memory.h"
+#include "toolbox/logging.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/loop/graph.h"
+#include "vm/jit/loop/loop.h"
 
 
 void LoopContainerInit(methodinfo *m, struct LoopContainer *lc, int i)
@@ -73,10 +73,17 @@ void LoopContainerInit(methodinfo *m, struct LoopContainer *lc, int i)
    variable c_dTable 
 */
 
-void depthFirst(methodinfo *m, loopdata *ld)
+void depthFirst(jitdata *jd)
 {
+       methodinfo *m;
+       loopdata   *ld;
        int i;
 
+       /* get required compiler data */
+
+       m  = jd->m;
+       ld = jd->ld;
+
 /*     allocate memory and init gobal variables needed by function dF(m, int, int)     */
   
        ld->c_defnum = DMNEW(int, m->basicblockcount);
@@ -136,7 +143,8 @@ void dF(methodinfo *m, loopdata *ld, int from, int blockIndex)
 
 #ifdef C_DEBUG
        if (blockIndex > m->basicblockcount) {
-               panic("DepthFirst: BlockIndex exceeded\n");
+               log_text("DepthFirst: BlockIndex exceeded\n");
+               assert(0);
        }               
 #endif
 
@@ -178,6 +186,18 @@ void dF(methodinfo *m, loopdata *ld, int from, int blockIndex)
                        case ICMD_IF_ICMPGE:
                        case ICMD_IF_ICMPGT:
                        case ICMD_IF_ICMPLE:
+                       case ICMD_IF_LEQ:
+                       case ICMD_IF_LNE:
+                       case ICMD_IF_LLT:
+                       case ICMD_IF_LGE:
+                       case ICMD_IF_LGT:
+                       case ICMD_IF_LLE:
+                       case ICMD_IF_LCMPEQ:
+                       case ICMD_IF_LCMPNE:
+                       case ICMD_IF_LCMPLT:
+                       case ICMD_IF_LCMPGE:
+                       case ICMD_IF_LCMPGT:
+                       case ICMD_IF_LCMPLE:
                        case ICMD_IF_ACMPEQ:
                        case ICMD_IF_ACMPNE:                            /* branch -> check next block   */
                           dF(m, ld, blockIndex, blockIndex + 1);
@@ -282,7 +302,8 @@ void dF_Exception(methodinfo *m, loopdata *ld, int from, int blockIndex)
        
 #ifdef C_DEBUG
        if (blockIndex > m->basicblockcount) {
-               panic("DepthFirst: BlockIndex exceeded");
+               log_text("DepthFirst: BlockIndex exceeded");
+               assert(0);
        }
 #endif
 
@@ -315,8 +336,20 @@ void dF_Exception(methodinfo *m, loopdata *ld, int from, int blockIndex)
                case ICMD_IF_ICMPGE:
                case ICMD_IF_ICMPGT:
                case ICMD_IF_ICMPLE:
+               case ICMD_IF_LEQ:
+               case ICMD_IF_LNE:
+               case ICMD_IF_LLT:
+               case ICMD_IF_LGE:
+               case ICMD_IF_LGT:
+               case ICMD_IF_LLE:
+               case ICMD_IF_LCMPEQ:
+               case ICMD_IF_LCMPNE:
+               case ICMD_IF_LCMPLT:
+               case ICMD_IF_LCMPGE:
+               case ICMD_IF_LCMPGT:
+               case ICMD_IF_LCMPLE:
                case ICMD_IF_ACMPEQ:
-               case ICMD_IF_ACMPNE:
+               case ICMD_IF_ACMPNE:                    /* branch -> check next block   */
                        dF_Exception(m, ld, blockIndex, blockIndex + 1);
                        /* fall throu */
          
@@ -383,10 +416,7 @@ void resultPass1(methodinfo *m)
 {
        int i, j;
        struct depthElement *hp;
-       struct loopdata *l;
 
-       l=m->loopdata;
-       
        printf("\n\n****** PASS 1 ******\n\n");
        printf("Number of Nodes: %d\n\n", ld->c_globalCount);