ApfV4GeneratorBase: special case handling of += *= /= &= |= <<= 0
Basic arithmetic:
+= 0 is a noop
*= 0 always results in a 0, and is thus equivalent to = 0
/= 0 is invalid, and thus always results in a pass
&= 0 always results in a 0, and is thus equivalent to = 0
|= 0 is a noop
<<= 0 is a noop
This will simplify upcoming code generation for APFv6,
as the current encoding of these useless instructions will
change from R0 ..= 0 to mean R0 {+,*,/,&,|,<<}= R1
Note: we could conceptually make the generator throw on 0 argument,
but that seems more annoying to actually implement (due to needing
to catch the exceptions) then this approach.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia7555e5ebeeaf0f9dfe725fcffabecfe36bbaf8c
1 file changed