How to create a C compiler for custom CPU?

前端 未结 6 1487
长发绾君心
长发绾君心 2021-01-31 08:16

What would be the easiest way to create a C compiler for a custom CPU, assuming of course I already have an assembler for it?

Since a C compiler generates assembly, is t

6条回答
  •  萌比男神i
    2021-01-31 08:35

    There's the concept of a cross-compiler, ie., one that runs on one architecture, but targets a different one. You can see how GCC does it (for example) and add a new architecture to the set, if that's the compiler you want to extend.

    Edit: I just spotted a question a few years ago on a GCC mailing list on how to add a new target and someone pointed to this

提交回复
热议问题