changed irdump flag
[libfirm] / firmjni / auxilliary / Dbginfo.java
1 package firmjni;
2
3 /*
4  * Project:     libFIRM / Recoder frontend for libFIRM.
5  * File name:   firmjni/Dbginfo.java
6  * Purpose:
7  * Author:      Goetz Lindenmaier
8  * Modified by:
9  * Created:     26.2.2003
10  * CVS-ID:      $Id$
11  * Copyright:   (c) 2003 Universitaet Karlsruhe
12  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
13  */
14
15 import firmjni.*;
16
17 public class Dbginfo {
18
19   public Dbginfo (java.lang.Object file, int line)
20   {
21     _file = file;
22     _line = line;
23   }
24
25   // Set env var LD_LIBRARY_PATH accordingly.
26   static {
27     System.loadLibrary("firmjni");
28     dbgInit ();
29   }
30
31   public static native void dbgInit ();
32
33   /** Return the dbg object index of the given node. A new dbg object is created, if needed. */
34   public static native int getDbgInfoIdx (int node);
35
36   /** Return the dbg object index of the given node, or <TT>-1</TT> if none has been set. */
37   public static native int doGetDbgInfoIdx (int node);
38
39   /** Return the dbg object of the given node, or <TT>null</TT> if none has been set. */
40   public static Dbginfo getDbgInfo (int node)
41   {
42     int idx = doGetDbgInfoIdx (node);
43
44     if (-1 == idx) {
45       return (null);
46     }
47
48     return (_infos [idx]);
49   }
50
51   public static void setDbgInfo (int node, java.lang.Object file, int line)
52   {
53     int idx = doGetDbgInfoIdx (node);
54
55     if (_infos.length < idx) {
56       Dbginfo [] infos = new Dbginfo [idx+1];
57
58       for (int i = 0; i < _infos.length; i ++) {
59         infos [i] = _infos [i];
60       }
61
62       _infos = infos;
63     }
64
65     _infos [idx] = new Dbginfo (file, line);
66   }
67
68   public static void myJavaDbgInfoMergePair(int new_node, int old_node, int info) {
69     System.out.println("Optimization: "+ info);
70     System.out.println("new Node " + Irnode.getIrnNodeNr(new_node));
71     System.out.println("old Node " + Irnode.getIrnNodeNr(old_node));
72   }
73
74   public static void myJavaDbgInfoMergeSets(int new_nodes[], int old_nodes[], int info) {
75     System.out.println("Optimization: "+ info);
76     System.out.print("new Nodes: ");
77     for (int i = 0; i < new_nodes.length; i++)
78       System.out.print(Irnode.getIrnNodeNr(new_nodes[i]) + ", ");
79     System.out.print("\nold Nodes: ");
80     for (int i = 0; i < old_nodes.length; i++)
81       System.out.print(Irnode.getIrnNodeNr(old_nodes[i]) + ", ");
82     System.out.println("");
83   }
84
85   /**
86      <P>Return the file this debug info object is from:</P>
87   */
88   public java.lang.Object getFile ()
89   {
90     return (_file);
91   }
92
93   /**
94      <P>Return which line this debug info object is from:</P>
95   */
96   public int getLine ()
97   {
98     return (_line);
99   }
100
101   private java.lang.Object _file;
102   private int _line;
103
104   private static Dbginfo [] _infos = new Dbginfo [1000];
105 }