I’m trying to generate the object file while building my IR module. I found the tool llc
, but actually it was an executable file which I can’t call it from my llvm program directly.
Later I pull the llc.cpp
file from the llvm source tree, along with the cmakelist.txt. But when I finally fix some trivial undefined code and comile it, It says lots of function not found.
Just like
initializeCore’ was not declared in this scope
76 | initializeCore(*Registry);
| ^~~~~~~~~~~~~~
odegen.cpp:77:5: error: ‘initializeCodeGen’ was not declared in this scope
77 | initializeCodeGen(*Registry);
| ^~~~~~~~~~~~~~~~~
codegen.cpp:78:5: error: ‘initializeLoopStrengthReducePass’ was not declared in this scope
78 | initializeLoopStrengthReducePass(*Registry);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
codegen.cpp:79:5: error: ‘initializeLowerIntrinsicsPass’ was not declared in this scope
79 | initializeLowerIntrinsicsPass(*Registry);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
I’ve comment the below header because I can’t find it when I compile out of tree.
llvm/CodeGen/CommandFlags.inc
the complete header file and the cmake is pasted
header : Ubuntu Pastebin
cmakelist Ubuntu Pastebin
Alternatively, extract the llc.cpp file and compile it out of tree is not a good idea.
I wonder whether I could compile the llc as a library file for me to call the function directly, like .so
on linux. If possible, is there any idea to modify the original llc
cmakelists?
Thanks in advance.