Author Topic: MILESTONE: multi-file and multi-pkg compilation!  (Read 7621 times)

bas

  • Full Member
  • ***
  • Posts: 220
    • View Profile
MILESTONE: multi-file and multi-pkg compilation!
« on: May 16, 2013, 08:41:57 PM »
It's been a while, since my last post, but that doesn't mean nothing is happening with C2.
The IR and C code generation have been refactored to a visitor pattern like clang uses. This allows us to take more
advantage of the clang code.

Additionally, the compilation has been changed from 'by file' to 'by package'. This means that each
C2 package is turned into one LLVM::Module. This is already working, which is pretty amazing. So you can
cut up your code and put types, global vars and functions in any order in any file of the same package and
C2 will compile it for you and still give you the performance optimization level of C statics. Wow!

Also multi packages (in multi files) is also working with the code generator generating (Module) external function
declarations for calls to other package functions.

What's currently really missing is a Unit test framework. I've looked into the LLVM framework, but don't
understand it far enough to incorporate it into C2 also.

The C2 compiler currently only generation IR code. With some LLVM/Clang tools, you can just compile this
to a normal .o / executable, but it would be nice if C2C could do that for you. So hopefully by the end of
June, this will be implemented.

Stay tuned!
Bas