home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / sml_nj / 93src.lha / src / coder / machinstr.sig < prev   
Encoding:
Text File  |  1993-01-27  |  1.5 KB  |  62 lines

  1. (* machinstr.sig
  2.  *
  3.  * Copyright 1989 by AT&T Bell Laboratories
  4.  *
  5.  * This is an abstract interface to the machine instruction set.
  6.  *
  7.  * AUTHOR:  John Reppy
  8.  *        Cornell University
  9.  *        Ithaca, NY 14853
  10.  *        jhr@cs.cornell.edu
  11.  *)
  12.  
  13. signature MACHINSTR =
  14. sig
  15.     datatype 'label info = INFO of {addrOf: 'label -> int, 
  16.                     nameOf: 'label->string}
  17.  
  18.   (** Instructions **)
  19.  
  20.     type 'label instruction
  21.  
  22.     datatype ikind = IK_NOP | IK_JUMP | IK_INSTR
  23.  
  24.     val instrKind : 'label instruction -> ikind
  25.     val nop : 'label instruction
  26.     val latency : 'label instruction -> int
  27.  
  28.  
  29.   (** Span dependent instructions **)
  30.  
  31.     type 'label sdi
  32.  
  33.     val isSdiBranch: 'a sdi -> bool
  34.     val minSize : 'a sdi -> int
  35.     val sizeOf : 'label info -> ('label sdi * int) -> (bool * int)
  36.     (* sizeOf(I,loc) returns the size of I under the current address 
  37.      * assignment for labels plus true if the size if the maximum 
  38.      * possible for the sdi. 
  39.      *)
  40.     val expand : 'label info -> 
  41.          ('label sdi * int * int) -> 'label instruction list
  42.     (* expand (I, n, loc) returns the expansion of I into n bytes of machine
  43.      * instructions assuming location counter for I is loc. 
  44.      *)
  45.  
  46.   (** Resource usage **)
  47.  
  48.   (* 
  49.   ** Note: needsNop should not include branch instructions.
  50.   ** These are handled specially.
  51.   *)
  52.     val numResources : int
  53.     val rUseDef : 'a instruction -> (int list * int list)
  54.     val mayNeedNop : 'a instruction -> int
  55.     val needsNop : ('a instruction * 'a instruction list) -> int
  56.  
  57.   (** architecture **)
  58.     val branchDelayedArch : bool
  59.  
  60. end
  61.  
  62.