[PATCH] x86 NaCl: Emit LAHF/SAHF instead of PUSHF/POPF

JF Bastien jfb at chromium.org
Thu Dec 11 14:58:54 PST 2014


Hi t.p.northover, jvoung,

NaCl's sandbox doesn't allow PUSHF/POPF out of security concerns (priviledged emulators have forgotten to mask system bits in the past, and EFLAGS's DF bit is a constant source of hilarity). Commit r220529 fixed PR20376 by saving cmpxchg's falgs result using EFLAGS, this commit now generated LAHF/SAHF instead of NaCl.

As with the previous patch this code generation is pretty bad because it occurs very later, after register allocation, and in many cases it rematerializes flags which were already available (e.g. already in a register through SETE). Fortunately it's somewhat rare that this code needs to fire.

http://reviews.llvm.org/D6629

Files:
  lib/Target/X86/X86InstrInfo.cpp
  test/CodeGen/X86/cmpxchg-clobber-flags.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6629.17195.patch
Type: text/x-patch
Size: 6306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141211/3a283ce1/attachment.bin>


More information about the llvm-commits mailing list