[LLVMdev] More Encoding Ideas

Robert Mykland robert at ascenium.com
Mon Aug 23 19:46:26 PDT 2004


At 06:43 PM 8/20/2004, Chris Lattner wrote:
>On Fri, 20 Aug 2004, Robert Mykland wrote:
> > >In any case, both signed and unsigned 8-bit constants can be written out
> > >in a single byte.  Again, do you think it's worth special casing this
> > >though?  Considering that we handle 8-bit strings specially already, there
> > >are not a ton of 8-bit constants with value >= 128.
> >
> > I'd rather that they not be treated specially.  If char defaulted to
> > unsigned char, there would be little reason to create this special case.
>
>I don't understand what you're getting at here.  You can change char to
>default to unsigned right now with llvm-gcc -funsigned-char.  I don't
>understand how that would change anything to be more useful though.

Well, in the old days, char strings were handled just like any other kind 
of array of primitive types.  In that world, when char defaulted to signed 
char, most of the heavily used ASCII symbols took two bytes to 
encode.  Thus, (and I'm guessing here), you guys decided to treat char 
strings as a special case to save space in the bytecode file.

>Okay, that's fine.  When implementing that, we should take care to create
>the pointer types lazily instead of eagerly to avoid creating pointer
>types that are not used.

If all pointer types are implied, not a problem to create them.  However, 
in larger files it may cost a little due to slightly larger type 
numbers.  I'm not sure about the tradeoff here, but I expect that implied 
pointers would still save more just because of pointers to function types.

Regards,

-- Robert.


Robert Mykland               Voice: (831) 462-6725
Founder/CTO                   Ascenium Corporation 





More information about the llvm-dev mailing list