Are there compilers for high-level languages (such as C) which can be targeted to various architectures by specifying the hardware resources of the target?
I’m wondering if there are compilers which can target an architecture by specifying features such as the available registers and instruction set of the processor (i.e. how each instruction changes the state of the processor), and memory layout of the architecture.
I am aware that compilers such as gcc can target for multiple archtectures, but I’d like to know if there are compilers that can compile for new architectures by swapping out, say, configuration files, in order to target a new architecture.
AFAIK, gcc does work just like that. check ‘Machine Descriptions’ in the gcc docs. Of course, creating those
.mdfiles is a major programming effort.