<<>> <> <> <> <<>> <> <> <> <> <<>> DIRECTORY TargetArchitecture, RS6000Architecture, RuntimeError; RS6000ArchitectureImpl: CEDAR PROGRAM IMPORTS TargetArchitecture, RS6000Architecture, RuntimeError EXPORTS RS6000Architecture ~ { <> Ai: PUBLIC PROCEDURE [ rt: RS6000Architecture.Register, ra: RS6000Architecture.Register, si: RS6000Architecture.SI] RETURNS [RS6000Architecture.RS6000Instruction] ~ { format2rsi: RS6000Architecture.Format2rsi ~ [ op: RS6000Architecture.Op.ai, rt: rt, ra: ra, si: si]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[format2rsi]; RETURN [instruction]; }; B: PUBLIC PROCEDURE [ pc: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address, abs, link: BOOLEAN] RETURNS [RS6000Architecture.RS6000Instruction] ~ { displacement: TargetArchitecture.Displacement ~ RS6000Architecture.DisplacementFromRS6000Addresses[here: pc, there: to]; instruction: RS6000Architecture.RS6000Instruction _ RS6000Architecture.nullRS6000Instruction; IF pc.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; IF to.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; IF displacement NOT IN [RS6000Architecture.firstOffset26 .. RS6000Architecture.lastOffset26] THEN { ERROR RS6000Architecture.CantReach; }; { disp24: RS6000Architecture.Disp24 ~ displacement / BYTES[RS6000Architecture.RS6000Instruction]; msb: BOOLEAN ~ disp24 IN [RS6000Architecture.firstDisp24..0]; disp23: RS6000Architecture.Disp23 ~ IF msb THEN disp24 - RS6000Architecture.firstDisp24 ELSE disp24; formatBranch: RS6000Architecture.FormatBranch ~ [ op: RS6000Architecture.Op.b, limsb: msb, li: disp23, aa: abs, lk: link ]; instruction _ LOOPHOLE[formatBranch]; }; RETURN [instruction]; }; Brl: PUBLIC PROCEDURE [] RETURNS [RS6000Architecture.RS6000Instruction]~ { formatBOnCondCount: RS6000Architecture.FormatBOnCondCount ~ [ op: RS6000Architecture.Op.group19, bo: [TRUE, FALSE, TRUE, FALSE, FALSE], bi: 0, subOp: RS6000Architecture.SubOpFor19.bcr, lk: FALSE ]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatBOnCondCount]; RETURN [instruction]; }; Bctr: PUBLIC PROCEDURE [] RETURNS [RS6000Architecture.RS6000Instruction]~ { formatBOnCondCount: RS6000Architecture.FormatBOnCondCount ~ [ op: RS6000Architecture.Op.group19, bo: [TRUE, FALSE, TRUE, FALSE, FALSE], bi: 0, subOp: RS6000Architecture.SubOpFor19.bcc, lk: FALSE ]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatBOnCondCount]; RETURN [instruction]; }; Cror: PUBLIC PROCEDURE [bt: RS6000Architecture.CCBitPosition, ba: RS6000Architecture.CCBitPosition, bb: RS6000Architecture.CCBitPosition, lk: BOOLEAN] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatCondRegAnd: RS6000Architecture.FormatCondRegAnd ~ [ op: RS6000Architecture.Op.group19, bt: bt, ba: ba, bb: bb, subOp: RS6000Architecture.SubOpFor19.cror, lk: lk]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatCondRegAnd]; RETURN [instruction]; }; L: PUBLIC PROCEDURE [rt: RS6000Architecture.Register, offset: RS6000Architecture.Disp16, ra: RS6000Architecture.Register] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoad: RS6000Architecture.FormatLoad ~ [ op: RS6000Architecture.Op.l, rt: rt, ra: ra, d: offset]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoad]; RETURN [instruction]; }; Lil: PUBLIC PROCEDURE [rt: RS6000Architecture.Register, low: RS6000Architecture.SI] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoadi: RS6000Architecture.FormatLoadi ~ [op: RS6000Architecture.Op.cal, rt: rt, zero: 0, si: low]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoadi]; RETURN [instruction]; }; Liu: PUBLIC PROCEDURE [rt: RS6000Architecture.Register, upper: RS6000Architecture.UI] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoadui: RS6000Architecture.FormatLoadui ~ [op: RS6000Architecture.Op.cau, rt: rt, zero: 0, ui: upper]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoadui]; RETURN [instruction]; }; Lm: PUBLIC PROCEDURE [rt: RS6000Architecture.Register, offset: RS6000Architecture.Disp16, ra: RS6000Architecture.Register] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoad: RS6000Architecture.FormatLoad ~ [ op: RS6000Architecture.Op.lm, rt: rt, ra: ra, d: offset]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoad]; RETURN [instruction]; }; Mfspr: PUBLIC PROCEDURE [rt: RS6000Architecture.Register, spr: RS6000Architecture.SpecialRegister, rc: BOOLEAN] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatMoveSPR: RS6000Architecture.FormatMoveSPR ~ [ op: RS6000Architecture.Op.group31, rt: rt, spr: spr, subOp: RS6000Architecture.SubOpFor31withoutOE.mfspr, rc: rc]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatMoveSPR]; RETURN [instruction]; }; Mtspr: PUBLIC PROCEDURE [rt: RS6000Architecture.Register, spr: RS6000Architecture.SpecialRegister, rc: BOOLEAN] RETURNS [RS6000Architecture.RS6000Instruction]~ { formatMoveSPR: RS6000Architecture.FormatMoveSPR ~ [ op: RS6000Architecture.Op.group31, rt: rt, spr: spr, subOp: RS6000Architecture.SubOpFor31withoutOE.mtspr, rc: rc]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatMoveSPR]; RETURN [instruction]; }; Mfcr: PUBLIC PROCEDURE [rs: RS6000Architecture.Register, rc: BOOLEAN] RETURNS [RS6000Architecture.RS6000Instruction]~ { formatMoveFromCR: RS6000Architecture.FormatMoveFromCR ~ [ op: RS6000Architecture.Op.group31, rt: rs, subOp: RS6000Architecture.SubOpFor31withoutOE.mfcr, rc: rc]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatMoveFromCR]; RETURN [instruction]; }; Mtcrf: PUBLIC PROCEDURE [fxm: RS6000Architecture.FXM, rs: RS6000Architecture.Register, rc: BOOLEAN] RETURNS [RS6000Architecture.RS6000Instruction]~ { formatMoveToCRField: RS6000Architecture.FormatMoveToCRField ~ [ op: RS6000Architecture.Op.group31, rs: rs, fxm: fxm, subOp: RS6000Architecture.SubOpFor31withoutOE.mtcrf, rc: rc]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatMoveToCRField]; RETURN [instruction]; }; Noop: PUBLIC PROCEDURE [] RETURNS [RS6000Architecture.RS6000Instruction] ~ { <> formatMask: RS6000Architecture.FormatMask ~ [ op: RS6000Architecture.Op.group31, rs: RS6000Architecture.Register.gpr0, ra: RS6000Architecture.Register.gpr0, rb: RS6000Architecture.Register.gpr0, subOp: RS6000Architecture.SubOpFor31withoutOE.or, rc: FALSE ]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatMask]; RETURN [instruction]; }; OrLConst: PUBLIC PROCEDURE [ ra: RS6000Architecture.Register, rs: RS6000Architecture.Register, ui: RS6000Architecture.UI] RETURNS [RS6000Architecture.RS6000Instruction] ~ { format2rui: RS6000Architecture.Format2rui ~ [ op: RS6000Architecture.Op.oril, rt: rs, ra: ra, ui: ui]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[format2rui]; RETURN [instruction]; }; OrUConst: PUBLIC PROCEDURE [ ra: RS6000Architecture.Register, rs: RS6000Architecture.Register, ui: RS6000Architecture.UI] RETURNS [RS6000Architecture.RS6000Instruction] ~ { format2rui: RS6000Architecture.Format2rui ~ [ op: RS6000Architecture.Op.oril, rt: rs, ra: ra, ui: ui]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[format2rui]; RETURN [instruction]; }; St: PUBLIC PROCEDURE [rs: RS6000Architecture.Register, offset: RS6000Architecture.Disp16, ra: RS6000Architecture.Register] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoad: RS6000Architecture.FormatLoad ~ [ op: RS6000Architecture.Op.st, rt: rs, ra: ra, d: offset]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoad]; RETURN [instruction]; }; Stm: PUBLIC PROCEDURE [rs: RS6000Architecture.Register, offset: RS6000Architecture.Disp16, ra: RS6000Architecture.Register] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoad: RS6000Architecture.FormatLoad ~ [ op: RS6000Architecture.Op.stm, rt: rs, ra: ra, d: offset]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoad]; RETURN [instruction]; }; Stu: PUBLIC PROCEDURE [rs: RS6000Architecture.Register, offset: RS6000Architecture.Disp16, ra: RS6000Architecture.Register] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatLoad: RS6000Architecture.FormatLoad ~ [ op: RS6000Architecture.Op.stu, rt: rs, ra: ra, d: offset]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[formatLoad]; RETURN [instruction]; }; Si: PUBLIC PROCEDURE [ rt: RS6000Architecture.Register, ra: RS6000Architecture.Register, si: RS6000Architecture.SI] RETURNS [RS6000Architecture.RS6000Instruction] ~ { format2rsi: RS6000Architecture.Format2rsi ~ [ op: RS6000Architecture.Op.ai, rt: rt, ra: ra, si: -si]; instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[format2rsi]; RETURN [instruction]; }; Relocate: PUBLIC PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, from: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Instruction] ~ { <> <<>> relocated: RS6000Architecture.RS6000Instruction _ instruction; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; IF from.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; IF to.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; SELECT instruction.GetOp[] FROM RS6000Architecture.Op.dozi => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.cmpli => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.cmpi => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.ai => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.aiDot => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.cal => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.cau => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.bc => {relocated _ DoRelocateForBranch16bits[instruction, from, to];}; RS6000Architecture.Op.b => {relocated _ DoRelocateForBranch26bits[instruction, from, to];}; RS6000Architecture.Op.group19 => {relocated _ RelocateGroup19[instruction, from, to];}; RS6000Architecture.Op.rlimi => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.rlinm => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.rlmi => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.rlnm => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.oril => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.oriu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.xoril => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.xoriu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.andil => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.andiu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.group31 => {relocated _ RelocateGroup31[instruction, from, to];}; RS6000Architecture.Op.l => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lbz => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lbzu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.st => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stb => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lhz => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lhzu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lha => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lhau => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.sth => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lm => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stm => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lfs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lfsu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lfd => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.lfdu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stfs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stfsu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stfd => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.stfdu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.Op.group63 => {relocated _ RelocateGroup63[instruction, from, to];}; ENDCASE => {ERROR;}; RETURN [relocated]; }; RelocateGroup19: PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, from: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Instruction] ~ { <> <<>> relocated: RS6000Architecture.RS6000Instruction _ instruction; SELECT instruction.GetSubOp19[] FROM RS6000Architecture.SubOpFor19.mcrf => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.bcr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.crnor => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.crandc => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.crxor => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.crnand => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.crand => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.creqv => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.crorc => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.cror => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor19.bcc => {relocated _ NoRelocate[instruction];}; ENDCASE => {ERROR;}; RETURN [relocated]; }; RelocateGroup31: PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, from: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Instruction] ~ { <> <<>> relocated: RS6000Architecture.RS6000Instruction _ instruction; SELECT instruction.GetSubOp31withoutOE[] FROM RS6000Architecture.SubOpFor31withoutOE.cmp => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.t => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.mfcr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sl => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.cntlz => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.and => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.maskg => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.cmpl => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.andc => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.mfmsr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lbzx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lbzux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.nor => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.mtcrf => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.slq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sle => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sliq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stbx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sllq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sleq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stbux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.slliq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lscbx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lhzx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lhzux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.xor => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.mfspr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lhax => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lhaux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sthx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.orc => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sthux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.or => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.mtspr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.nand => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.mcrxr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lsx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lbrx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lfsx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.rrib => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.maskir => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lfsux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lsi => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lfdx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lfdux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stsx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stbrx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stfsx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.srq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sre => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stfsux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sriq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stfdx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.srlq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sreq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.stfdux => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.srliq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.lhbrx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sra => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.srai => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sthbrx => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sraq => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.srea => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withoutOE.sraiq => {relocated _ NoRelocate[instruction];}; ENDCASE => { SELECT instruction.GetSubOp31withOE[] FROM RS6000Architecture.SubOpFor31withOE.sf => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.a => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.mul => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.sfe => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.ae => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.sfze => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.aze => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.sfme => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.me => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.muls => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.doz => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.cax => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.eqv => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.adiv => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.abs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.divs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.SubOpFor31withOE.nabs => {relocated _ NoRelocate[instruction];}; ENDCASE => {ERROR;}; }; RETURN [relocated]; }; RelocateGroup63: PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, from: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Instruction] ~ { <> <<>> relocated: RS6000Architecture.RS6000Instruction _ instruction; SELECT instruction.GetSubOp3r63[] FROM RS6000Architecture.FSubOp3r63.fd => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fa => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fm => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fms => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fma => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fnms => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp3r63.fnma => {relocated _ NoRelocate[instruction];}; ENDCASE => { SELECT instruction.GetSubOp2r63[] FROM RS6000Architecture.FSubOp2r63.fcmpu => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.frsp => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.fcmpo => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.mtfsb1 => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.fneg => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.mcrfs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.mtfsb0 => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.fmr => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.mtfsfi => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.fnabs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.fabs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.mffs => {relocated _ NoRelocate[instruction];}; RS6000Architecture.FSubOp2r63.mtfsf => {relocated _ NoRelocate[instruction];}; ENDCASE => {ERROR;}; }; RETURN [relocated]; }; NoRelocate: PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.RS6000Instruction] ~ { RETURN [instruction]; }; DoRelocateForBranch16bits: PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, from: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Instruction] ~ { relocated: RS6000Architecture.RS6000Instruction _ instruction; instructionDisp14: RS6000Architecture.Disp14 ~ instruction.GetDisp14[]; byteDisplacement: TargetArchitecture.Displacement ~ instructionDisp14 * BYTES[RS6000Architecture.RS6000Instruction]; targetAddress: RS6000Architecture.RS6000Address ~ RS6000Architecture.RS6000AddressFromDisplacement[ address: from, displacement: byteDisplacement]; relocationDisplacement: TargetArchitecture.Displacement ~ RS6000Architecture.DisplacementFromRS6000Addresses[here: to, there: targetAddress]; relocationDisp14: RS6000Architecture.Disp14 ~ relocationDisplacement / BYTES[RS6000Architecture.RS6000Instruction]; IF relocationDisp14 NOT IN [RS6000Architecture.firstDisp14..RS6000Architecture.lastDisp14] THEN { ERROR RS6000Architecture.CantRelocate; }; IF relocationDisplacement MOD BYTES[RS6000Architecture.RS6000Instruction] # 0 THEN { ERROR RS6000Architecture.CantRelocate; }; relocated _ instruction.SetDisp14[disp14: relocationDisp14]; RETURN [relocated]; }; DoRelocateForBranch26bits: PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, from: RS6000Architecture.RS6000Address, to: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Instruction] ~ { relocated: RS6000Architecture.RS6000Instruction _ instruction; instructionDisp24: RS6000Architecture.Disp24 ~ instruction.GetDisp24[]; byteDisplacement: TargetArchitecture.Displacement ~ instructionDisp24 * BYTES[RS6000Architecture.RS6000Instruction]; targetAddress: RS6000Architecture.RS6000Address ~ RS6000Architecture.RS6000AddressFromDisplacement[ address: from, displacement: byteDisplacement]; relocationDisplacement: TargetArchitecture.Displacement ~ RS6000Architecture.DisplacementFromRS6000Addresses[here: to, there: targetAddress]; relocationDisp24: RS6000Architecture.Disp24 ~ relocationDisplacement / BYTES[RS6000Architecture.RS6000Instruction]; IF relocationDisp24 NOT IN [RS6000Architecture.firstDisp24..RS6000Architecture.lastDisp24] THEN { ERROR RS6000Architecture.CantRelocate; }; IF relocationDisplacement MOD BYTES[RS6000Architecture.RS6000Instruction] # 0 THEN { ERROR RS6000Architecture.CantRelocate; }; relocated _ instruction.SetDisp24[disp24: relocationDisp24]; RETURN [instruction]; }; <> <> <> <<>> <> <> <<};>> <> <> <<};>> <> <> <<};>> <> <> <> < {>> <> <> <> <> <> <> <> <> <> <> <<[here: to, there: targetAddress];>> <> <> <<>> <> <> <<};>> <> <> <<};>> <> <> <<};>> <<>> <> <<};>> < {>> <> <<};>> <<};>> < {>> <> <> <> <> <> <> <> <> <> <> <<[here: to, there: targetAddress];>> <> <> <<>> <> <> <<};>> <> <> <<};>> <> <> <<};>> <<>> <> <<};>> < {>> <> <<};>> < {>> <> <<};>> < ERROR;>> <> <<};>> <> noopInstruction: RS6000Architecture.RS6000Instruction ~ RS6000Architecture.Noop[]; <> IsNoopInstruction: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [BOOLEAN] ~ { <> isNoopInstruction: BOOLEAN ~ instruction = noopInstruction; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [isNoopInstruction]; }; <<>> <> <> <> <<>> <> <> <<};>> <> <> <> < {>> <> <<};>> < {>> <> <<};>> <<};>> < {>> <> <<};>> < {>> <> <<};>> < {>> <> <<};>> < ERROR;>> <> <<};>> <> <> <> <<>> <> <> <<};>> <> < RS6000Architecture.Format.format2,>> < RS6000Architecture.Format.format1,>> < RS6000Architecture.Format.format2,>> < RS6000Architecture.Format.format3,>> < ERROR;>> <<>> <> <> <<};>> <> <<};>> GetOp: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.Op] ~ { formatGeneric: RS6000Architecture.Format3rArith ~ LOOPHOLE[instruction]; op: RS6000Architecture.Op ~ formatGeneric.op; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [op]; }; GetSubOp19: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.SubOpFor19] ~ { formatGeneric: RS6000Architecture.FormatCondRegAnd ~ LOOPHOLE[instruction]; subOp: RS6000Architecture.SubOpFor19 ~ formatGeneric.subOp; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [subOp]; }; GetSubOp31withoutOE: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.SubOpFor31withoutOE] ~ { formatGeneric: RS6000Architecture.FormatCmp ~ LOOPHOLE[instruction]; subOp: RS6000Architecture.SubOpFor31withoutOE ~ formatGeneric.subOp; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [subOp]; }; GetSubOp31withOE: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.SubOpFor31withOE] ~ { formatGeneric: RS6000Architecture.Format2rArith ~ LOOPHOLE[instruction]; subOp: RS6000Architecture.SubOpFor31withOE ~ formatGeneric.subOp; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [subOp]; }; GetSubOp3r63: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.FSubOp3r63] ~ { formatGeneric: RS6000Architecture.FormatFl3rArith ~ LOOPHOLE[instruction]; subOp: RS6000Architecture.FSubOp3r63 ~ formatGeneric.subOp; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [subOp]; }; GetSubOp2r63: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.FSubOp2r63] ~ { formatGeneric: RS6000Architecture.FormatFl2rArith ~ LOOPHOLE[instruction]; subOp: RS6000Architecture.FSubOp2r63 ~ formatGeneric.subOp; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [subOp]; }; GetDisp14: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.Disp14] ~ { formatBOnCond: RS6000Architecture.FormatBOnCond ~ LOOPHOLE[instruction]; disp14: RS6000Architecture.Disp14 ~ IF formatBOnCond.bdmsb THEN formatBOnCond.bd + RS6000Architecture.firstDisp14 ELSE formatBOnCond.bd; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [disp14]; }; GetDisp24: PUBLIC PROCEDURE [instruction: RS6000Architecture.RS6000Instruction] RETURNS [RS6000Architecture.Disp24] ~ { formatBranch: RS6000Architecture.FormatBranch ~ LOOPHOLE[instruction]; disp24: RS6000Architecture.Disp24 ~ IF formatBranch.limsb THEN formatBranch.li + RS6000Architecture.firstDisp24 ELSE formatBranch.li; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [disp24]; }; <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <<(registerMS * (LAST[RS6000Architecture.RegisterLS] + 1)) + registerLS>> <<];>> <<>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<};>> <> <> <> <<};>> <<>> <> <> <<(unbiased30MS * (CARD32[LAST[RS6000Architecture.Unbiased30LS]] + 1)) >> <<+ unbiased30LS;>> <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <<(unbiased22MS * (CARD32[LAST[RS6000Architecture.Unbiased22LS]] + 1)) >> <<+ unbiased22LS;>> <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <<(imm22MS * (CARD32[LAST[RS6000Architecture.Imm22LS]] + 1)) + imm22LS;>> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <<};>> <<>> High: PUBLIC PROCEDURE [value: CARD32] RETURNS [RS6000Architecture.UI] ~ { hi: RS6000Architecture.UI ~ value / (LAST[CARD16] + 1); RETURN [hi]; }; Low: PUBLIC PROCEDURE [value: CARD32] RETURNS [RS6000Architecture.UI] ~ { lo: RS6000Architecture.SI ~ value MOD (LAST[CARD16] + 1); RETURN [lo]; }; <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <> <<};>> <> SetOp: PUBLIC PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, op: RS6000Architecture.Op] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatGeneric: RS6000Architecture.Format3rArith _ LOOPHOLE[instruction]; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; formatGeneric.op _ op; RETURN [LOOPHOLE[formatGeneric]]; }; SetDisp14: PUBLIC PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, disp14: RS6000Architecture.Disp14] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatBOnCond: RS6000Architecture.FormatBOnCond _ LOOPHOLE[instruction]; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; IF disp14 NOT IN [RS6000Architecture.firstDisp14 ..RS6000Architecture.lastDisp14] THEN { ERROR RuntimeError.BoundsFault; }; formatBOnCond.bdmsb _ disp14 IN [RS6000Architecture.firstDisp14..0]; formatBOnCond.bd _ IF formatBOnCond.bdmsb THEN disp14 - RS6000Architecture.firstDisp14 ELSE disp14; RETURN [LOOPHOLE[formatBOnCond]]; }; SetDisp24: PUBLIC PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction, disp24: RS6000Architecture.Disp24] RETURNS [RS6000Architecture.RS6000Instruction] ~ { formatBranch: RS6000Architecture.FormatBranch _ LOOPHOLE[instruction]; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; IF disp24 NOT IN [RS6000Architecture.firstDisp24 ..RS6000Architecture.lastDisp24] THEN { ERROR RuntimeError.BoundsFault; }; formatBranch.limsb _ disp24 IN [RS6000Architecture.firstDisp24..0]; formatBranch.li _ IF formatBranch.limsb THEN disp24 - RS6000Architecture.firstDisp24 ELSE disp24; RETURN [LOOPHOLE[formatBranch]]; }; <> <> <<>> <> <> <<};>> <> <> <<};>> <> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <> <<};>> <<>> <> <> <> <<>> <> <<};>> <<>> <> <> <> <<>> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <<>> <> <> <<};>> <> <> <<};>> <<>> <> <> <> <<};>> <> <> <> <<};>> <<>> <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <<};>> <<>> <> <> <> <> <> <<>> <> <<};>> <<>> <> <> <> <<>> <> <<};>> <<>> <> <> <> <<>> <> <<};>> <<>> <> <> <> <= 0>> <> <> <<>> <> <<};>> <> IsNullRS6000Address: PUBLIC PROCEDURE [address: RS6000Architecture.RS6000Address] RETURNS [BOOLEAN] ~ { <> isNullRS6000Address: BOOLEAN ~ address = RS6000Architecture.nullRS6000Address; RETURN [isNullRS6000Address]; }; <<>> RS6000AddressFromDisplacement: PUBLIC PROCEDURE [ address: RS6000Architecture.RS6000Address, displacement: TargetArchitecture.Displacement] RETURNS [RS6000Architecture.RS6000Address] ~ { targetAddress: TargetArchitecture.Address ~ RS6000Architecture.TargetAddressFromRS6000Address[rs6000Address: address]; displaced: TargetArchitecture.Address ~ TargetArchitecture.AddressFromDisplacement[ address: targetAddress, displacement: displacement]; rs6000Displaced: RS6000Architecture.RS6000Address ~ RS6000Architecture.RS6000AddressFromTargetAddress[address: displaced]; IF address.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; RETURN [rs6000Displaced]; }; DisplacementFromRS6000Addresses: PUBLIC PROCEDURE [ here: RS6000Architecture.RS6000Address, there: RS6000Architecture.RS6000Address] RETURNS [TargetArchitecture.Displacement] ~ { hereTarget: TargetArchitecture.Address ~ RS6000Architecture.TargetAddressFromRS6000Address[rs6000Address: here]; thereTarget: TargetArchitecture.Address ~ RS6000Architecture.TargetAddressFromRS6000Address[rs6000Address: there]; displacement: TargetArchitecture.Displacement ~ TargetArchitecture.DisplacementFromAddresses[ here: hereTarget, there: thereTarget]; IF here.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; IF there.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; RETURN [displacement]; }; IsNullRS6000Instruction: PUBLIC PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction] RETURNS [BOOLEAN] ~ { <> isNullRS6000Instruction: BOOLEAN ~ instruction = RS6000Architecture.nullRS6000Instruction; RETURN [isNullRS6000Instruction]; }; <<>> NextRS6000Instruction: PUBLIC PROCEDURE [pc: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Address] ~ TRUSTED { <> targetPC: TargetArchitecture.Address ~ RS6000Architecture.TargetAddressFromRS6000Address[rs6000Address: pc]; nextInstruction: TargetArchitecture.Address ~ TargetArchitecture.NextInstruction[pc: targetPC]; nextRS6000Instruction: RS6000Architecture.RS6000Address ~ RS6000Architecture.RS6000AddressFromTargetAddress[address: nextInstruction]; IF pc.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; RETURN [nextRS6000Instruction]; }; PrevRS6000Instruction: PUBLIC PROCEDURE [pc: RS6000Architecture.RS6000Address] RETURNS [RS6000Architecture.RS6000Address] ~ { <> <> targetPC: TargetArchitecture.Address ~ RS6000Architecture.TargetAddressFromRS6000Address[rs6000Address: pc]; prevInstruction: TargetArchitecture.Address ~ TargetArchitecture.PrevInstruction[pc: targetPC]; prevRS6000Instruction: RS6000Architecture.RS6000Address ~ RS6000Architecture.RS6000AddressFromTargetAddress[address: prevInstruction]; IF pc.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; RETURN [prevRS6000Instruction]; }; RS6000AddressFromTargetAddress: PUBLIC PROCEDURE [ address: TargetArchitecture.Address] RETURNS [RS6000Architecture.RS6000Address] ~ { rs6000Address: RS6000Architecture.RS6000Address ~ LOOPHOLE[address]; IF rs6000Address.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; RETURN [rs6000Address]; }; TargetAddressFromRS6000Address: PUBLIC PROCEDURE [ rs6000Address: RS6000Architecture.RS6000Address] RETURNS [TargetArchitecture.Address] ~ { address: TargetArchitecture.Address ~ LOOPHOLE[rs6000Address]; IF rs6000Address.IsNullRS6000Address[] THEN { ERROR RS6000Architecture.NullRS6000Address; }; RETURN [address]; }; RS6000ContentsFromTargetContents: PUBLIC PROCEDURE [ contents: TargetArchitecture.Contents] RETURNS [RS6000Architecture.RS6000Contents] ~ { rs6000Contents: RS6000Architecture.RS6000Contents ~ LOOPHOLE[contents]; RETURN [rs6000Contents]; }; TargetContentsFromRS6000Contents: PUBLIC PROCEDURE [ contents: RS6000Architecture.RS6000Contents] RETURNS [TargetArchitecture.Contents] ~ { targetContents: TargetArchitecture.Contents ~ LOOPHOLE[contents]; RETURN [targetContents]; }; RS6000InstructionFromTargetInstruction: PUBLIC PROCEDURE [ instruction: TargetArchitecture.Instruction] RETURNS [RS6000Architecture.RS6000Instruction] ~ { rs6000Instruction: RS6000Architecture.RS6000Instruction ~ LOOPHOLE[instruction]; IF rs6000Instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [rs6000Instruction]; }; TargetInstructionFromRS6000Instruction: PUBLIC PROCEDURE [ instruction: RS6000Architecture.RS6000Instruction] RETURNS [TargetArchitecture.Instruction] ~ { targetInstruction: TargetArchitecture.Instruction ~ LOOPHOLE[instruction]; IF instruction.IsNullRS6000Instruction[] THEN { ERROR RS6000Architecture.NullRS6000Instruction; }; RETURN [targetInstruction]; }; RS6000RegisterClassFromTargetRegisterClass: PUBLIC PROCEDURE [ registerClass: TargetArchitecture.RegisterClass] RETURNS [RS6000Architecture.RegisterClass] ~ { rs6000RegisterClass: RS6000Architecture.RegisterClass ~ LOOPHOLE[registerClass]; SELECT rs6000RegisterClass FROM none, globals, globalsAndIns, globalsInsAndFloats, globalsInsFloatsOutsAndLocals, all => { NULL; }; ENDCASE => { ERROR RuntimeError.BoundsFault; }; RETURN [rs6000RegisterClass]; }; TargetRegisterClassFromRS6000RegisterClass: PUBLIC PROCEDURE [ registerClass: RS6000Architecture.RegisterClass] RETURNS [TargetArchitecture.RegisterClass] ~ { targetRegisterClass: TargetArchitecture.RegisterClass ~ LOOPHOLE[registerClass]; SELECT registerClass FROM none, globals, globalsAndIns, globalsInsAndFloats, globalsInsFloatsOutsAndLocals, all => { NULL; }; ENDCASE => { ERROR RuntimeError.BoundsFault; }; RETURN [targetRegisterClass]; }; <> CantRelocate: PUBLIC ERROR ~ CODE; <> <<>> CantReach: PUBLIC ERROR ~ CODE; <> <<>> NullRS6000Address: PUBLIC ERROR ~ CODE; <> <<>> NullRS6000Instruction: PUBLIC ERROR ~ CODE; <> <<>> }. <<>>