[PATCH] D23367: [SystemZ] Use valid base/index registers for memory constraints

Zhan Jun Liau via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 10:14:54 PDT 2016


zhanjunl added a comment.

In https://reviews.llvm.org/D23367#518195, @uweigand wrote:

> Hmm, I guess that makes sense.  I'm wondering why most other targets don't have to do anything similar ...
>
> I am a bit concerned about the ISD::Register tests.  I assume this is to catch the case where no base and/or no index register are actually used; in those cases selectBDXAddr sets Base and/or Index to CurDAG->getRegister(0, VT).  In those cases, leaving this as-is is fine.  (Mentioning this in a comment would be good, though.)  However, can there be other instances of ISD::Register?  Can this e.g. be hard-coded by a user somehow?  What if there is a hard-coded register, which is *not* suitable for use in addressing?


I'm not sure of the other targets, but PowerPC has to do something similar because they have the same restrictions (r0 cannot be used in addresses).

My thinking is that if there's a hard coded register, then we should let it go through, flaws and all. So for the example of a user hard coding the register, we should be doing exactly what the user wants. If the user specifies r0 as the base/index register, then r0 should be what we use for that register, even if it's wrong. LLVM will throw an error when it detects that anyway.


https://reviews.llvm.org/D23367





More information about the llvm-commits mailing list