protected void generateTernary(Ternary node,DumpOne dump) { // 6th ... The Count aquiesses to Holmes deduction, however he claims to have only been // pursuing tail recursion. Location op1 = node.getOp1(); Location op2 = node.getOp2(); Location op3 = node.getOp3(); Use umap1 = node.getUse(0); Use umap2 = node.getUse(1); if(node.getOp2().isSymbolic()){ Symbolic symOp1 = op1.getSymbolic(); Symbolic symOp2 = op2.getSymbolic(); Register L = (Register) _cEnv.getRegister(symOp1, symOp2, umap1, umap2, false); Name yName = _cEnv.getNameOf(symOp2); Register yReg = yName.inRegister(); if(yReg!=null){ if(L.holds(yName)){ yReg.remContent(yName); } else { _cEnv._code.mov(L, yReg, "genTern: y' not in L"); L.addContent(yName); } } else { _cEnv._code.mov(L, yName.pickLocation(), "genTern: y' not in L"); L.addContent(yName); } /* *
  • If the third operand is symbolic, get its name, find its location, and generate the code for the binary operation. * Be aware that it does not matter whether the operand is in register or memory. If the third * operand is in register, check to see whether its name can be safely removed from the * register (i.e., not used in the following code of the block). *
  • If the third oeprand is immediate, create an MImmediate object and generate the code for the operation *
  • Make the name of the result exclusively in the target register * * @param node The node for which we are about to generate code * @param DumpOne the interface of a class that will dump the actual opcode. */ if(op3.isSymbolic()){ Symbolic symOp3 = op3.getSymbolic(); Name op3Name = _cEnv.getNameOf(symOp3); dump.doIt(symOp1.getLocation(), symOp2.getLocation()); Register op3loc = op3Name.inRegister(); if(op3loc!=null){ // saftely remove } else { } } else if(op3.isImmediate()) { IRImmediate irop3 = (IRImmediate) op3; dump.doIt(symOp1.getLocation(), new MImmediate(irop3.intValue())); } } else { Register target = _cEnv.forceRegister(); IRImmediate tpOp = (IRImmediate) op2; _cEnv._code.mov(target, new MImmediate(tpOp.intValue()), "genTern: op2 is immediate"); } }