Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Implement pure Go LLVM IR writer #42

Open
axw opened this issue Aug 6, 2013 · 3 comments
Open

Implement pure Go LLVM IR writer #42

axw opened this issue Aug 6, 2013 · 3 comments

Comments

@axw
Copy link
Member

axw commented Aug 6, 2013

This needs some exploration, but I think it should be pretty straight forward to implement a pure Go LLVM IR builder/writer for use in llgo. This would:

  • Enable us to work around deficiencies in the LLVM C API (e.g. no support for cyclic metadata)
  • Speed up builds, and vastly cut down the size of llgo's binaries (no huge libraries to statically link in)
  • Potentially better runtime performance, since there's no need to call through cgo.
  • No need for LD_LIBRARY_PATH shenanigans when only dynamic libraries are available.
  • No need for unsafe code (so llgo could used inside a web application)
  • I'm sure there's more.
@quarnster
Copy link
Contributor

Is there any functionality lost by not linking in the llvm libs and having direct access to LLVM's internals? Code optimization passes, performance tuning for specific cpu generations and architectures, etc are all available via llvm-as, llc, llvm-link et al, right?

@axw
Copy link
Member Author

axw commented Sep 24, 2013

Code optimization passes, performance tuning for specific cpu generations and architectures, etc are all available via llvm-as, llc, llvm-link et al, right?

Right. LLVM's nicely modular like that, so llgo can just write out IR, and we can pump it through "opt" for optimisation. llvm-link understands both IR and bitcode, as does clang.

Is there any functionality lost by not linking in the llvm libs and having direct access to LLVM's internals?

The only thing I can think of is knowledge of available target triples, which gets baked into libLLVM. We can just as well do that with llgo, though, using something similar to llvm-tblgen.

@axw
Copy link
Member Author

axw commented Jan 11, 2014

Taking this off milestones for now. This can be done any time, as it was shown that cyclic metadata was doable with the C API after all.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants