Displaying 3 results from an estimated 3 matches for "globalarray".
Did you mean:
global_array
2005 Nov 02
2
[LLVMdev] Statically Initialized Arrays
...checking.
I've been thinking that one level of indirection would solve the
problem for me. What I could do is reference the global array via a
function call while generating the code. Then, at the end, I would
generate both the array and the function body:
int array[size] = { ... };
int* globalArray( int index )
{
return &array[index];
}
Ideally, LLVM could then inline the function. Is there a better way to
arrange for this to occur? Should I not care about array lengths and
just have my global variable be a pointer?
Thanks for the advice,
Evan Jones
--
Evan Jones
http://evanjones.c...
2016 Sep 24
2
RFC: ConstantData should not have use-lists
> On 2016-Sep-24, at 15:16, Mehdi Amini <mehdi.amini at apple.com> wrote:
>
>>
>> On Sep 24, 2016, at 3:06 PM, Duncan P. N. Exon Smith via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> r261464 added a type called ConstantData to the Value hierarchy. This
>> is a parent type for constants with no operands, such as i32 0 and null.
>>
2005 Nov 02
0
[LLVMdev] Statically Initialized Arrays
...ke this:
OldGV->replaceAllUsesWith(ConstantExpr::getCast(NewGV, OldGV->getType());
OldGV->eraseFromParent();
At the end of this, any instructions or other globals that referenced the
temporary global will now reference the new one.
> int array[size] = { ... };
>
> int* globalArray( int index )
> {
> return &array[index];
> }
>
> Ideally, LLVM could then inline the function.
You could do something like this, but it's more indirect than the above
process.
> Is there a better way to
> arrange for this to occur? Should I not care about array len...