diff --git a/ts2panda/src/ts2panda.ts b/ts2panda/src/ts2panda.ts index 3e0992b6f1ffc0c6c466ccbbc4fe7601f7ed399d..58e7765b7952b67007b31d14407726cd213460d0 100755 --- a/ts2panda/src/ts2panda.ts +++ b/ts2panda/src/ts2panda.ts @@ -16,7 +16,6 @@ import { CmdOptions } from "./cmdOptions"; import { DebugPosInfo } from "./debuginfo"; import { - BuiltinR2i, Imm, IRNode, Label, @@ -27,7 +26,7 @@ import { LOGD } from "./log"; import { PandaGen } from "./pandagen"; import { CatchTable, Function, Ins, Signature } from "./pandasm"; import { generateCatchTables } from "./statement/tryStatement"; -import { escapeUnicode } from "./base/util"; +import { escapeUnicode, isRangeInst, getRangeStartVregPos } from "./base/util"; const dollarSign: RegExp = /\$/g; @@ -65,12 +64,14 @@ export class Ts2Panda { if (insn instanceof Label) { insLabel = Ts2Panda.labelPrefix + insn.id; labels.push(insLabel); - } else if (insn instanceof BuiltinR2i) { - // BuiltinR2i's format is builtin.r2i imm1, imm2, v:in:top - // and it may represents DynRange insn so we only pass the first vreg + } else if (isRangeInst(insn)) { + // For DynRange insn we only pass the first vreg of continous vreg array let operands = insn.operands; - insImms.push((operands[0]).value, (operands[1]).value); - insRegs.push((operands[2]).num); + insImms.push((operands[0]).value); + insRegs.push((operands[1]).num); + if (getRangeStartVregPos(insn) == 2) { + insRegs.push((operands[2]).num); + } } else { insn.operands.forEach((operand: OperandType) => { if (operand instanceof VReg) { @@ -220,4 +221,4 @@ export class Ts2Panda { Ts2Panda.strings.clear(); Ts2Panda.jsonString = ""; } -} \ No newline at end of file +}