## rtl-build.api -- derived from ~/src/sml/nj/smlnj-110.58/new/new/src/MLRISC/mltree/rtl-build.sig
#
# How to build primitive RTL operators
# Compiled by:
#
src/lib/compiler/back/low/lib/rtl.libstipulate
package rkj = registerkinds_junk; # registerkinds_junk is from
src/lib/compiler/back/low/code/registerkinds-junk.pkg package tcp = treecode_pith; # treecode_pith is from
src/lib/compiler/back/low/treecode/treecode-pith.pkgherein
# This api is implemented in:
#
src/lib/compiler/back/low/treecode/rtl-build-g.pkg #
api Rtl_Build {
#
package tcf: Treecode_Form;
#
Type = tcf::Int_Bitsize; # "Int_Bitsize" was "ty" in SML/NJ.
Cond = tcf::Cond;
Fcond = tcf::Fcond;
Effect;
Region;
Expression;
Flag_Expression; # flag expressions handle zero/parity/overflow/... flag stuff.
Div_Rounding_Mode;
int_const: Type -> Int -> Expression; # Integer constant.
unt_const: Type -> one_word_unt::Unt -> Expression; # Unt constant.
??? : Type -> Expression; # An undefined value.
new_op: String -> List(Expression) -> Expression; # Create new operator.
immed: Type -> Expression -> Expression; # Immediate value.
operand: Type -> Expression -> Expression;
label: Type -> Expression -> Expression;
@@@ : (rkj::Registerkind, Type) -> Expression -> Expression; # @@@ was $ in SML/NJ.
mem : (rkj::Registerkind, Type) -> (Expression, Region) -> Expression;
arg : (Type, String, String) -> Expression;
# Signed/unsigned promotion:
#
sx: (Type, Type) -> Expression -> Expression;
zx: (Type, Type) -> Expression -> Expression;
# Integer operators
#
(-_) : Type -> Expression -> Expression;
+ : Type -> (Expression, Expression) -> Expression;
- : Type -> (Expression, Expression) -> Expression;
muls: Type -> (Expression, Expression) -> Expression;
mulu: Type -> (Expression, Expression) -> Expression;
#
divs: Type -> (Div_Rounding_Mode, Expression, Expression) -> Expression;
rems: Type -> (Div_Rounding_Mode, Expression, Expression) -> Expression;
divt: Type -> (Div_Rounding_Mode, Expression, Expression) -> Expression;
#
divu: Type -> (Expression, Expression) -> Expression;
remu: Type -> (Expression, Expression) -> Expression;
#
addt: Type -> (Expression, Expression) -> Expression;
subt: Type -> (Expression, Expression) -> Expression;
mult: Type -> (Expression, Expression) -> Expression;
#
bitwise_not: Type -> Expression -> Expression;
#
bitwise_and: Type -> (Expression, Expression) -> Expression;
bitwise_or: Type -> (Expression, Expression) -> Expression;
bitwise_xor: Type -> (Expression, Expression) -> Expression;
#
eqvb: Type -> (Expression, Expression) -> Expression;
<< : Type -> (Expression, Expression) -> Expression;
>> : Type -> (Expression, Expression) -> Expression;
>>> : Type -> (Expression, Expression) -> Expression;
bit_slice: Type -> List((Int, Int)) -> Expression -> Expression;
# Boolean operators
# my Cond: Type -> Flag_Expression * expression * expression -> expression
#
false: Flag_Expression;
true: Flag_Expression;
not': Flag_Expression -> Flag_Expression;
and': (Flag_Expression, Flag_Expression) -> Flag_Expression;
or': (Flag_Expression, Flag_Expression) -> Flag_Expression;
cond: Type -> (Flag_Expression, Expression, Expression) -> Expression;
# Integer comparisons
#
==== : Type -> (Expression, Expression) -> Flag_Expression;
<> : Type -> (Expression, Expression) -> Flag_Expression;
< : Type -> (Expression, Expression) -> Flag_Expression;
> : Type -> (Expression, Expression) -> Flag_Expression;
<= : Type -> (Expression, Expression) -> Flag_Expression;
>= : Type -> (Expression, Expression) -> Flag_Expression;
ltu: Type -> (Expression, Expression) -> Flag_Expression;
leu: Type -> (Expression, Expression) -> Flag_Expression;
gtu: Type -> (Expression, Expression) -> Flag_Expression;
geu: Type -> (Expression, Expression) -> Flag_Expression;
setcc: Type -> (Expression, Expression) -> Flag_Expression;
getcc: Type -> (Expression, tcf::Cond) -> Flag_Expression;
# Floating point operators
#
fadd: Type -> (Expression, Expression) -> Expression;
fsub: Type -> (Expression, Expression) -> Expression;
fmul: Type -> (Expression, Expression) -> Expression;
fdiv: Type -> (Expression, Expression) -> Expression;
fcopysign: Type -> (Expression, Expression) -> Expression;
#
fabs: Type -> Expression -> Expression;
fneg: Type -> Expression -> Expression;
fsqrt: Type -> Expression -> Expression;
# Floating point comparisons:
#
|?| : Type -> (Expression, Expression) -> Flag_Expression;
|====| : Type -> (Expression, Expression) -> Flag_Expression;
|?=| : Type -> (Expression, Expression) -> Flag_Expression;
|<| : Type -> (Expression, Expression) -> Flag_Expression;
|?<| : Type -> (Expression, Expression) -> Flag_Expression;
|<=| : Type -> (Expression, Expression) -> Flag_Expression;
|?<=| : Type -> (Expression, Expression) -> Flag_Expression;
|>| : Type -> (Expression, Expression) -> Flag_Expression;
|?>| : Type -> (Expression, Expression) -> Flag_Expression;
|>=| : Type -> (Expression, Expression) -> Flag_Expression;
|?>=| : Type -> (Expression, Expression) -> Flag_Expression;
|<>| : Type -> (Expression, Expression) -> Flag_Expression;
|<=>| : Type -> (Expression, Expression) -> Flag_Expression;
|?<>| : Type -> (Expression, Expression) -> Flag_Expression;
setfcc: Type -> (Expression, Expression) -> Flag_Expression;
getfcc: Type -> (Expression, tcf::Fcond) -> Flag_Expression;
# Effect combinators:
#
:= : Type -> (Expression, Expression) -> Effect;
par': (Effect, Effect) -> Effect; # Parallel effects.
nop': Effect; # Empty effect.
jmp': Type -> Expression -> Effect; # Jump to address.
call': Type -> Expression -> Effect; # Call address.
ret': Effect; # Return.
if': (Flag_Expression, Effect, Effect) -> Effect; # if/then/else.
map: Type -> (X -> Y) -> List(X) -> List(Y);
get_new_ops: Void -> List( tcp::Misc_Op );
clear_new_ops: Void -> Void;
};
end;