Project Stage 2
Firstly I created a custom pass code
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree-pass.h"
#include "gimple.h"
namespace {
const pass_data pass_data_afmv_diagnostics = {
GIMPLE_PASS,
"afmv_diag",
OPTGROUP_NONE,
TV_NONE,
0,
0,
0,
0,
0
};
class pass_afmv_diagnostics : public gimple_opt_pass {
public:
pass_afmv_diagnostics(gcc::context *ctxt)
: gimple_opt_pass(pass_data_afmv_diagnostics, ctxt) {}
bool gate(function*) final override {
return true;
}
unsigned int execute(function*) final override {
fprintf(stderr, "AFMV Diagnostics: Hello, World!\n");
return 0;
}
};
}
gimple_opt_pass* make_pass_afmv_diagnostics(gcc::context *ctxt) {
return new pass_afmv_diagnostics(ctxt);
}
Register the Pass in passes.def
Edit passes.def
to register the pass:
nano ~/gcc/gcc/passes.def
added this line:
NEXT_PASS (make_pass_afmv_diagnostics);
Declare the Prototype in tree-pass.h
Edit tree-pass.h
to declare the prototype:
nano ~/gcc/gcc/tree-pass.h
Add the prototype:
extern gimple_opt_pass* make_pass_afmv_diagnostics(gcc::context *ctxt);
Include in Makefile.in
Edit Makefile.in
to include afmv-diagnostics.o
in the OBJS
variable:
nano ~/gcc/gcc/Makefile.in
Add
afmv-diagnostics.o
For now when I am trying to rebuild the gcc-build-001,
I'm receiving some gimple check errors.
I am trying to resolve this issues to complete Project Stage 2
Errors:
/libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o c-family/c-ppoutput.o -MT c-family/c-ppoutput.o -MMD -MP -MF c-family/.deps/c-ppoutput.TPo ../../gcc/gcc/c-family/c-ppoutput.cc make[3]: *** [Makefile:1199: c-family/c-gimplify.o] Error 1 make[3]: *** Waiting for unfinished jobs.... Shared 73054 out of 134112 states by creating 11963 new states, saving 61091 /bin/sh ../../gcc/gcc/../move-if-change tmp-recog.cc insn-recog.cc echo timestamp > s-recog /bin/sh ../../gcc/gcc/../move-if-change tmp-output.cc insn-output.cc echo timestamp > s-output /bin/sh ../../gcc/gcc/../move-if-change tmp-automata.cc insn-automata.cc echo timestamp > s-automata /bin/sh ../../gcc/gcc/../move-if-change tmp-attrtab.cc insn-attrtab.cc /bin/sh ../../gcc/gcc/../move-if-change tmp-dfatab.cc insn-dfatab.cc /bin/sh ../../gcc/gcc/../move-if-change tmp-latencytab.cc insn-latencytab.cc echo timestamp > s-attrtab make[3]: Leaving directory '/home/ahryhorzhevskyi/gcc-build-new/gcc' make[2]: *** [Makefile:5057: all-stage1-gcc] Error 2 make[2]: Leaving directory '/home/ahryhorzhevskyi/gcc-build-new' make[1]: *** [Makefile:25283: stage1-bubble] Error 2 make[1]: Leaving directory '/home/ahryhorzhevskyi/gcc-build-new' make: *** [Makefile:1103: all] Error 2
Комментарии
Отправить комментарий