don't emit vfp copies
[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 name of a debug action. */
40   public static native String dbgActionToString (int action);
41
42   /** Return the dbg object of the given node, or <TT>null</TT> if none has been set. */
43   public static Dbginfo getDbgInfo (int node)
44   {
45     int idx = doGetDbgInfoIdx (node);
46
47     if (-1 == idx) {
48       return (null);
49     }
50
51     return (_infos [idx]);
52   }
53
54   public static void setDbgInfo (int node, java.lang.Object file, int line)
55   {
56     int idx = doGetDbgInfoIdx (node);
57
58     if (_infos.length < idx) {
59       Dbginfo [] infos = new Dbginfo [idx+1];
60
61       for (int i = 0; i < _infos.length; i ++) {
62         infos [i] = _infos [i];
63       }
64
65       _infos = infos;
66     }
67
68     _infos [idx] = new Dbginfo (file, line);
69   }
70
71   public static void myJavaDbgInfoMergePair(int new_node, int old_node, int action) {
72     System.out.println("Optimization: "+ dbgActionToString(action));
73     System.out.println("new Node " + Irnode.getIrnNodeNr(new_node));
74     System.out.println("old Node " + Irnode.getIrnNodeNr(old_node));
75   }
76
77   public static void myJavaDbgInfoMergeSets(int new_nodes[], int old_nodes[], int action) {
78     System.out.println("Optimization: "+ dbgActionToString(action));
79     System.out.print("new Nodes: ");
80     for (int i = 0; i < new_nodes.length; i++)
81       System.out.print(Irnode.getIrnNodeNr(new_nodes[i]) + ", ");
82     System.out.print("\nold Nodes: ");
83     for (int i = 0; i < old_nodes.length; i++)
84       System.out.print(Irnode.getIrnNodeNr(old_nodes[i]) + ", ");
85     System.out.println("");
86   }
87
88   /**
89      <P>Return the file this debug info object is from:</P>
90   */
91   public java.lang.Object getFile ()
92   {
93     return (_file);
94   }
95
96   /**
97      <P>Return which line this debug info object is from:</P>
98   */
99   public int getLine ()
100   {
101     return (_line);
102   }
103
104   private java.lang.Object _file;
105   private int _line;
106
107   private static Dbginfo [] _infos = new Dbginfo [1000];
108 }