C-Breeze
C Compiler Infrastructure

[ Project home page]

ipanalysis.h

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

Generated on February 1, 2006
Back to the C-Breeze home page