Skip to content

dong-zhan/llvm

Repository files navigation

llvm helper classes and functions

this project is for practice in IR
and hopefully, the functions in it can be handy for someone who actually is creating either a dynamic compiler(JIT) or just a compiler

for example:
1, how to create global variables?
2, how to access local varaibles?
3, how to call exernal functions?
4, how to use struct?
5, example of SSA and Phi node
6, mutable variable
7, cast
8, object-oriented construct (c++ class, this, constructor, member functions)
9, virtual functions
10, class inheritance
11, typeinfo and dynamic_cast
12, how to debug JIT

All functions are in testllvm.cpp

KaleidoscopeJIT.h is from llvm repository

but, seems there is a problem I changed
[this](const std::string& Name) { return findMangledSymbol(Name); },
to
[this](const llvm::StringRef& Name) { return findMangledSymbol(Name.str()); },

Releases

No releases published

Packages

No packages published

Languages