llc -load....

hello...
I have finish my backend. But I dont know how to install my backend...
llc -load=???Load what??
Can anyone teach me?
thanx.

There are two ways to do this. You can either link the backend directly into llc (like the X86 or PowerPC backends, see tools/llc/Makefile), or you can dynamically load the backend.

To dynamically load the back end, add these two lines to your target makefile:

SHARED_LIBRARY = 1
LOADABLE_MODULE = 1

This should build a DSO for your target (which will end with .so if you're on most unixy platforms). You can load this with:

   llc --load ~/llvm/Debug/lib/yourlibrary.so -march=yourarch in.bc -o out.s

BTW, what architecture are you working with?

-Chris

Thank you...
I am preparing to build a simple C compiler for our new architecture.
According to your suggestion. I try to dynamically load my backend.
But I got the error message :
llc : target 'Your_Arch' does not support static compilation!

could you tell me where is this problem?

Thank you...
I am preparing to build a simple C compiler for our new architecture.
According to your suggestion. I try to dynamically load my backend.
But I got the error message :
llc : target 'Your_Arch' does not support static compilation!
could you tell me where is this problem?

A useful tool in llvm is named 'llvmgrep'. You can use it like this:

$ cd ~/llvm (or whatever)
$ ./utils/llvmgrep 'does not support static compilation!'
tools/llc/llc.cpp:159: << "' does not support static compilation!\n";

If you look at that file, you'll see that this is because your targets addPassesToEmitAssembly(..) method returned true, indicating that it does not support static compilation.

-Chris

Hi everybody...
    I copy the Skeleton folder and just set the method
"Skeleton::addPassesToEmitAssembly" in the SkeletonTargetMachine.cpp
return false.
But I still get the message "does not support static compilation!".
Do I lost something?

Thanx.

Dave.