00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00051 #include <stdio.h>
00052 #include <stdlib.h>
00053 #include <string.h>
00054 #include <sys/resource.h>
00055 #include <unistd.h>
00056
00057 #define NO_MEM_POOL_WORKAROUND
00058 #include "workaround.h"
00059 #include "messg.h"
00060 #include "resource.h"
00061 #include "timing.h"
00062
00063 #include "dipa_phase_ctrl.h"
00064 #include "dipa_errors.h"
00065 #include "dipa_globals.h"
00066
00067 #include "dipa_args.h"
00068 #include "rta_scn.h"
00069
00070 void usage(char *prog)
00071 {
00072 printf("Usage: %s elf-file\n", prog);
00073 exit(-1);
00074 }
00075
00076
00077 class CDIPA_Phase_Pre:public DIPA_Phase {
00078 public:
00079 CDIPA_Phase_Pre(const char *_name):DIPA_Phase(_name) {};
00080 BOOL Start(CMD_ARGS *args, DIPA_Olist *olist) {
00081 printf("Do nothing at pre phase\n");
00082 return true;
00083 }
00084 };
00085
00086 class CDIPA_Phase_Phase1:public DIPA_Phase {
00087 public:
00088 CDIPA_Phase_Phase1(const char *_name):DIPA_Phase(_name) {};
00089 BOOL Start(CMD_ARGS *args, DIPA_Olist *olist) {
00090 printf("Do nothing at %s\n", Get_Name());
00091 return true;
00092 }
00093 };
00094
00095 class CDIPA_Phase_Phase2:public DIPA_Phase {
00096 public:
00097 CDIPA_Phase_Phase2(const char *_name):DIPA_Phase(_name) {};
00098 BOOL Start(CMD_ARGS *args, DIPA_Olist *olist) {
00099 printf("Do nothing at %s\n", Get_Name());
00100 return true;
00101 }
00102 };
00103
00104
00105
00106
00107
00108 int main(int argc, char *argv[])
00109 {
00110 DIPA_Phase_Manager::Init_IPA();
00111
00112
00113 CDIPA_Phase_Pre *phase1 = new CDIPA_Phase_Pre ("pre");
00114 CDIPA_Phase_Phase1 *phase2 = new CDIPA_Phase_Phase1 ("opt1");
00115 CDIPA_Phase_Phase2 *phase3 = new CDIPA_Phase_Phase2 ("opt2");
00116
00117
00118 DIPA_Phase *subphase1 = new DIPA_Phase ("sub phase1");
00119 DIPA_Phase *subphase2 = new DIPA_Phase ("sub phase2");
00120
00121
00122 PHASE_ID phase1Id = DIPA_Phase_Manager::Register_Phase(phase1, NULL, NULL);
00123 PHASE_ID phase2Id = DIPA_Phase_Manager::Register_Phase(phase2, NULL, phase1);
00124 PHASE_ID phase3Id = DIPA_Phase_Manager::Register_Phase(phase3, NULL, phase1);
00125
00126
00127 PHASE_ID subphase1Id = DIPA_Phase_Manager::Register_Phase(subphase1, phase2, NULL);
00128 PHASE_ID subphase2Id = DIPA_Phase_Manager::Register_Phase(subphase2, phase2, subphase1);
00129
00130 Dipa_Proc_Options(argc, argv);
00131
00132 DIPA_Phase_Manager::Dump_All_Phases();
00133 DIPA_Phase_Manager::Do_IPA();
00134 DIPA_Phase_Manager::End_IPA();
00135
00136 MEM_Trace();
00137
00138 return 0;
00139 }