Inferno
0.2
|
00001 /* 00002 * generate_stacks.hpp 00003 * 00004 * Created on: 27 Oct 2009 00005 * Author: jgraley 00006 */ 00007 00008 #ifndef GENERATE_STACKS_HPP 00009 #define GENERATE_STACKS_HPP 00010 00011 #include "sr/search_replace.hpp" 00012 #include "tree/typeof.hpp" 00013 #include "tree/misc.hpp" 00014 00015 namespace Steps { 00016 00017 /** Ensure an actual return statement is present in void-returning functions */ 00018 class ExplicitiseReturn : public SearchReplace 00019 { 00020 public: 00021 ExplicitiseReturn(); 00022 }; 00023 00024 /** Convey return value through a module-level variable */ 00025 class UseTempForReturnValue : public SearchReplace 00026 { 00027 public: 00028 UseTempForReturnValue(); 00029 }; 00030 00031 /** Pass parameters in to functions via class-level temps */ 00032 class ReturnViaTemp : public SearchReplace 00033 { 00034 public: 00035 ReturnViaTemp(); 00036 }; 00037 00038 /** Add a parameter to non-process functions giving the link address */ 00039 class AddLinkAddress : public SearchReplace 00040 { 00041 public: 00042 AddLinkAddress(); 00043 }; 00044 00045 /** Pass parameters in to functions via class-level temps */ 00046 class ParamsViaTemps : public SearchReplace 00047 { 00048 public: 00049 ParamsViaTemps(); 00050 }; 00051 00052 /** Replace automatic variables with stacks based on arrays and 00053 maintain the stack pointer correctly, supporting recursion. */ 00054 class GenerateStacks : public SearchReplace 00055 { 00056 public: 00057 GenerateStacks(); 00058 }; 00059 00060 /** Merge ordinary functions into the thread that calls them - 00061 this is not inlining, because a function only need be merged 00062 once for all the call points in the thread. Turn calls and 00063 return into gotos. */ 00064 class MergeFunctions : public SearchReplace 00065 { 00066 public: 00067 MergeFunctions(); 00068 }; 00069 00070 }; // end namespace 00071 00072 #endif /* GENERATE_STACKS_HPP_ */