[LLVMdev] How to link the right libraries?

Fernando Magno Quintao Pereira fernando at CS.UCLA.EDU
Tue May 2 12:52:05 PDT 2006



> > Hello, llvmers. Could someone explain me a little about the opt tool? I am
> > having problems to load a MachineFunctionPass using opt. I have this pass:
>
> MachineFunctionPass's cannot be used as part of opt, they can only be used
> as part of LLC.  Further, you have to explicitly modify the target you are
> interested in to add it to the pass manager for that target.
>
> What are you trying to do that requires a machine function pass?

I see. Thank you, Chris. Actually, what I was trying to do was to
compile a little example with each pass, as the hello world pass
in http://llvm.org/docs/WritingAnLLVMPass.html. My intention is to
get more acquainted with LLVM, and C++

So, if I want to add machine dependent passes, for example, for the
X86, I have to add them in the X86TargetMachine.cpp file, is it right?
I am a little confused about where to register passes, though. For
instance, the passes "phi-node-elimination", and
"TwoAddressInstructionPass" are registered in
TwoAddressInstructionPass.cpp
and PHIElimination.cpp, but what does determine that the PHI elimination
pass is executed first? Also, why the register allocation pass is added
directly to the pass manager in X86TargetMachine, and the same does
not happen to the PHI elimination pass?

Thanks a lot,

Fernando




More information about the llvm-dev mailing list