Inline asm memory constraints can have the base or index register be assigned to %r0 right now.
Make sure that we assign only ADDR64 registers to the base and index.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
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.