Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TempStmt.java

00001 package edu.ksu.cis.bandera.bofa;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 1999, 2000, 2001                                    *
00006  * Venkatesh Prasad Ranganath (rvprasad@cis.ksu.edu)                 *
00007  * All rights reserved.                                              *
00008  *                                                                   *
00009  * This work was done as a project in the SAnToS Laboratory,         *
00010  * Department of Computing and Information Sciences, Kansas State    *
00011  * University, USA (http://www.cis.ksu.edu/santos).                  *
00012  * It is understood that any modification not identified as such is  *
00013  * not covered by the preceding statement.                           *
00014  *                                                                   *
00015  * This work is free software; you can redistribute it and/or        *
00016  * modify it under the terms of the GNU Library General Public       *
00017  * License as published by the Free Software Foundation; either      *
00018  * version 2 of the License, or (at your option) any later version.  *
00019  *                                                                   *
00020  * This work is distributed in the hope that it will be useful,      *
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
00023  * Library General Public License for more details.                  *
00024  *                                                                   *
00025  * You should have received a copy of the GNU Library General Public *
00026  * License along with this toolkit; if not, write to the             *
00027  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,      *
00028  * Boston, MA  02111-1307, USA.                                      *
00029  *                                                                   *
00030  * Java is a trademark of Sun Microsystems, Inc.                     *
00031  *                                                                   *
00032  * To submit a bug report, send a comment, or get the latest news on *
00033  * this project and other SAnToS projects, please visit the web-site *
00034  *                http://www.cis.ksu.edu/santos                      *
00035  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00036 
00037 import ca.mcgill.sable.soot.*;
00038 import ca.mcgill.sable.soot.jimple.*;
00039 import ca.mcgill.sable.util.*;
00040 import edu.ksu.cis.bandera.jjjc.CompilationManager;
00041 import java.io.PrintWriter;
00042 import org.apache.log4j.Category;
00043 
00044 /**
00045  * A jimple statement walker.
00046  *
00047  * @author 
00048  * <a href="http://www.cis.ksu.edu/~rvprasad">Venkatesh Prasad Ranganath</a>
00049  * @version $Name:  $($Revision: 1.1.1.1 $)
00050  */
00051 class TempStmt extends AbstractStmtSwitch
00052 {
00053     /**
00054      * Method enclosing the statement being walked.
00055      *
00056      */
00057     private SootMethod sm;
00058 
00059     /**
00060      * Statement graph of the given statement list.
00061      *
00062      */
00063     private BriefStmtGraph bsg;
00064 
00065     /**
00066      * The expression walker.
00067      *
00068      */
00069     private TempExpr expr;
00070 
00071     /**
00072      * Provides logging facility through log4j.
00073      *
00074      */
00075     private Category cat;
00076 
00077     /**
00078      * Creates a new <code>TempStmt</code> instance.
00079      *
00080      * @param expr the expression walker.
00081      */
00082     TempStmt(TempExpr expr)
00083     {
00084         this.expr = expr;
00085         cat = Category.getInstance("edu.ksu.cis.bandera.bofa.TempStmt");
00086     }
00087     /**
00088      * Triggers the walk.
00089      *
00090      * @param v the statement to be walked.
00091      */
00092     void build(Stmt v)
00093     {
00094         v.apply(this);
00095     }
00096     /**
00097      * Handles the case when <code>caseAssignStmt</code>s are encountered.
00098      *
00099      * @param v object representing an assignment statement in Jimple.
00100      */
00101     public void caseAssignStmt(AssignStmt v)
00102     {
00103         cat.debug("Assignment: " + v + " | Class of LHS: " +
00104                   v.getLeftOp().getClass());
00105         expr.build(v.getLeftOp());
00106         expr.build(v.getRightOp());
00107         cat.debug("Leaving AssignStmt");
00108     }
00109     /**
00110      * Handles the case when <code>caseGotoStmt</code>s are encountered.
00111      *
00112      * @param v object representing a goto statement in Jimple.
00113      */
00114     public void caseGotoStmt(GotoStmt v)
00115     {
00116     }
00117     /**
00118      * Handles the case when <code>caseIdentityStmt</code>s are encountered.
00119      *
00120      * @param v object representing an identity statement in Jimple.
00121      */
00122     public void caseIdentityStmt(IdentityStmt v)
00123     {
00124         cat.debug("IdentityStmt: " + v);
00125         expr.build(v.getLeftOp());
00126         expr.build(v.getRightOp());
00127         cat.debug("Leaving IdentityStmt");
00128     }
00129     /**
00130      * Handles the case when <code>caseIfStmt</code>s are encountered.
00131      *
00132      * @param v object representing an if statement in Jimple.
00133      */
00134     public void caseIfStmt(IfStmt v)
00135     {
00136         cat.debug("IfStmt: " + v);
00137         expr.build(v.getCondition());
00138         cat.debug("Leaving IfStmt");
00139     }
00140     /**
00141      * Handles the case when <code>caseInvokeStmt</code>s are encountered.
00142      *
00143      * @param v object representing a case statement in Jimple.
00144      */
00145     public void caseInvokeStmt(InvokeStmt v)
00146     {
00147         cat.debug("InvokeStmt: " + v);
00148         expr.build(v.getInvokeExpr());
00149         cat.debug("Leaving InvokeStmt");
00150 
00151     }
00152     /**
00153      * Handles the case when <code>caseLookupSwitchStmt</code>s are encountered.
00154      *
00155      * @param v object representing a lookup switch statement in Jimple.
00156      */
00157     public void caseLookupSwitchStmt(LookupSwitchStmt v)
00158     {
00159     }
00160     /**
00161      * Handles the case when <code>caseReturnStmt</code>s are encountered.
00162      *
00163      * @param v object representing a return statement in Jimple.
00164      */
00165     public void caseReturnStmt(ReturnStmt v)
00166     {
00167         cat.debug("ReturnStmt: " + v);
00168         expr.build(v.getReturnValue());
00169         cat.debug("Leaving ReturnStmt");
00170     }
00171     /**
00172      * Handles the case when <code>caseTableSwitchStmt</code>s are encountered.
00173      *
00174      * @param v object representing a tabled switch statement in Jimple.
00175      */
00176     public void caseTableSwitchStmt(TableSwitchStmt v)
00177     {
00178     }
00179     /**
00180      * Handles statements which we do not intend to handle at this time.
00181      *
00182      * @param obj object representing entities we donot handle.
00183      */
00184     public void defaultCase(Object obj)
00185     {
00186     }
00187     /**
00188      * Initializes the object with a method and the statement list in the method
00189      * in which the statements that will be analyzed are present.
00190      *
00191      * @param sm the method enclosing the statements to be analyzed.
00192      * @param stmts the list of statements in the enclosing method.
00193      */
00194     void init(SootMethod sm, StmtList stmts)
00195     {
00196         this.sm = sm;
00197         this.bsg = new BriefStmtGraph(stmts);
00198         cat.debug("Reached: " + sm);
00199     }
00200 }

Generated at Thu Feb 7 06:56:42 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001