if_literal
This commit is contained in:
parent
0ce64f2ec4
commit
7bab15c64a
|
|
@ -237,9 +237,10 @@ language.
|
||||||
⟐([]) --> [].
|
⟐([]) --> [].
|
||||||
⟐([Term|Terms]) --> ⟐(Term), ⟐(Terms).
|
⟐([Term|Terms]) --> ⟐(Term), ⟐(Terms).
|
||||||
|
|
||||||
⟐(if_literal(Reg, Label)) --> % commands marked by setting high bit.
|
⟐(if_literal(Reg, Label)) -->
|
||||||
[and_imm(0, Reg, 0x8000), % 1 << 15
|
[ior_imm(0, Reg, -30), % get just the two tag bits.
|
||||||
eq_offset(Label)].
|
sub_imm(0, 0, 2), % subtract 2 to check if result is zero.
|
||||||
|
ne_offset(Label)].
|
||||||
|
|
||||||
% if reg = 0 jump to label.
|
% if reg = 0 jump to label.
|
||||||
⟐(if_zero(Reg, Label)) --> [sub_imm(Reg, Reg, 0), eq_offset(Label)].
|
⟐(if_zero(Reg, Label)) --> [sub_imm(Reg, Reg, 0), eq_offset(Label)].
|
||||||
|
|
|
||||||
|
|
@ -101,3 +101,9 @@ the offsets will always be negative (or positive). SInce it's easier to
|
||||||
deal with positive offsets and it's just as easy to allocate up as down,
|
deal with positive offsets and it's just as easy to allocate up as down,
|
||||||
I'm going to do that.
|
I'm going to do that.
|
||||||
|
|
||||||
|
|
||||||
|
Next, we must check if the term is a literal (not a symbol)
|
||||||
|
|
||||||
|
That involves rolling the value to get the top two bits and then checking
|
||||||
|
whether they are 10 or not.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue