Added FuncCall Node, a call to a procedure that did NOT change the memory
[libfirm] / firmjni / testprograms / IfElseExample.java
index c20498d..0f9f438 100644 (file)
@@ -1,10 +1,14 @@
-/* Copyright (C) 2003 by Universitaet Karlsruhe
-* All rights reserved.
-*
-* Authors: Goetz Lindenmaier
-*
-* testprogram for Java native interface
-*/
+/*
+ * Project:     libFIRM
+ * File name:   firmjni/testprograms/IfElseExample.java
+ * Purpose:     This is an example of how to use the JNI interface of Firm.
+ * Author:      Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID:      $Id$
+ * Copyright:   (c) 2002 Universitaet Karlsruhe
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ */
 
 import firmjni.*;
 
@@ -29,8 +33,9 @@ class IfElseExample {
 
        System.out.println("\nCreating an IR graph: IfElseExample...");
 
-  /* init library: Java did not support the callback, so ALWAYS use 0 here */
-       Firm.initFirm();
+       /* init library */
+       Firm.initFirm(0);
+       Dbginfo.dbgInit();
 
        /** Build type information for the compilation unit. **/
 
@@ -60,8 +65,8 @@ class IfElseExample {
        int irg = Irgraph.newIrGraph (ent, 2);
 
        /* Generate two constants */
-       int c0 = Ircons.newConst (Irmode.getModeIs(), Tv.tarvalFromLong (Irmode.getModeIs(), 0));
-       int c1 = Ircons.newConst (Irmode.getModeIs(), Tv.tarvalFromLong (Irmode.getModeIs(), 1));
+       int c0 = Ircons.newConst (Irmode.getModeIs(), Tv.newTarvalFromLong (0, Irmode.getModeIs()));
+       int c1 = Ircons.newConst (Irmode.getModeIs(), Tv.newTarvalFromLong (1, Irmode.getModeIs()));
 
        /* Set a and b to constants */
        Ircons.setValue (0, c0);  /* this (0) is variable a */
@@ -69,7 +74,7 @@ class IfElseExample {
 
        /* The expression that evaluates the condition */
        int c2 = Ircons.newConst(Irmode.getModeIs(),
-                                Tv.tarvalFromLong (Irmode.getModeIs(), 2));
+                                Tv.newTarvalFromLong (2, Irmode.getModeIs()));
        int cmpGt = Ircons.newProj(Ircons.newCmp(Ircons.getValue(0, Irmode.getModeIs()), c2),
                                   Irmode.getModeb(), Irnode.Gt);
        int x = Ircons.newCond (cmpGt);
@@ -89,7 +94,7 @@ class IfElseExample {
        b = Ircons.newImmBlock ();
        Ircons.addInEdge (b, f);
        Ircons.setValue (1, Ircons.newConst (Irmode.getModeIs(),
-                                            Tv.tarvalFromLong (Irmode.getModeIs(), 2)));
+                                            Tv.newTarvalFromLong (2, Irmode.getModeIs())));
        Ircons.matureBlock (b);
        int x_else = Ircons.newJmp ();