[LLVMdev] Discussion of eliminating the void type

John Criswell
Mon, 07 May 2012 15:54:25 -0000

On 5/7/12 10:36 AM, Duncan Sands wrote:
> Hi Mitnick,
>
>> === Overview ==>>
>> The general concept is to replaced void with {}. And 'ret void'
is a synonym of
>> 'ret {} {}.'
> in a sense the concept is just to delete void and not to replace it with
> anything in particular.  Of course front-ends (clang, dragonegg) need to
produce
> something instead of void, and {} is an example of what they might produce,
but
> they should not be obliged to use that.  For example they could use [] or
{{}}
> etc.
>
>> === Further Implementation Details ==>>
>> 1. Deleting VoidTyID
> Yes!
>
>> 2. Deleting LLVMVoidTypeKind (one-to-one relation between VoidTyID and
>> LLVMVoidTypeKind)
> Yes!
>
>> 3. Use StructTy* VoidTy instead of Type VoidTy
> No!  This doesn't make any sense to me.  Why would having a definition
for
> VoidTy be needed or desirable?
>
>>       VoidTy may be Identified struct. In addition to error occurs at
>> test/Analysis/BasicAA/empty.ll
>>       because of using literal struct "{}" as VoidTy
>>
>> 4. Re-implement isVoidTy().
> No!  Just delete void type, don't try to create a canonical replacement
for it.

The value of still having something like a VoidTy in the API is that it
would reduce the amount of code that needs to change.  Much of our code
at Illinois uses void type; I imagine lots of other LLVM code (including
code in LLVM) does as well.

Going further, it's not clear to me why people want to get rid of the
void type.  Is there a lot of special casing that would go away if
VoidTy were removed?  All of the justification in Chris's note appears,
for lack of a better word, cosmetic.  It's a cleaner design, but the
cost of "fixing" the issue seems to outweigh its benefit.

-- John T.


>
> Ciao, Duncan.
>
>>       Test whether the address of the type equals Type::getVoidTy()
>>
>> === Request For Command ==>>
>> The constructor form of ReturnInst
>>
>> Any suggestion is welcomed.
>>
>> Thanks a lot
>>
>> Mitnick
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev