It is hard work.
For example I also design my own "architecture" with my own byte code and wanted to generate C/C++ code with GCC for it. This is the way how I make it:
- At first you should read everything about porting in the manual of GCC.
- Also not forget too read GCC Internals.
- Read many things about Compilers.
- Also look at this question and the answers here.
- Google for more information.
- Ask yourself if you are really ready.
- Be sure to have a very good cafe machine... you will need it.
- Start to add machine dependet files to gcc.
- Compile gcc in a cross host-target way.
- Check the code results in the Hex-Editor.
- Do more tests.
- Now have fun with your own architecture :D
When you are finished you can use c or c++ only without os-dependet libraries (you have currently no running OS on your architecture) and you should now (if you need it) compile many other libraries with your cross compiler to have a good framework.
PS: LLVM (Clang) is easier to port... maybe you want to start there?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…