[LLVMdev] is there a compiler barrier that is effective at codegen level?
Owen Anderson
resistor at mac.com
Tue Dec 22 13:20:56 PST 2009
On Dec 22, 2009, at 12:57 PM, Torvald Riegel wrote:
> Here is an example:
>
> %160 = add i64 %158, %159 ; <i64> [#uses=1]
> %161 = sub i64 %160, %startHash.0 ; <i64> [#uses=5]
> tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags},~{memory}"()
> nounwind
> %fp73 = call i8* @llvm.frameaddress(i32 0) ; <i8*> [#uses=1]
> %sp74 = call i8* @llvm.stacksave() ; <i8*> [#uses=1]
> call fastcc void @Function1(i8* %sp74, i8* %fp73) nounwind
> %162 = call i32 (i32, ...)* @Function2(i32 0) ; <i32> [#uses=1]
> tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags},~{memory}"()
> nounwind
>
> In particular, I would like to prevent modifications to the stack to be put
> between the calls to Function1 and Function2. Is this possible at all?
> The standard asm compiler barriers don't seem to work, can I use another hack?
> (I could put the calls to Function1 and Function2 into another noinline dummy
> function and call this one instead, but is there some kind of barrier?)
>
Putting one of those asm hacks, or a memory fence intrinsic, between the two calls should do the trick. If it doesn't please file a bug with an example including the input code, the output code, and (preferably) what optimization is messing it up.
--Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091222/48335875/attachment.bin>
More information about the llvm-dev
mailing list