Christoffer Lernö via llvm-dev
2019-Nov-16 16:56 UTC
[llvm-dev] LLVM types & getting alignment - with multiple contexts. Feedback needed.
I was looking at using multiple contexts in LLVM for codegen, but I’m running into some problems. First a quick rundown of what my idea was: 1. Run lexing-parsing-sema in a single thread. Store each ast-module separately. 2. Build the LLVM IR using 1 context per ast-module. 3. Launch multiple threads doing code gen on each of the contexts in parallel. A problem is that in order to do the correct semantic analysis I need to know a bit about alignment and sizes as macros will be able to do conditional compilation depending on sizes and offsets. The ABI / preferred alignments can be found if I generate LLVM types, but I don’t generate a context until (2) and I need the alignments during (1). I see a few possibilities (note that i use the LLVM C API) 1. Keep a completely independent list of these settings inside of my frontend and calculate layout myself. 2. Parse the Data Layout string for the machine to use to get the information need otherwise do the calculation as in (1) 3. During (1) use the global context to generate LLVM types from my current types and rely on LLVM for calculation. These types will then need to be recreated in (2) but for the ”right” context. Are there other ways to do this? Best Regards, Christoffer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191116/24f16b5a/attachment.html>