How to compile definitions in c++'s header file to IR in LLVM JIT Module?

Viewed 151

I am writing my own language using LLVM's JIT, some class will implement by c++, such as List, Map, and so on. I can compile these c++ files to object file and then add them to JIT for linking, but when i use them in my language, i need to know it's LLVM type, such as:

var data = new List<int>();
data.push(3);

when i implement var data = new List<int>(), i need to know List's struct type, and then alloca memory for it, but it's c++ code, i cannot know it.

So how to create StructType(LLVM IR) of List, in LLVM JIT? I don't what to write it by hand.

0 Answers
Related