cjvillar / cis_27_group_project

0 stars 0 forks source link

Working with LLVM #2

Open stlamoureux1 opened 2 months ago

stlamoureux1 commented 2 months ago

Share insights, resources, and issues for using LLVM.

stlamoureux1 commented 2 months ago

Updated:

Issue 1: I can't get a build to work on my Linux machine. I'll see if I can use binaries instead and let you know.

Thought: Still figuring it out, but I'm assuming it's necessary to write a translation scheme from AST to LLVM IR manually. It looks like that IR is quite complex in itself so I'm wondering how much we gain compared to translating to asm or to C.

stlamoureux1 commented 2 months ago

One alternative that might be more lightweight: https://asmjit.com

stlamoureux1 commented 2 months ago

Resources:

stlamoureux1 commented 2 months ago

Also if you want to get a feel for it I would recommend writing some C code and compiling it with: $ clang -S -emit-llvm -o [name].ll [name].c and you can view the IR that way.

stlamoureux1 commented 2 months ago

Gonna drop this here as well:

https://github.com/PacktPublishing/Learn-LLVM-17/tree/main/Chapter02/calc/src

Comes from a book on LLVM 17 from O'Reilly. I'm able to get online access to the book with my public library account you might wanna try similar. Shows how the visitor pattern is used is for getting IR from ASTs, so I'm gonna be going through that and trying to internalize it.