13 ms·
What would you want to use it for, and why not use an existing solution? My first choice would be Frama-C (frama-c.com), which has served me well in the past.
by gergo_barany 2y ago
What would you want to use it for, and why not use an existing solution? My first choice would be Frama-C (frama-c.com), which has served me well in the past.
- JonChesterfield 2y agoPersonally, I want to compile C with vector types to x64 and to amdgpu at the same time, for running code on APUs like the MI300A. I have a suspicion checking that idea works in practice will be easier building from a grammar than from clang.
- gergo_barany 2y agoSo you want to add new builtin types for vectors? Yes, building on a parser sounds like a good approach. Otherwise, Frama-C would give you a nice detailed AST, but it might be complicated to extend this way. Sounds like a cool project, good luck!
- JonChesterfield 2y agoThe vector types are straightforward and already implemented in clang - it's twisting llvm to represent two different triples in a single module and handling calls between them that I think will be extremely tedious to implement. Frama-c / libfirm / other-compiler-here means getting started quickly and then an uphill battle against the existing implementation. Grammar plus symbol table should yield ast, C doesn't need that much sema checking after the parse, build ssa form cranelift-style then write out asm. Should be a cheap enough exercise to walk through but the unknown unknowns will mess up the schedule and there's a day job in the way. One for a week's vacation I think.