[cfe-dev] pointer to variable in different address space
Chris Lattner
clattner at apple.com
Thu Jan 15 19:28:21 PST 2009
On Jan 15, 2009, at 7:12 PM, Vasudev.Negi at microchip.com wrote:
> I am assuming address space 1 for variables in ROM. Now if I want a
> pointer to contain the address the this variable then how do I
> declare it? In other words I want to declare rom int *ptr.
>
Something like this works for me:
#define rom __attribute__((address_space(1)))
rom int *ptr;
$ clang rom.c -emit-llvm -o -
; ModuleID = 'rom.c'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-
f80:128:128"
target triple = "i386-apple-darwin9"
@ptr = common global i32 addrspace(1)* null, align 4
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090115/38ae26c3/attachment.html>
More information about the cfe-dev
mailing list