-
Notifications
You must be signed in to change notification settings - Fork 695
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
Add opcode name syntax for addressing #374
Conversation
I think this is pretty confusing in combination with the I'd also prefer that this and alignment are optional operands rather than part of the opcode for the reasons mentioned here. e.g. |
Agreed with @AndrewScheidecker. I had a similar conversation with @kg, and we agreed that something like LLVM's bitcode syntax was way easier to read. We can keep s-expressions while being readable. |
LLVM's bitcode doesn't have a syntax for extending loads, truncating stores, or constant offsets. Could you give an example? |
I'm not really interested in bikeshedding our syntax for our temporary s-expression syntax. I think the current strategy strikes a nice balance in allowing me to quickly write tests that aren't super verbose and I'm not eager to go rewrite everything. |
+1 to arguments such as an offset being separate from the opcode name, even for this 'throw-away' spec. If there were only a very few values that an option can take then it would not seem to be worth 'bike shedding' but it seems extreme to have separate opcodes for each offset which is effectively what is proposed. Adding the offset to the opcode name fails the test of 'being practical to dispatch on each unique opcode name'. A related issue is that if the offset is an argument then does it need to be a 'literal' node - is there a concept of atomic numbers as arguments? If adding atomic numbers as arguments then is there any need for 'literal' nodes that represent numbers, see #380 ? |
We're apparently never going to remove the
This is not sustainable. I think we need to simplify. Have a 'blessed path' pair of load/store opcodes that are simple, i.e. Everything we're shoving into random corners of the opcode name (or assigning new opcode names to) is just a compile-time parameter that specifies the exact nature of the load/store. It's possible that we will want to assign every combination its own globally unique opcode, but that is a binary encoding consideration. At every other stage in the pipeline, doing this adds pointless complexity. Loads and stores are a matrix of possibilities at this point because of the number of parameters, so we should just accept that and encode the matrix sensibly. |
Agreed with @kg that we're entering APL land with the textual representation of opcode. |
On 30 September 2015 at 05:51, Katelyn Gadd notifications@github.com
While I agree that the opcode names are getting uncomfortably complicated, It's a good idea to have a more visible and uniform separation between the |
On Wed, Sep 30, 2015 at 2:22 PM, rossberg-chromium <notifications@github.com
In the past I've been fond of the convention that static arguments to
|
I agree with @rossberg-chromium that it's useful to have immediates syntactically distinct from general subexpressions. @titzer braces look good to me too, but it seems like they are reserved puncutation in the proper s-expression language which we are ostensibly generating. It looks like
which looks pretty nice to me and is rather more symmetric with how the immediate of |
lgtm |
Looks great and addresses my concerns re offset/align. I'm okay with leaving the memory size and sign suffixes there as long as we address those two. Thanks. |
I like @lukewagner's suggestion on Small questions:
|
I think they should be order-independent, and we shouldn't allow duplicates. Allowing unknown fields seems like it would break our feature-detection principles and would potentially result in an old runtime executing new code with incorrect behavior. |
Preference for requiring the fields to be in a fixed order. If we're going to make the syntax this verbose, we should do what we can to make it easy for humans to find what they're looking for in it, so reducing needless variation helps -- not a lot, but on the other hand the burden on producers is minimal. |
In the s-expr format, it's definitely simpler to have fixed order, no duplicates. For the real TextFormat.md, I expect we'll have a wholly different syntax that of course isn't s-expr-based (e.g., for the offset, maybe we'll want some effective-address-looking syntax that resembles what people are used to in assembly languages). In fact, with the above changes agreed upon, this PR (for the design repo) changes to simply removing the existing para about the alignment syntax because alignment is no longer part of the opcode name and thus bears no mention in AstSemantics.md. |
877558a
to
4c24b66
Compare
New version lgtm. |
Syntax LGTM, but: On 1 October 2015 at 02:34, Luke Wagner notifications@github.com wrote:
|
@rossberg-chromium Because AstSemantics.md doesn't speak to text/binary encoding and our final text representation of load/store immediates will likely look much different than s-expr syntax. Perhaps it should have never been mentioned in AstSemantics.md in the first place, but I was thinking at the time that it would be kinda neat if the name (which included immediates) was actually the same between s-expr and the real text format. |
But regardless of syntax, shouldn't the AstSemantics somehow explain that
an optional alignment parameter goes with these opcodes?
|
@rossberg-chromium It does; this PR (which has been updated) just removes the specific syntactic detail of how alignment is appended to the opcode name. |
Ah, okay, I have been missing that. Sorry for the noise.
|
Add opcode name syntax for addressing
Cool, merging based on general lgtm. I can write the ml-proto PR. |
In preparation for adding linear memory addressing to ml-proto, we need an opcode name syntax. This PR is mostly symmetric with what was done for alignment in #342, except with a
+n
suffix.