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  

reaching.h

Go to the documentation of this file.
00001 // $Id: reaching.h,v 1.8 2003/08/08 17:51:55 toktb Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 //  C-Breeze
00005 //  C Compiler Framework
00006 // 
00007 //  Copyright (c) 2000 University of Texas at Austin
00008 // 
00009 //  Teck Bok Tok
00010 //  Samuel Z. Guyer
00011 //  Daniel A. Jimenez
00012 //  Calvin Lin
00013 // 
00014 //  Permission is hereby granted, free of charge, to any person
00015 //  obtaining a copy of this software and associated documentation
00016 //  files (the "Software"), to deal in the Software without
00017 //  restriction, including without limitation the rights to use, copy,
00018 //  modify, merge, publish, distribute, sublicense, and/or sell copies
00019 //  of the Software, and to permit persons to whom the Software is
00020 //  furnished to do so, subject to the following conditions:
00021 //  
00022 //  The above copyright notice and this permission notice shall be
00023 //  included in all copies or substantial portions of the Software.
00024 //  
00025 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00026 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00027 //  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00028 //  NONINFRINGEMENT.  IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT
00029 //  AUSTIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
00030 //  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
00031 //  OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00032 //  THE SOFTWARE.
00033 //
00034 //  We acknowledge the C-to-C Translator from MIT Laboratory for
00035 //  Computer Science for inspiring parts of the C-Breeze design.
00036 //
00037 // ----------------------------------------------------------------------
00038 
00039 #ifndef CBZ_REACHING_3ADDR_H
00040 #define CBZ_REACHING_3ADDR_H
00041 
00042 #include "udduChains.h"
00043 
00044 
00060 class reachingDefinitionsWalker : public Walker {
00061 public:
00062   typedef list<threeAddrNode*> threeAddr_list;
00063 
00065   static udduChains * analyze_all() {
00066     reachingDefinitionsWalker r;
00067     for(unit_list_p u=CBZ::Program.begin(); u!=CBZ::Program.end(); u++)
00068       (*u)->walk(r);
00069     return r.udChain;
00070   }
00071 
00073   static udduChains * analyze(unitNode *unit) {
00074     reachingDefinitionsWalker r;
00075     unit->walk(r);
00076     return r.udChain;
00077   }
00078 
00080   static udduChains * analyze(procNode *proc) {
00081     reachingDefinitionsWalker r;
00082     proc->walk(r);
00083     return r.udChain;
00084   }
00085 
00086 private:
00089   class defFlowVal;
00090 
00093   class reachingGenKillWalker;
00094 
00095   reachingDefinitionsWalker (void) : Walker (Both, Subtree)
00096     { udChain = new udduChains(); }
00097 
00098   void at_proc (procNode *, Order);
00099   void at_basicblock (basicblockNode *, Order);
00100 
00102   void make_ud_chains (exprNode *e, exprNode *E=NULL, stmtNode * s = NULL);
00103 
00105   void make_ud_chains (stmtNode *);
00106 
00108   map <stmtNode *, defFlowVal *> gen, kill, in, out;
00109 
00112   threeAddrNode **num2node;
00113 
00115   int  n;
00116 
00118   defFlowVal *current_in;
00119 
00121   map <threeAddrNode *, int> node2num;  
00122 
00124   map <threeAddrNode *, declNode *> defines;
00125 
00128   map <declNode *, defFlowVal *> defs;
00129 
00131   stmt_list dummies;
00132 
00134   udduChains *udChain;
00135 };
00136 
00137 #endif

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