[PATCH] [x86 - inline asm] Favor reg over memory in asm w/ one input parameter

Gerolf Hoflehner ghoflehner at apple.com
Mon Apr 27 20:04:59 PDT 2015


Hi Eric

yes, there are more general ways of handling this, and for a single operand your suggestion improves on the implementation I currently have. Wrt to the more general solution it seems that it could result in  a problem - at least when implemented naively like for one operand at a time -  e.g. when an operand resides in a location needed by another one. This is indicated by a comment in ChooseConstraint()  " Ideally, we would pick the most specific constraint possible: if we have something that fits into a register, we would pick it.  The problem here is that if we have something that could either be in a register or in memory that use of the register could cause selection of *other* operands to fail: they might only succeed if we pick memory. ".
The most general route for handling this would be to enhance cg copy prop to handle  cases like vreg->mem etc. But that is more longer term and would be an overkill for the isolated instance at hand.
So I think I go ahead and add a location check to my current code. Would that stand a chance to pass your LGTM threshold?

Cheers
Gerolf


http://reviews.llvm.org/D9271

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list