|
||
inliner.hGo to the documentation of this file.00001 // $Id: inliner.h,v 1.7 2003/08/07 23:13:48 pnav Exp $ 00002 // ---------------------------------------------------------------------- 00003 // 00004 // C-Breeze 00005 // C Compiler Framework 00006 // 00007 // Copyright (c) 2003 University of Texas at Austin 00008 // 00009 // Samuel Z. Guyer 00010 // Adam Brown 00011 // Teck Bok Tok 00012 // Paul Arthur Navratil 00013 // Calvin Lin 00014 // 00015 // Permission is hereby granted, free of charge, to any person 00016 // obtaining a copy of this software and associated documentation 00017 // files (the "Software"), to deal in the Software without 00018 // restriction, including without limitation the rights to use, copy, 00019 // modify, merge, publish, distribute, sublicense, and/or sell copies 00020 // of the Software, and to permit persons to whom the Software is 00021 // furnished to do so, subject to the following conditions: 00022 // 00023 // The above copyright notice and this permission notice shall be 00024 // included in all copies or substantial portions of the Software. 00025 // 00026 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00027 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00028 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00029 // NONINFRINGEMENT. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT 00030 // AUSTIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 00031 // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 00032 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00033 // THE SOFTWARE. 00034 // 00035 // We acknowledge the C-to-C Translator from MIT Laboratory for 00036 // Computer Science for inspiring parts of the C-Breeze design. 00037 // 00038 // ---------------------------------------------------------------------- 00039 #ifndef CBZ_INLINE_H 00040 #define CBZ_INLINE_H 00041 00042 #include <c_breeze.h> 00043 #include <ref_clone_changer.h> 00044 #include <dismantle.h> 00045 #include <linker.h> 00046 #include <cfg.h> 00047 #include <callgraph.h> 00048 #include <deque> 00049 00050 00051 using namespace std; 00052 typedef set<procNode *>::iterator proc_set_p; 00053 00054 procNode * findmain(); 00055 00072 class function_inline:public Changer 00073 { 00074 public: 00075 /* This constructor is really meant for internal use only. 00076 * To inline functions, please uses inline_functions. 00077 */ 00078 function_inline(set<threeAddrNode *> & m, 00079 map<declNode *, procNode *> & m2, 00080 set<procNode *> & s1, set<procNode*> & s2): 00081 Changer(Both, Subtree, false), 00082 _callinline(m), 00083 _procmap(m2), 00084 _procs(s1), 00085 _inlined(s2) {}; 00086 00091 static void inline_functions(procNode * root); 00092 00094 virtual Node * at_threeAddr(threeAddrNode * ta, Order ord); 00095 00099 virtual Node * at_proc(procNode * p, Order ord); 00100 void insert_proc(procNode * m); 00101 void process(callGraph & cg); 00102 00103 00104 00105 private: 00106 set<threeAddrNode *> & _callinline; 00107 map<declNode *, procNode *> & _procmap; 00108 set<procNode*> & _procs; 00109 set<procNode*> & _inlined; 00110 bool already_inlined_calls(callGraphNode *); 00111 deque<procNode*> _callstack; 00112 deque<procNode*> _localcallstack; 00113 bool inlocalstack(procNode * p); 00114 stmtNode * inliner(idNode * call, procNode * p, 00115 threeAddrNode * callsite); 00116 00117 00118 }; 00119 00120 class fi: public Phase 00121 { 00122 public: 00123 void run(); 00124 }; 00125 00126 #endif |
Generated on August 27, 2003
Back to the C-Breeze home page