[LLVMdev] LLVM: Very simple question

Semion Prihodko semion.ababo at gmail.com
Fri Aug 19 08:00:37 PDT 2011


Hi, guys. I'm a newbie to LLVM and have a very simple question.

Which instructions should I use (in terms of IRBuilder calls) to allocate an
array of bytes in stack (alloca?), then to work with it (from a given
offset) as with integer (bitcast?). I mean something like that:

unsigned char var[8];
unsigned int offset = 3;
int val = *(int*)(&var+offset); /* read */
*(int*)(&var+offset) = 12; /* write */

Yes, I can convert the code above to assembly language using LLVM online
demo, but how can I perform that programmatically using IRBuilder?

Are there some LLVM code examples less trivial than Kaleidoscope?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110819/2a9c608e/attachment.html>


More information about the llvm-dev mailing list