-/* 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.*;
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. **/
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 */
/* 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);
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 ();