Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should cmovcc and fmovcc have dst as a src? #269

Closed
derekbruening opened this issue Nov 27, 2014 · 8 comments
Closed

should cmovcc and fmovcc have dst as a src? #269

derekbruening opened this issue Nov 27, 2014 · 8 comments

Comments

@derekbruening
Copy link
Contributor

From derek.br...@gmail.com on March 08, 2010 20:53:19

cmovcc in DR's IR lists the dst as a src, in order to avoid code analysis
from treating the dst as a def since it's not always written: not a perfect
solution but it can avoid special-casing by typical analysis code. should
I leave that in there or is it misleading? isn't it misleading to not have
it in there? should fcmovcc do the same (currently it does not have dst as
src)?

Original issue: http://code.google.com/p/dynamorio/issues/detail?id=269

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on June 06, 2013 18:02:26

xref issue #1181

Owner: ---

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on November 06, 2013 09:32:14

OP_getsec also has conditional writes to destinations due to its dynamic leaf functions. For now I'm listing these destinations as both sources and dests. Xref issue #1313 .

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on November 06, 2013 10:36:14

OP_xend also has a conditional write to eax, again being modeled as a source and dest.

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on November 08, 2013 15:09:39

OP_vpmaskmovd and OP_vpmaskmovd have memory store forms that conditionally write to memory, which is again modeled with the memory as both a source and a dest.

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on October 07, 2014 20:17:30

** TODO for arm 32-bit we have a lot of predication => first-class support

We're thinking that we'll add predication info to instr_t.prefixes, and add
instr_is_predicated(). We can back-port that to these handful of x86 instrs.

Should we remove the x86 dst-is-src trick we added to fool liveness analysis?
If we remove that, all analysis passes have to check the is_predicated() -- but
has to do that for arm anyway. Keep it there (just for x86) to avoid breaking
back-compat? It could mess up other analysis though, dst being listed as src.

Owner: bruen...@google.com

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on October 24, 2014 07:54:37

We plan to remove the dst-is-src.

But I'm still not sure what the best predication approach is for
instr_writes_to_reg() and other routines. Some use cases, like liveness
analysis, only want to know if it's written for sure. Others, like restoring
spilled values when sub-reg is written, want to know if it might be written. If
we keep it as "might write" then all callers doing liveness have to also check
predication. If we make it "definitely writes" then we have to add new routines
for _might_write. If we make it "definitely writes" what about all the other
routines like instr_reg_in_dst(), instr_writes_memory(), instr_zeroes_ymmh()?
We have to provide _might versions of all of these? It seems the smallest
change to the API is to keep them all "might write" and make the caller check
predication for liveness.

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on October 24, 2014 08:29:51

For composability of operations, and matching iteration, keeping it as "might
write" is best. But I agree that looking at bb_find_dead_reg() it seems best to
be "definitely write". There's no easy solution. I am leaning toward "might
write" and breaking back compat and changing all liveness code to check
predication.

And file an issue on removing all predication during mangling, under an option?
=> issue #1555 Ditto for eflags writing: only predicated on ARM, but should change all the
eflags liveness code too.

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2014 13:17:51

This issue was closed by revision r2914 .

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant