[llvm-dev] New to LLVM, need some help with JIT
Pooya SaadatPanah via llvm-dev
llvm-dev at lists.llvm.org
Thu Jun 2 16:36:40 PDT 2016
I'm a grad student working on a C++11 project and I have no compiler
background. I apologize for asking basic questions here.
Currently I'm looking for ways to optimize my code and as a starting point
I wanted to experiment with loop unrolling and further I might consider
function in-lining . I have been introduced to JIT compiler of LLVM and the
possible application of it in my project.
Currently I know the basics about creating a module and getting a JIT
compiler. I followed this:
I have two questions:
1) What's the right way to add a class or an instance of it to a module? I
could only find ways to add structs to modules and I'm not sure how to deal
with classes. Any good references to check? Or any good
article/projects/code samples to look into?
2) Is there a way to declare that certain parts of a structure won’t change
during execution? For instance, let’s say that I have a class 'foo' and
foo.x is 7 and doesn’t change over the life of the code, but foo.y does.
There is a function in class foo and the function uses foo.x as the
condition in the loop, thus I’d like to tell LLVM that foo.x is always 7,
so that it can unroll the loop "for(int i = 0;i < foo.x;i++)". But I’m a
little confused about how LLVM uses constants – they appear to be tied to
global variables only, and only an entire global variable, so I don’t see
how to make one component of it a constant.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev