home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Caml Light 0.61 / Source / src / compiler / prim_opc.ml < prev    next >
Encoding:
Text File  |  1993-09-24  |  1.1 KB  |  47 lines  |  [TEXT/MPS ]

  1. (* Opcodes for the simple primitives. *)
  2.  
  3. #open "misc";;
  4. #open "prim";;
  5. #open "opcodes";;
  6.  
  7. let opcode_for_primitive = function
  8.     Pupdate -> UPDATE
  9.   | Praise -> RAISE
  10.   | Pnot -> BOOLNOT
  11.   | Ptag_of -> TAGOF
  12.   | Pnegint -> NEGINT
  13.   | Psuccint -> SUCCINT
  14.   | Ppredint -> PREDINT
  15.   | Paddint -> ADDINT
  16.   | Psubint -> SUBINT
  17.   | Pmulint -> MULINT
  18.   | Pdivint -> DIVINT
  19.   | Pmodint -> MODINT
  20.   | Pandint -> ANDINT
  21.   | Porint -> ORINT
  22.   | Pxorint -> XORINT
  23.   | Pshiftleftint -> SHIFTLEFTINT
  24.   | Pshiftrightintsigned -> SHIFTRIGHTINTSIGNED
  25.   | Pshiftrightintunsigned -> SHIFTRIGHTINTUNSIGNED
  26.   | Pincr -> INCR
  27.   | Pdecr -> DECR
  28.   | Pintoffloat -> INTOFFLOAT
  29.   | Pstringlength -> STRINGLENGTH
  30.   | Pgetstringchar -> GETSTRINGCHAR
  31.   | Psetstringchar -> SETSTRINGCHAR
  32.   | Pmakevector -> MAKEVECTOR
  33.   | Pvectlength -> VECTLENGTH
  34.   | Pgetvectitem -> GETVECTITEM
  35.   | Psetvectitem -> SETVECTITEM
  36.   | _ -> fatal_error "opcode_for_primitive"
  37. ;;
  38.  
  39. let opcode_for_float_primitive = function
  40.     Pfloatofint -> FLOATOFINT
  41.   | Pnegfloat -> NEGFLOAT
  42.   | Paddfloat -> ADDFLOAT
  43.   | Psubfloat -> SUBFLOAT
  44.   | Pmulfloat -> MULFLOAT
  45.   | Pdivfloat -> DIVFLOAT
  46. ;;
  47.