title: How to create a C compiler for custom CPU?
body: <p>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?</p>
  
  <p>Since a C compiler generates assembly, is there some way to just define standard bits and pieces of assembly code for the various C idioms, rebuild the compiler, and thereby obtain a cross compiler for the target hardware?</p>
  
  <p>Preferably the compiler itself would be written in C, and build as a native executable for either Linux or Windows.</p>
  
  <p><strong>Please note:</strong> I am <em>not</em> asking how to write the compiler itself. I did take that course in college, I know about general compiler-compilers, etc. In this situation, I'd just like to configure some existing framework if at all possible. I don't want to modify the language, I just want to be able to target an arbitrary architecture. If the answer turns out to be "it doesn't work that way", <em>that</em> information will be useful to myself and anyone else who might make similar assumptions.</p>