X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=firmjni%2Ftestprograms%2FEmpty.java;h=21bfea46cd68d0a22b90be0515653d2bb213c99b;hb=aec57cde3d3019019f9e8d1fe1292fecf82abbde;hp=a3a1474b512b3368ba340fdfc99ce274f2610a2f;hpb=099b1d513c106077593d0a7e8197d5adb2e61a8e;p=libfirm diff --git a/firmjni/testprograms/Empty.java b/firmjni/testprograms/Empty.java index a3a1474b5..21bfea46c 100644 --- a/firmjni/testprograms/Empty.java +++ b/firmjni/testprograms/Empty.java @@ -1,15 +1,16 @@ -import firmjni.*; +/* + * Project: libFIRM + * File name: firmjni/testprograms/Empty.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. + */ -/* Copyright (C) 2002 by Universitaet Karlsruhe -** All rights reserved. -** -** Author: Goetz Lindenmaier -** -** $id$ -** -** This is an example of how to use the JNI interface of Firm. -** -*/ +import firmjni.*; /** *** An empty Firm program. @@ -27,8 +28,8 @@ class Empty { System.out.println("\nCreating an IR graph: EMPTY..."); - /* init library */ - Firm.initFirm(); + /* init library: Java did not support the callback, so ALWAYS use 0 here */ + Firm.initFirm(0); /** Build type information for the procedure. **/ @@ -39,7 +40,7 @@ class Empty { int owner = Irprog.getGlobType(); /* The type of the method */ - int name = Ident.idFromStr("main", 4); + int name = Ident.newIdFromStr("EMPTY_main"); int proc_main = Type.newTypeMethod(name, 0, 0); /* An entity representing the method. Owner of the entity is the global class type mentioned above. */ @@ -64,21 +65,21 @@ class Empty { /* Now we generated all instructions for this block and all its predecessor * blocks so we can mature it. (There are not too much.) */ - Ircons.matureBlock (Irgraph.getIrgCurrentBlock(irg)); + Ircons.matureImmBlock (Irgraph.getIrgCurrentBlock(irg)); /* This adds the in edge of the end block which originates at the return statement. * The return node passes controlflow to the end block. */ - Ircons.addInEdge (Irgraph.getIrgEndBlock(irg), x); + Ircons.addImmBlockPred (Irgraph.getIrgEndBlock(irg), x); /* Now we can mature the end block as all it's predecessors are known. */ - Ircons.matureBlock (Irgraph.getIrgEndBlock(irg)); + Ircons.matureImmBlock (Irgraph.getIrgEndBlock(irg)); /* Verify the graph. Finds some very bad errors in the graph. */ - Irvrfy.irgVrfy(irg); - Ircons.finalizeCons (irg); + Irvrfy.irgVerify(irg, Irvrfy.VRFY_NORMAL); + Irgraph.setIrgPhaseState (irg, Irgraph.phase_high); System.out.println("Done building the graph. Dumping it."); - Irdump.dumpIrBlockGraph (irg); - Irdump.dumpAllTypes(); + Irdump.dumpIrBlockGraph (irg, ""); + Irdump.dumpAllTypes(""); System.out.println("use xvcg to view this graph:");