<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><font face="Hack Nerd Font Mono">Hi Manuel,</font></p>
<p><font face="Hack Nerd Font Mono"><br>
</font></p>
<p><font face="Hack Nerd Font Mono">So I haven't thought about this
much but here some initial reactions:<br>
</font></p>
<p><font face="Hack Nerd Font Mono"><br>
</font></p>
<p><font face="Hack Nerd Font Mono">I guess if you want to modify
the code of a definition you need to mark it as `naked` or
similar. We analyze the code after all, if it changes whatever
we derived is pretty much wrong. However, you could also not
reliably change the code if we can modify it so to make changes
"sane" you need `naked` anyway.<br>
</font></p>
<p><font face="Hack Nerd Font Mono"><br>
</font></p>
<p><font face="Hack Nerd Font Mono">I don't think the declaration
should not be `__attribute__((pure))` ~ `readnone` if its code,
can change. One could argue similar to the above case, e.g., it
needs to be `naked` and therefore cannot be `readnone` (not that
we have the restriction). Or one could say you break the
implicit property of `pure`/`readnone` that is used all over the
place: No matter when or where it is called the result is the
same.</font></p>
<p><br>
</p>
<p><font face="Hack Nerd Font Mono">I agree that the LangRef is
pretty light on this topic.</font></p>
<p><font face="Hack Nerd Font Mono"><br>
</font></p>
<p><font face="Hack Nerd Font Mono">Cheers,</font></p>
<p><font face="Hack Nerd Font Mono"> Johannes</font><br>
</p>
<p><font face="Hack Nerd Font Mono"></font><br>
</p>
<div class="moz-cite-prefix">On 4/16/20 1:46 PM, Manuel Jacob via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:a8d611cd4fc9a87555c8dc2f353db446@manueljacob.de">On
2020-04-16 18:26, Hiroshi Yamauchi wrote:
<br>
<blockquote type="cite">I am not sure if the IR spec that
explicitly talks about this, but I'm
<br>
under the impression that the code memory is assumed to be
constant or
<br>
abstracted out at the IR level and the IR optimizer does not
need to think
<br>
about the code getting modified or just treats it as undefined
behavior.
<br>
</blockquote>
<br>
One case where the Language Reference explicitly mentions the
possibility of modifying machine code is Prologue Data:
<a class="moz-txt-link-freetext" href="http://llvm.org/docs/LangRef.html#prologue-data">http://llvm.org/docs/LangRef.html#prologue-data</a>
<br>
<br>
So at least the prologue part is seemingly not considered
constant. The question of what ordering restrictions are placed
between calls and code potentially modifying the callee machine
code is still unclear, though.
<br>
_______________________________________________
<br>
LLVM Developers mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
<br>
</blockquote>
</body>
</html>