[LLVMdev] c const
Christopher Lamb
christopher.lamb at gmail.com
Tue Aug 21 10:34:00 PDT 2007
On Aug 21, 2007, at 10:17 AM, Duncan Sands wrote:
> Hi Christopher,
>
>>> it looks like noalias might be very useful for Ada: for certain
>>> types,
>>> such as array types, the language standard explicitly allows the
>>> compiler
>>> to pretend that a formal argument of that type is passed by-copy (=
>>> by-value)
>>> for alias analysis purposes, while actually passing it by-reference
>>> (= via a pointer).
>>> I'm not sure, but based on Chris's suggested implementation
>>> http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-March/008323.html
>>> it seems that this may map exactly to "noalias". There is a
>>> subtlety
>>> though: the compiler may pretend that a copy was passed in, but it
>>> must
>>> correspond to a copy made at the moment of the function call, not
>>> later.
>>>
>>> In Chris's description
>>> " The semantics of 'noalias' are that they "define a new object" "
>>> it is not specified *when* the new object gets its value; Ada
>>> requires
>>> the pretend "new object" to act as if it got its value at the
>>> start of
>>> the function body, not later, as if a copy of the real object was
>>> made
>>> at that point.
>>
>> I can't see how the semantics could be anything other than for the
>> "new object" that the noalias argument points to could be created at
>> any other time than the beginning of the function.
Please excuse this atrocious sentence. It's completely misleading (I
don't drink coffee, but maybe I should start?)
It should read: I can't see how the semantics could be anything but
for the "new object" to be created at the beginning of the function.
I merged the wrong parts of two sentences in my earlier email. Sorry
for the grief!
--
Christopher Lamb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070821/2f37745d/attachment.html>
More information about the llvm-dev
mailing list