[LLVMdev] pass position

John Criswell criswell at cs.uiuc.edu
Wed Dec 17 14:09:05 PST 2003

Anshu Dasgupta wrote:
>> I can run that pass through opt on the bytecode emitted by gcc frontend
>> through opt tool. However, I want that Pass1 to be the part of the 
>> actual GCC  compiler. I want to know how I can position Pass1 among 
>> other passes  /optimizations/ code generations.

	Another thing to note is that gccld, as well as gccas, also performs 
optimizations on the bytecode.  Since gccld links together all of the 
translation units, it can do interprocedural optimizations on the entire 
program (whereas gccas can only optimize one bytecode file at a time).

	Your optimization pass may be better added to gccld, depending on what 
it does.

> I had a similar question and Chris recommended that I edit the 
> addPassesToEmitAssembly method. Quoting him:
> " 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 can explicitly specify where (w.r.t other passes) your pass will 
> execute in the addPassesToEmitAssembly method.

	My understanding of this is not complete, but from what I understand, 
Anshu's issue revolves around the fact that his pass deals specifically 
with code generation in llc.  Regular optimization and analysis passes 
can be coded as a separate project and loaded into opt or analyze 
dynamically at run time (or they can be hard-coded into gccas and 
gccld).  I believe only passes that directly deal with machine code 
generation (i.e. passes added to llc) need to use addPassesToEmitAssembly().

	So, for Umar's work, the addPassesToEmitAssembly() should not be necessary.

	Corrections to my comments welcome.

> -Anshu
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev


John T. Criswell

* John T. Criswell                         Email: criswell at uiuc.edu *
* Research Programmer                                               *
* University of Illinois at Urbana-Champaign                        *
*                                                                   *
* "It's today!" said Piglet. "My favorite day," said Pooh.          *

More information about the llvm-dev mailing list