4 ms·
I compiled to assembly in an experimental barebones compiler, it is easy to get started. If I could host GCC or LLVM in my process and skip the ASCII serializat
by samsquire 3y ago
I compiled to assembly in an experimental barebones compiler, it is easy to get started. If I could host GCC or LLVM in my process and skip the ASCII serialization and parsing, that would be an awesome API. This has given me an idea to blog about...
I'm surprised I couldn't find a library that stores opcodes for each architecture.
I have tried to decipher the Intel x86 manuals but I ended up relying on GCC to see what assembly is produced.
- rockwotj 3y agoFWIW compiling the LLVM ir is a common approach, and LLVM has builders that don't require serialization
- kccqzy 3y agoThere was actually a very old and venerable tutorial on writing compilers in Haskell; it did not use ASCII serialization, but instead uses Haskell's FFI to directly invoke LLVM functions to do everything. That's very neat! https://www.stephendiehl.com/llvm/index.html https://www.stephendiehl.com/llvm/index.html