-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Should load/store be typed and have sext/zext/trunc? #82
Comments
On Tue, May 26, 2015 at 7:23 PM, JF Bastien notifications@github.com
|
IIUC, if we formalize validation as type checking (something that I think is attractive for multiple reasons), then we'd need special 1,2,4,8-byte types as the operands/result-types of load/store ops and the only other ops that would produce/consume these types would be the sext/zext/trunc ops. Thus, it doesn't seem like we'd be gaining much composability and, as a cost, we now have these irregular ops/types in our spec. We could identify the 4-byte int type with int32 and the 8-byte int type with int64, but that feels asymmetric (or pushes us to have int8/int16, something it seems noone is keen to do). So I don't see an elegance argument. Also, having irregular int8/int16 types could actually end up complicating a dumb compiler/interpreter, depending on how it was implemented. Lastly, I think it is a good goal to minimize the requisite number of "pattern matches assumed to be done by a baseline compiler to get good performance" to a minimum, and this would add several. |
If we have int8 and int16, then we should do this. If we don't, then we shouldn't. I think we can close this issue and move any further discussion to #85. |
Filing this issue to capture a discussion that occurred in PR #79.
load/store are often spec'd as having an explicit type, and as being able to implicitly
sext
/zext
/trunc
their inputs.I'm wondering if instead load/store should:
trunc
for stores, andsext
/zext
for loads.This is different from some compiler IRs, including LLVM's. However, the current stated goal for this format is to keep it simple, and expect the macro layer to capture redundancy. It seems like separating conversion, extension and truncation out of load/store fits the goal.
Keeping this simple doesn't prevent optimization. It's pretty easy to detect this pattern when doing instruction selection, if such an instruction even exists on the target architecture. It does mean the IR has lees magic, and is even easier to spec and implement in a dump interpreter.
The text was updated successfully, but these errors were encountered: