Inferno
0.2
|
00001 #ifndef TO_SC_METHOD_HPP 00002 #define TO_SC_METHOD_HPP 00003 00004 #include "sr/search_replace.hpp" 00005 00006 /// Steps namespace contains all of inferno's transformation steps. 00007 namespace Steps { 00008 00009 /** Move automatic variables out to class scope as fields, but only 00010 when the compound block they are declared in does not make outgoing 00011 calls which could lead to recursion. */ 00012 class AutosToModule : public SearchReplace 00013 { 00014 public: 00015 AutosToModule(); 00016 }; 00017 00018 /** Move temp and static variables found in funcitons out into the enclosing class */ 00019 class TempsAndStaticsToModule : public SearchReplace 00020 { 00021 public: 00022 TempsAndStaticsToModule(); 00023 }; 00024 00025 /** Move declarations found in funcitons out into the enclosing class */ 00026 class DeclsToModule : public SearchReplace 00027 { 00028 public: 00029 DeclsToModule(); 00030 }; 00031 00032 /** Convertsion from Thread to Method. We require that there are 00033 no local variables in the Thread, and that at it's top level it contains 00034 a do { ... } while(true) loop. We simply lose the loop, rename the 00035 Thread to Module, and rename all WaitX to NextTriggerX. I think it's 00036 also required that every iteration of superloop calls Wait exactly once. */ 00037 class ThreadToMethod : public SearchReplace 00038 { 00039 public: 00040 ThreadToMethod(); 00041 }; 00042 00043 /// Detect return statements and arrange for the function to fall down 00044 /// to the bottom without doing anything more. only for void functions and 00045 /// loops not supported. 00046 class ExplicitiseReturns : public SearchReplace 00047 { 00048 public: 00049 ExplicitiseReturns(); 00050 }; 00051 00052 }; // end namespace 00053 00054 #endif 00055