Re:Rewrite Linux Kernel in Rust?
by tom_mellior on Sunday June 04, 2017 @06:02AM
(#14480618)
I've seen assembly languages that do separate target and source operands with an = sign. So you would write that something like:
and use a similar style for other things, like:
This is very nice and clear. But it only really works for three-address assembly languages, i.e., where the target register may be different from the sources. In classical x86, the target of an add is identical to one of the operands. So you would need something like
or
where you must duplicate a register. Presumably when these assembly languages were developed 40 years ago, this was perceived as too much syntax.
[ Parent
| on HN ]
> nice and clear
Looks absolutely horrible to me, why not simply
eax = ebx + ecx
?
Re:Rewrite Linux Kernel in Rust?
by tom_mellior on Sunday June 04, 2017 @05:21PM
(#14483577)
I guess because there's no simple infix operator for every operation implemented by the machine. Also, the addition may be floating-point or 32, 16, or 8 bit, signed or unsigned, possibly vectorized. An opcode is a good place to express these things.
Re:Rewrite Linux Kernel in Rust?
by throwaway-1209 on Sunday June 04, 2017 @06:46PM
(#14484090)
Opcodes are fine, no one is saying everything has to be expressed as an operator. I'd like to see more of a C/C++ intrinsics syntax, but with total control over the order of instructions and register allocation. Basically same power as assembly, syntax close to intrinsics, but you tell it which registers to use, and there's one instruction per line, and they're executed exactly as you write them, with no creativity on the part of the compiler.
Re:Rewrite Linux Kernel in Rust?
by throwaway-1209 on Sunday June 04, 2017 @02:42PM
(#14482833)
+1. Make it look more like a severely restricted version of C.