[LLVMdev] Assertion failed in Pass.cpp

Chris Lattner sabre at nondot.org
Mon Dec 15 17:19:01 PST 2003


On Mon, 15 Dec 2003, Anshu Dasgupta wrote:
> I am trying to write a pass for the llc tool.  I register this pass
> with the RegisterLLC template.  However, when I try to run llc and load
> up the pass, I get a failed assertion:

Hrm, interesting.  It's not actually legal to load machine code passes
into LLC yet.  :)

The problem is that there currently isn't enough information to specify
_where_ in the code generator to insert an arbitrary machine code pass
(before register allocation? after it? before instruction selection?,
etc).

To do this you have to edit one of the target machines
addPassesToEmitAssembly/addPassesToJITCompile method to include your pass.
In the future, given a few PassManager improvements that I am going to be
working on in the not-too-distant future, hopefully this can be
implemented.

Anyway, for this reason, the -load option shouldn't even even exist in the
LLC tool.  It's there currently only for historical reasons, but this
patch removes it:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031215/010215.html

>    RegisterLLC<testfn> X("testfn", "testfn");

Getting back to your assertion failure.  I'm not sure that RegisterLLC
actually works, even if your code was compiled into the LLC executable.
I'm inclined to think not, as there are currently no clients of it.

Basically, if you want to work on the code generator, this is what you
should do:  Add your pass to the addPassesToEmitAssembly method for the
target of your choice, and in your pass implement the getPassName() method
to provide a nice user-friendly name.  You shouldn't have to register LLC
passes, because they can't be specified on the command line.

Because of this, I'll just go ahead and remove the RegisterLLC template to
avoid future problems...

Sorry for the confusion,

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/







More information about the llvm-dev mailing list