[PATCH] D17782: [X86] Permit reading of the FLAGS register without it being previously defined

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 16:31:24 PST 2016


rnk added a comment.

In http://reviews.llvm.org/D17782#365909, @qcolombet wrote:

> Hi David,
>
> Looks to me like you have two different commits here:
>
> - The modifications of the read flags builtin
> - The undef of flags for push/pop instruction


Both changes are required to mollify the MI verifier, and they cannot be committed separately with tests.


================
Comment at: lib/Target/X86/X86InstrInfo.td:1130
@@ -1129,3 +1129,3 @@
 
-  let Uses = [RSP, EFLAGS] in
+  let Uses = [RSP] in
   def RDFLAGS64 : PseudoI<(outs GR64:$dst), (ins),
----------------
qcolombet wrote:
> It feels wrong to me that the builtin that reads the flags does *not* use the flags.
It does not use the flags in any sense that the register allocator should care about. We don't, and should not, support reading comparison flags produced by x86 arithmetic operations that we've selected.

This intrinsic exists to read external processor state in flags, such as the trap flag, interrupt flag, and direction flag, none of which are modeled by the backend.

I guess it would be good comment on that here, though. :)


http://reviews.llvm.org/D17782





More information about the llvm-commits mailing list