/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Checks to see if a list of SSA registers can all be mapped into * the same rop reg. Ignores registers that have already been mapped, * and checks the interference graph and ensures the range does not * cross the parameter range. * * @param specs {@code non-null;} SSA registers to check * @param ropReg {@code >=0;} rop register to check mapping to * @return {@code true} if all unmapped registers can be mapped */ private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) { for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) continue; if (!canMapReg(spec, ropReg)) return false; } return true; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Tries to map an SSA register to a rop register. * * @param ssaSpec {@code non-null;} SSA register * @param ropReg {@code >=0;} rop register * @param maxAllowedCategory {@code 1..2;} the maximum category * that the SSA register is allowed to be * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { if (ssaSpec.getCategory() <= maxAllowedCategory && !ssaRegsMapped.get(ssaSpec.getReg()) && canMapReg(ssaSpec, ropReg)) { addMapping(ssaSpec, ropReg); return true; } return false; }
/** * Adds a mapping from an SSA register to a rop register. * {@link #canMapReg} should have already been called. * * @param ssaSpec {@code non-null;} SSA register to map from * @param ropReg {@code >=0;} rop register to map to */ private void addMapping(RegisterSpec ssaSpec, int ropReg) { int ssaReg = ssaSpec.getReg(); // An assertion. if (ssaRegsMapped.get(ssaReg) || !canMapReg(ssaSpec, ropReg)) { throw new RuntimeException( "attempt to add invalid register mapping"); } if (DEBUG) { System.out.printf("Add mapping s%d -> v%d c:%d\n", ssaSpec.getReg(), ropReg, ssaSpec.getCategory()); } int category = ssaSpec.getCategory(); mapper.addMapping(ssaSpec.getReg(), ropReg, category); ssaRegsMapped.set(ssaReg); usedRopRegs.set(ropReg, ropReg + category); }
/** * Maps all non-parameter, non-local variable registers. */ private void handleNormalUnassociated() { int szSsaRegs = ssaMeth.getRegCount(); for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one continue; } RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg); if (ssaSpec == null) continue; int category = ssaSpec.getCategory(); // Find a rop reg that does not interfere int ropReg = findNextUnreservedRopReg(paramRangeEnd, category); while (!canMapReg(ssaSpec, ropReg)) { ropReg = findNextUnreservedRopReg(ropReg + 1, category); } addMapping(ssaSpec, ropReg); } }
/** * Maps all non-parameter, non-local variable registers. */ private void handleNormalUnassociated() { int szSsaRegs = ssaMeth.getRegCount(); for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one continue; } RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg); if (ssaSpec == null) continue; int category = ssaSpec.getCategory(); // Find a rop reg that does not interfere int ropReg = findNextUnreservedRopReg(paramRangeEnd, category); while (!canMapReg(ssaSpec, ropReg)) { ropReg = findNextUnreservedRopReg(ropReg + 1, category); } addMapping(ssaSpec, ropReg); } }
/** * Maps all non-parameter, non-local variable registers. */ private void handleNormalUnassociated() { int szSsaRegs = ssaMeth.getRegCount(); for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one continue; } RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg); if (ssaSpec == null) continue; int category = ssaSpec.getCategory(); // Find a rop reg that does not interfere int ropReg = findNextUnreservedRopReg(paramRangeEnd, category); while (!canMapReg(ssaSpec, ropReg)) { ropReg = findNextUnreservedRopReg(ropReg + 1, category); } addMapping(ssaSpec, ropReg); } }
/** * Maps all non-parameter, non-local variable registers. */ private void handleNormalUnassociated() { int szSsaRegs = ssaMeth.getRegCount(); for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one continue; } RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg); if (ssaSpec == null) continue; int category = ssaSpec.getCategory(); // Find a rop reg that does not interfere int ropReg = findNextUnreservedRopReg(paramRangeEnd, category); while (!canMapReg(ssaSpec, ropReg)) { ropReg = findNextUnreservedRopReg(ropReg + 1, category); } addMapping(ssaSpec, ropReg); } }
/** * Maps all non-parameter, non-local variable registers. */ private void handleNormalUnassociated() { int szSsaRegs = ssaMeth.getRegCount(); for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one continue; } RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg); if (ssaSpec == null) continue; int category = ssaSpec.getCategory(); // Find a rop reg that does not interfere int ropReg = findNextUnreservedRopReg(0, category); while (!canMapReg(ssaSpec, ropReg)) { ropReg = findNextUnreservedRopReg(ropReg + 1, category); } addMapping(ssaSpec, ropReg); } }