Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ipanalysis.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------
00002 //
00003 //  C-Breeze
00004 //  C Compiler Framework
00005 // 
00006 //  Copyright (c) 2000 University of Texas at Austin
00007 // 
00008 //  Samuel Z. Guyer
00009 //  Daniel A. Jimenez
00010 //  Calvin Lin
00011 // 
00012 //  Permission is hereby granted, free of charge, to any person
00013 //  obtaining a copy of this software and associated documentation
00014 //  files (the "Software"), to deal in the Software without
00015 //  restriction, including without limitation the rights to use, copy,
00016 //  modify, merge, publish, distribute, sublicense, and/or sell copies
00017 //  of the Software, and to permit persons to whom the Software is
00018 //  furnished to do so, subject to the following conditions:
00019 //  
00020 //  The above copyright notice and this permission notice shall be
00021 //  included in all copies or substantial portions of the Software.
00022 //  
00023 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00024 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00025 //  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00026 //  NONINFRINGEMENT.  IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT
00027 //  AUSTIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
00028 //  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
00029 //  OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00030 //  THE SOFTWARE.
00031 //
00032 //  We acknowledge the C-to-C Translator from MIT Laboratory for
00033 //  Computer Science for inspiring parts of the C-Breeze design.
00034 //
00035 // ----------------------------------------------------------------------
00036 
00037 #ifndef CBZ_IPANALYSIS_H
00038 #define CBZ_IPANALYSIS_H
00039 
00040 #include "pointers_common.h"
00041 #include "proceduredb.h"
00042 
00043 class analysisVal
00044 {
00045 public:
00046   virtual ~analysisVal() {}
00047   virtual analysisVal * clone() const =0;
00048 //  virtual analysisVal * clone() const = 0;
00049 };
00050 
00051 
00052 class pointerValue;
00053 
00054 typedef list< pointerValue > pointervalue_list;
00055 // typedef pointervalue_list::iterator pointervalue_list_p;
00056 
00057 
00058 
00059 class analysisProblem
00060 {
00061 protected:
00062 
00063   Direction _direction;
00064 
00065 public:
00066 
00071   analysisProblem(Direction direction)
00072     : _direction(direction)
00073   {}
00074 
00077   Direction direction() const { return _direction; }
00078 
00083   virtual string name() =0;
00084 
00092 
00093   // -- Non-pointer expressions
00094 
00095   virtual void at_id(stmtLocation * current, idNode * id,
00096                      pointerValue & result,
00097                      bool result_is_a_use)
00098   {}
00099 
00100   virtual void at_unary(stmtLocation * current,
00101                         unaryNode * unary,
00102                         pointerValue & operand,
00103                         pointerValue & result,
00104                         bool result_is_a_use)
00105   {}
00106 
00107   virtual void at_binary(stmtLocation * current,
00108                          binaryNode * binary,
00109                          pointerValue & left,
00110                          pointerValue & right,
00111                          pointerValue & result,
00112                          bool result_is_a_use)
00113   {}
00114 
00115   virtual void at_cast(stmtLocation * current, castNode * cast,
00116                        pointerValue & operand,
00117                        pointerValue & result,
00118                        bool result_is_a_use)
00119   {}
00120 
00121   virtual void at_const(stmtLocation * current, constNode * cons,
00122                         pointerValue & result,
00123                         bool result_is_a_use)
00124   {}
00125 
00126   // -- Procedure calls
00127 
00128   virtual void at_call(stmtLocation * current, callNode * call,
00129                        pointerValue & call_target,
00130                        procNode * callee,
00131                        pointervalue_list & arguments,
00132                        pointerValue & return_val)
00133   {}
00134 
00135   // -- Pointer expressions
00136 
00137   virtual void at_field_access(stmtLocation * current,
00138                                binaryNode * binary,
00139                                pointerValue & operand,
00140                                idNode * field,
00141                                pointerValue & result,
00142                                bool result_is_a_use)
00143   {}
00144 
00145   virtual void at_dereference(stmtLocation * current,
00146                               unaryNode * unary,
00147                               pointerValue & operand,
00148                               pointerValue & result,
00149                               bool result_is_a_use)
00150   {}
00151 
00152   virtual void at_address(stmtLocation * current,
00153                           unaryNode * unary,
00154                           pointerValue & operand,
00155                           pointerValue & result,
00156                           bool result_is_a_use)
00157   {}
00158 
00159   virtual void at_index(stmtLocation * current,
00160                         binaryNode * binary,
00161                         pointerValue & left,
00162                         pointerValue & right,
00163                         pointerValue & result,
00164                         bool result_is_a_use)
00165   {}
00166 
00167   // -- Assignments
00168 
00169   virtual void at_assignment(stmtLocation * current,
00170                              binaryNode * binary,
00171                              pointerValue & left,
00172                              pointerValue & right,
00173                              pointerValue & result,
00174                              bool result_is_a_use,
00175                              memoryblock_set & changes)
00176   {}
00177 
00178   virtual void at_parameter_pass(Location * current,
00179                                  pointerValue & left,
00180                                  pointerValue & right,
00181                                  pointerValue & result,
00182                                  memoryblock_set & changes)
00183   {}
00184 
00185   // -- Statement types
00186 
00187   virtual void at_return(stmtLocation * stmt,
00188                          returnNode * ret,
00189                          pointerValue & result,
00190                          pointerValue & return_val)
00191   {}
00192 
00193   virtual void at_exprstmt(stmtLocation * stmt,
00194                            exprstmtNode * es,
00195                            pointerValue & result)
00196   {}
00197 
00198   virtual void at_if(stmtLocation * stmt,
00199                      ifNode * ifnode,
00200                      pointerValue & result)
00201   {}
00202 
00203   // -- Process a merge point
00204 
00205   virtual void at_merge(basicblockLocation * where,
00206                         memoryBlock * block,
00207                         memoryuse_list & phi_uses,
00208                         pointerValue & result,
00209                         memoryblock_set & changes)
00210   {}
00211 
00212   // -- Control-flow options
00213 
00214   virtual void at_basicblock_entry(basicblockLocation * block,
00215                                    procedureInfo * info,
00216                                    pointerValue & initial)
00217   {}
00218 
00219   virtual void at_stmt_entry(stmtLocation * stmt,
00220                              pointerValue & result)
00221   {}
00222 
00223   virtual void at_stmt_exit(stmtLocation * stmt,
00224                             pointerValue & result)
00225   {}
00226 
00227   virtual void at_basicblock_exit(basicblockLocation * block,
00228                                   procedureInfo * info,
00229                                   pointerValue & final)
00230   {}
00231 
00232   // -- Procedure boundaries
00233 
00234   virtual void at_conservative_procedure_call(stmtLocation * current,
00235                                               callNode * call,
00236                                               pointerValue & call_target,
00237                                               pointervalue_list & arguments,
00238                                               memoryblock_set & reachable_blocks,
00239                                               pointerValue & return_val,
00240                                               memoryblock_set & changes)
00241   {}
00242 
00243   virtual void at_procedure_entry(procLocation * proc,
00244                                   procedureInfo * info,
00245                                   pointerValue & return_val)
00246   {}
00247 
00248   virtual void at_procedure_exit(procLocation * proc,
00249                                  procedureInfo * info,
00250                                  pointerValue & return_val)
00251   {}
00252 
00253 
00255 };
00256 
00257 #endif // CBZ_IPANALYSIS_H
00258 

Generated on Thu Jan 10 12:06:19 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001