[LLVMdev] Set the minimum number of allocated bits for a variable

Jimborean Alexandra xinfinity_a at yahoo.com
Mon Dec 10 09:28:14 PST 2012

Hello Patrik,

Thank you for your reply. Indeed, setting the alignment using the constructor is sufficient. 



 From: Patrik Hägglund H <patrik.h.hagglund at ericsson.com>
To: Jimborean Alexandra <xinfinity_a at yahoo.com> 
Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> 
Sent: Thursday, November 22, 2012 1:47 PM
Subject: RE: [LLVMdev] Set the minimum number of allocated bits for a variable

Hi Alexandra,
I’m not sure want you want to do. Is the data layout string (http://llvm.org/docs/LangRef.html#datalayout, also usually set by each target specific *TargetMachine constructor), for setting the alignment good enough for you?
Or is it more than the alignment you want to control? Do you have a target with 16-bit bytes? In that case, there is quite a lot of changes that needs to be done (we maintain some patches internally that we can provide upon request).
Patrik Hägglund
From:llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Jimborean Alexandra
Sent: den 22 november 2012 13:07
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Set the minimum number of allocated bits for a variable
I would like to force the minimum number of bits allocated for a variable in memory to be 16. From what I have seen, i1 is already represented on 8 bits. So, the only change would be to represent i1 and i8 on 16 bits, as all other types already fulfill this condition.
TargetData can help by setting a higher alignment, thus although the type is i1 or i8, the number of allocated bits is 16. 
What is the best approach to impose this?
(i) modifying the back-end of LLVM 
    - where can I find the defaults for specifying the number of allocated bits for each type?
(ii) writing a pass that overwrites these defaults?
   - by asking for an alignment higher than the default
   - one approach is to set a higher alignment for each allocated variable of type i1 or i8, but this means digging inside the arrays, vectors and structures to check the type of each element.
Looking forward to receiving your suggestions.
Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121210/a51b072b/attachment.html>

More information about the llvm-dev mailing list