I’m working on AVR backend/target and it’s almost working:
I’ve read how to add LLVM backend/Target:
But how can i add target (AVR) to Clang?
Is it designed to add targets easily or should i hack the sources?
That makes sense as some information is lost at the moment, f.e. attribute:
attribute ((section … ))
LLVM IR isn’t portable, and you will need to teach Clang about your target. The two big things it needs to know are record layout rules and calling convention lowering rules. Record layout should be easy, it is just the size and alignment of basic types like pointers and i64 (4 or 8 byte aligned?). Calling convention lowering is tricky, as you need to understand the ABI rules for struct passing, and how you implemented them in LLVM.
Thanks for replying.
I’ve found Attr.td and Targets.cpp filse to add AVR-specific attributes and AVR TargetInfo.
You’re absolutely right and i should just consult AVR datasheets to write correct types sizes and so on.
Are there any other files to modufy to add AVR support?