[LLVMdev] LLVM IR Type System Rewrite

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Sun Feb 27 09:48:07 PST 2011


On 11-02-26 4:25 PM, Chris Lattner wrote:
> Several people have been proding me to write up my thoughts on how to fix the IR  type system for LLVM 3.0.  Here are some (fairly stream of conscious) thoughts on the matter:
> http://nondot.org/sabre/LLVMNotes/TypeSystemRewrite.txt

Thanks!

> Comments welcome!

Having fewer types makes the job of the passes easier. Right now we 
maintain a small number of types as we go, which is expensive. In the 
proposed change, would it still be legal to write a type merging pass? 
For example, lets say we have

   %Foo = type { i32 }
   %Bar = type { i32 }
   @a = unnamed_addr constant %Foo { i32 42 }
   @a = unnamed_addr constant %Bar { i32 42 }

The typemerge pass could turn this into

   @a = unnamed_addr constant {i32} { i32 42 }
   @b = unnamed_addr constant {i32} { i32 42 }

And constmerge will then merge them as it does today.

Another comment is that getting anonymous types would still be a bit 
expensive. Can we get away with just Named types (including Unnamed) and 
trusting typemerge to do its job?

> -Chris

Cheers,
Rafael



More information about the llvm-dev mailing list