(* * WARNING: This file was automatically generated by MDLGen (v3.0) * from the machine description file "mips/mips.mdl". * DO NOT EDIT this file directly *) functor MIPSRTLProps(structure Instr : MIPSINSTR structure RegionProps : REGION_PROPERTIES structure RTL : MLTREE_RTL structure OperandTable : OPERAND_TABLE where I = Instr structure Asm : INSTRUCTION_EMITTER where I = Instr sharing Instr.T = RTL.T ) : RTL_PROPERTIES = struct structure I = Instr structure C = I.C structure RTL = RTL structure T = RTL.T structure OT = OperandTable datatype value = CELL of C.cell | OPERAND of I.operand fun error msg = MLRiscErrorMsg.error("MIPSRTLProps",msg) fun bug(msg,instr) = let val Asm.S.STREAM{emit, ...} = Asm.makeStream [] in emit instr; error msg end structure MIPSRTL = MIPSRTL (structure RTL = RTL structure C = C ) structure Arch = struct local val TMP0 = {rt=T.PARAM 0, b=T.PARAM 1, d=T.PARAM 0, mem=T.PARAM 0} in val LB = RTL.new (MIPSRTL.LB TMP0) val LBU = RTL.new (MIPSRTL.LBU TMP0) val LH = RTL.new (MIPSRTL.LH TMP0) val LHU = RTL.new (MIPSRTL.LHU TMP0) val LW = RTL.new (MIPSRTL.LW TMP0) val LD = RTL.new (MIPSRTL.LD TMP0) end end fun rtl instr = let fun undefined() = bug("rtl",instr) fun query (I.LOAD{l, rt, b, d, mem}) = (case l of I.LD => Arch.LD | I.LW => Arch.LW | I.LH => Arch.LH | I.LHU => Arch.LHU | I.LB => Arch.LB | I.LBU => Arch.LBU | _ => undefined () ) | query _ = undefined () in query instr end fun defUse valueNumberingMethods instr = let fun undefined() = bug("defUse",instr) (* methods for computing value numbers *) val OT.VALUE_NUMBERING {int, int32, intinf, word, word32, operand, ...} = valueNumberingMethods (* methods for type conversion *) fun get_int(x,L) = CELL(int x)::L fun get_int32(x,L) = CELL(int32 x)::L fun get_intinf(x,L) = CELL(intinf x)::L fun get_word(x,L) = CELL(word x)::L fun get_word32(x,L) = CELL(word32 x)::L fun get_cell(x,L) = CELL x::L fun get_label(x,L) = L fun get_cellset(x,L) = map CELL (C.CellSet.toCellList x)@L fun get_operand(x,L) = OPERAND x::L fun get_int'(x) = [CELL(int x)] fun get_int32'(x) = [CELL(int32 x)] fun get_intinf'(x) = [CELL(intinf x)] fun get_word'(x) = [CELL(word x)] fun get_word32'(x) = [CELL(word32 x)] fun get_cell'(x) = [CELL x] fun get_label'(x) = [] fun get_cellset'(x) = map CELL (C.CellSet.toCellList x) fun get_operand'(x) = [OPERAND x] fun query (I.LOAD{l, rt, b, d, mem}) = (case l of (I.LD | I.LW | I.LH | I.LHU | I.LB | I.LBU) => (get_cell (rt, []), get_operand (d, get_cell (b, []))) | _ => undefined () ) | query _ = undefined () in query instr end end