C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ipanalysis.h

Go to the documentation of this file.
00001 // $Id: ipanalysis.h,v 1.20 2003/08/08 15:16:29 toktb 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 &result) {}
00203 
00204   // -- Memory allocation and deallocation
00205 
00206   virtual void at_allocation(stmtLocation * stmt,
00207                              pointervalue_list & arguments,
00208                              memoryBlock * block,
00209                              memoryblock_set & changes)
00210   {}
00211 
00212   virtual void at_deallocation(stmtLocation * stmt,
00213                                pointerValue & to_deallocate,
00214                                memoryblock_set & changes)
00215   {}
00216 
00217   // -- Process a merge point
00218 
00219   virtual void at_merge(Location * where,
00220                         memoryBlock * block,
00221                         memoryuse_list & phi_uses,
00222                         pointerValue & result,
00223                         memoryblock_set & changes)
00224   {}
00225 
00226   // -- Control-flow options
00227 
00228   virtual void at_basicblock_entry(basicblockLocation * block,
00229                                    procedureInfo * info,
00230                                    pointerValue & initial)
00231   {}
00232 
00233   virtual void at_stmt_entry(stmtLocation * stmt,
00234                              pointerValue & result)
00235   {}
00236 
00237   virtual void at_stmt_exit(stmtLocation * stmt,
00238                             pointerValue & result)
00239   {}
00240 
00241   virtual void at_basicblock_exit(basicblockLocation * block,
00242                                   procedureInfo * info,
00243                                   pointerValue & final)
00244   {}
00245 
00246   // -- Procedure boundaries
00247 
00248   virtual void at_conservative_procedure_call(stmtLocation * current,
00249                                               operandNode * call,
00250                                               operand_list & args,
00251                                               pointerValue & call_target,
00252                                               pointervalue_list & arguments,
00253                                               memoryblock_set & reachable_blocks,
00254                                               pointerValue & return_val,
00255                                               memoryblock_set & changes)
00256   {}
00257 
00258   virtual void at_procedure_entry(procLocation * proc,
00259                                   procedureInfo * info,
00260                                   pointerValue & return_val)
00261   {}
00262 
00263   virtual void at_procedure_exit(procLocation * proc,
00264                                  procedureInfo * info,
00265                                  pointerValue & return_val)
00266   {}
00268 
00272   // TB_unify
00273   virtual bool compare_property_value(Location *where,
00274                                       memoryBlock *property_block,
00275                                       procedureInfo *callee) { return true; }
00276 
00279   // TB_unify
00280   virtual void record_input_to_value(procedureInfo *callee,
00281                                      memoryBlock *property_block,
00282                                      Location *where) {}
00283 
00284 };
00285 
00286 #endif // CBZ_IPANALYSIS_H
00287 

Generated on August 27, 2003
Back to the C-Breeze home page