[LLVMdev] "UNREACHABLE executed!" error?

OvermindDL1 overminddl1 at gmail.com
Sun Aug 15 16:24:36 PDT 2010


Forgot the mailing list is still oddly configured compared to the
other 30 I use, sending to list...

On Sun, Aug 15, 2010 at 5:23 PM, OvermindDL1 <overminddl1 at gmail.com> wrote:
> On Sun, Aug 15, 2010 at 5:06 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
>> OvermindDL1 wrote:
>>> Could you not just keep the IRBuilder instructions for the union, but
>>> have it lower it to whatever the necessary IR code is?  Unions are
>>> nice as you do not need to worry about the size, else you have to
>>> figure out what size it needs to be if you handle it manually, and
>>> sometime that is exceedingly difficult before code generation time,
>>> causing a lot more code generation.
>>
>> Unions are an entire new *type*. If it were merely new instructions that
>> would certainly be feasible. The point of union is that it can express
>> something you can't express in any other way, a type with a size of the max
>> of a set of other types, even when you don't know those other sizes.
>>
>> You can get equivalent behaviour in LLVM IR with the GEP trick[1] and
>> alloca'ing the right about of space, but there's no way at all to make it
>> match the API of a type.
>>
>> [1] -
>> http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt
>
> That is what I was referring to, I know it would not be a single
> instruction, but a CreateUnion in the IRBuilder or so could take a
> list of types and so forth and find out the max in the IR using the
> GEP trick an allocate an appropriate sized type that it returns for
> use, in the IR you would see a lot of new lines based on how many
> types are passed in to figure out the size of the returned type or so,
> then just use the 'memory' by casting as necessary, knowing that you
> have the appropriate size in any case.
>




More information about the llvm-dev mailing list