Annotation of researchv10no/cmd/sml/src/cps/cmachine.sig, revision 1.1

1.1     ! root        1: (* Copyright 1989 by AT&T Bell Laboratories *)
        !             2: signature CMACHINE = sig
        !             3: 
        !             4: type EA
        !             5: (* the following kinds of effective address are assumed:
        !             6:     register;
        !             7:     immediate label:  
        !             8:        This mode doesn't in fact exist on the Vax or the MC68020,
        !             9:         but it can be simulated (e.g. by "move address" instructions).
        !            10:     immediate integer literal;  *)
        !            11: 
        !            12: val immed : int -> EA          (* makes the immediate integer mode *)
        !            13: val isimmed : EA -> int option
        !            14: val isreg : EA -> int option
        !            15: val eqreg : EA -> EA -> bool
        !            16: 
        !            17: (* DEDICATED REGISTERS *)
        !            18: (* The following registers can hold pointers or properly tagged integers *)
        !            19: val exnptr : EA            (* the current exception-handler *)
        !            20: val storeptr : EA   (* the head of the store-list of modified words *)
        !            21: (* val dataptr : EA    the boundary between allocated and unused *)
        !            22: 
        !            23: (* The following registers may not hold pointers, and may hold untagged ints *)
        !            24: val arithtemp : EA
        !            25: val arithtemp2 : EA
        !            26: 
        !            27: (* The following registers are not dedicated, and must be all disjoint *)
        !            28: val standardclosure : EA
        !            29: val standardarg : EA
        !            30: val standardcont : EA
        !            31: val miscregs : EA list
        !            32: 
        !            33: val move : EA * EA -> unit  (* move(a,b)    a -> b *)
        !            34: 
        !            35: val align : unit -> unit  (* ensure that next code is on 4-byte boundary *)
        !            36: val mark: unit -> unit    (* insert a gc-tag in the code so that next address
        !            37:                             may be moved into a record *)
        !            38: val emitlong : int -> unit (* put an 4-byte integer literal into the code *)
        !            39: val realconst : string -> unit  (* put a floating literal into the code *)
        !            40: val emitstring : string -> unit (* put a literal string into the code
        !            41:                                   (just the chars, no descriptor or length) *)
        !            42: val emitlab : int * EA -> unit  (* L3: emitlab(k,L2) is equivalent to
        !            43:                                   L3: emitlong(k+L2-L3) *)
        !            44: 
        !            45: val newlabel : unit -> EA      (* create a new label (but don't define it) *)
        !            46: val define : EA -> unit  (* Associate a label with a point in the code *)
        !            47: 
        !            48: (* checkLimit (n):
        !            49:  * Generate code to check the heap limit to see if there is enough free space
        !            50:  * to allocate n bytes.
        !            51:  *)
        !            52: val checkLimit : int -> unit
        !            53: 
        !            54: (* beginStdFn (cl, lab):
        !            55:  * Note the beginning of a standard function with entry label lab, and
        !            56:  * register cl containing its closure.
        !            57:  *)
        !            58: val beginStdFn : (EA * EA) -> unit (* Mark beginning of standard function *)
        !            59: 
        !            60: val jmp : EA -> unit     (* unconditional jump to the address specified *)
        !            61: 
        !            62: val record : (EA * CPS.accesspath) list * EA -> unit
        !            63:                 (* makes a new record, puts address of it
        !            64:                    into the destination specified by the second arg.
        !            65:                    The contents are numbered from ~1 and up. *)
        !            66: 
        !            67: val select : int * EA * EA -> unit  (* select(i,x,y) = y <- mem[x+4*i] *)
        !            68: val offset : int * EA * EA -> unit  (* offset(i,x,y) = y <- x+4*i *)
        !            69: 
        !            70: val fetchindexb : EA * EA -> unit   (* fetchindexb(x,y) fetches a byte:
        !            71:                                        y <- mem[x+arithtemp]
        !            72:                                        y cannot be arithtemp *)
        !            73: val storeindexb : EA * EA -> unit   (* storeindexb(x,y) stores a byte:
        !            74:                                        mem[y+arithtemp] <- x; *)
        !            75: val jmpindexb : EA -> unit         (* jmpindexb(x)    pc <- (x+arithtemp) *)
        !            76: val fetchindexl : EA * EA * EA -> unit   (* fetchindexl(x,y,z) fetches a word:
        !            77:                                           y <- mem[x+2*(z-1)] *)
        !            78: val storeindexl : EA * EA * EA -> unit   (* storeindexl(x,y,z) stores a word:
        !            79:                                                mem[y+2*(z-1)] <- x *)
        !            80: 
        !            81: val ashl : EA * EA * EA -> unit  (* shift left: count, src, dest;
        !            82:                                     shift count is non-negative *)
        !            83: val ashr : EA * EA * EA -> unit  (* shift right: count, src, dest;
        !            84:                                     shift count is non-negative *)
        !            85:           
        !            86: val orb :  EA * EA * EA -> unit  (* bitwise or *)
        !            87: val andb :  EA * EA * EA -> unit  (* bitwise and *)
        !            88: val xorb :  EA * EA * EA -> unit  (* bitwise xor *)
        !            89: val notb :  EA * EA -> unit  (* bitwise complement *)
        !            90: 
        !            91: (* the following instructions are really just vax instructions *)
        !            92: val addl3 : EA * EA * EA -> unit
        !            93: val subl3 : EA * EA * EA -> unit       (* subl3(a,b,c):  c <- (b - a) *)
        !            94: 
        !            95: val divl2 : EA * EA -> unit            (* divl2(a,b):  b <- (b div a) *)
        !            96: 
        !            97: (* integer arithmetic with overflow trapping *)
        !            98: val addl3t : EA * EA * EA -> unit
        !            99: val subl3t : EA * EA * EA -> unit      (* subl3t(a,b,c):  c <- (b - a) *)
        !           100: val mull2t : EA * EA -> unit
        !           101: 
        !           102: val bbs          : EA * EA * EA -> unit
        !           103: 
        !           104: datatype condition = NEQ | EQL | LEQ | GEQ | LSS | GTR
        !           105: 
        !           106: (* ibranch (cond, a, b, lab):  pc <- lab if (a <cond> b). *)
        !           107: val ibranch : condition * EA * EA * EA -> unit
        !           108: 
        !           109: (* these are almost vax instructions, except that in each case
        !           110:    the EA's are the addresses of the operands, not the values *)
        !           111: val mnegg  : EA * EA -> unit
        !           112: val mulg3 : EA * EA * EA -> unit
        !           113: val divg3 : EA * EA * EA -> unit
        !           114: val addg3 : EA * EA * EA -> unit
        !           115: val subg3 : EA * EA * EA -> unit
        !           116: val gbranch : condition * EA * EA * EA -> unit
        !           117: 
        !           118: val profile : int * int -> unit
        !           119: val comment : string -> unit
        !           120: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.