Displaying 5 results from an estimated 5 matches for "toglobal".
2013 Aug 08
0
[LLVMdev] Address space extension
...itant about using address spaces until we've fixed their semantics to disallow bitcasts between different address spaces and require an explicit address space cast. To illustrate the problem, consider the following trivial example:
typedef __attribute__((address_space(256))) int* gsptr;
int *toglobal(gsptr foo)
{
return (int*)foo;
}
int load(int *foo)
{
return *foo;
}
int loadgs(gsptr foo)
{
return *foo;
}
int loadgs2(gsptr foo)
{
return *toglobal(foo);
}
When we compile this to LLVM IR with clang (disabling asynchronous unwind tables for clarity), at -O2 we get this:
define i32* @togl...
2013 Aug 08
4
[LLVMdev] Address space extension
On Aug 7, 2013, at 7:23 PM, Michele Scandale <michele.scandale at gmail.com> wrote:
> On 08/08/2013 03:52 AM, Pete Cooper wrote:
>>> Why a backend should be responsible (meaning have knowledge) for a
>>> mapping between high level address spaces and low level address spaces?
>> Thats true. I’m thinking entirely from the persecutive of the backend
>> doing
2013 Aug 08
2
[LLVMdev] Address space extension
...address spaces until we've fixed their semantics to disallow bitcasts between different address spaces and require an explicit address space cast. To illustrate the problem, consider the following trivial example:
>
> typedef __attribute__((address_space(256))) int* gsptr;
>
> int *toglobal(gsptr foo)
> {
> return (int*)foo;
> }
>
> int load(int *foo)
> {
> return *foo;
> }
>
> int loadgs(gsptr foo)
> {
> return *foo;
> }
>
> int loadgs2(gsptr foo)
> {
> return *toglobal(foo);
> }
>
> When we compile this to LLVM IR with...
2013 Aug 08
0
[LLVMdev] Address space extension
...their semantics to disallow bitcasts between different address spaces and
>> require an explicit address space cast. To illustrate the problem,
>> consider the following trivial example:
>>
>> typedef __attribute__((address_space(**256))) int* gsptr;
>>
>> int *toglobal(gsptr foo)
>> {
>> return (int*)foo;
>> }
>>
>> int load(int *foo)
>> {
>> return *foo;
>> }
>>
>> int loadgs(gsptr foo)
>> {
>> return *foo;
>> }
>>
>> int loadgs2(gsptr foo)
>>...
2013 Aug 09
1
[LLVMdev] Address space extension
On Aug 8, 2013, at 3:04 AM, David Chisnall wrote:
> The correct code for this should be (I believe):
>
> _toglobal: ## @toglobal
> ## BB#0:
> pushq %rbp
> movq %rsp, %rbp
> lea %gs:(%rdi), %rax
> popq %rbp
> ret
This won't have the effect you're hoping for. LEA stands for "Load Effective Address"; it only operates on the offset part of a log...