[LLVMdev] c const

Chris Lattner sabre at nondot.org
Wed Aug 8 07:59:02 PDT 2007


This property isn't preserved on the llvm ir, because const can always  
be cast away.  If you want mod information, then I suggest using the  
aliasanalysis interface to get mod ref info for a call.

-Chris

http://nondot.org/sabre
http://llvm.org

On Aug 8, 2007, at 12:07 AM, "Ryan M. Lefever" <lefever at crhc.uiuc.edu>  
wrote:

> How is c's const keyword translated when compiling c into llvm  
> bytecode.
>  I'm specifically interested in const pointer function arguments.
> Consider a function declared as follows in c:
>
> void f(const int* arg);
>
> When I examine f in llvm bytecode, how can I tell that arg is a  
> pointer,
> whose contents can only be read, not written.
>
> Regards,
> Ryan
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list