Constant Pool usage

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
octal
XCore Addict
Posts: 228
Joined: Thu Jan 27, 2011 3:30 pm
Location: Argenteuil - France

Constant Pool usage

Post by octal »

Hello,
I'm diving slowly in ASM programming for XMOS and I have something I don't really understand.
While I understant the usage of Constants Pool(s) (on other architectures), I don't understand really on XMOS where constant pools are used and how?

Understand me, I understand the instructions targeted at loading constants from constant pools, but I don't understand how and when they are used (by the compiler mainly). (I can't find documentation on that, I looked everywhere in the xs1 arch book).


User avatar
Jamie
Experienced Member
Posts: 99
Joined: Mon Dec 14, 2009 1:01 pm

Post by Jamie »

From the tools developer guide:
Named global read-only objects are placed in the .cp.rodata section and accessed
via the cp register.
This includes any constants too large for immediates and string values. You can also branch and link through the constant pool (BLACP).
User avatar
octal
XCore Addict
Posts: 228
Joined: Thu Jan 27, 2011 3:30 pm
Location: Argenteuil - France

Post by octal »

Thanks Jamie,
I forgot this one ... forgot to check the Tools dev guide :oops:
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

Since this is the ASM forum...

It is called "constant pointer", but you can of course write to what it points to
just fine (if it points to RAM, heh). So you can use it as a pointer to whatever
you please; just remember that there are no instructions to write with CP as
base address, you have to do an LDWACP first, so you would typically use it
for something that you do not need to write to often (but not necessarily
never!)