Ejemplo n.º 1
0
  private void processOutputs(Operation operation) {
    // Update table and outputs
    List<Operand> outputs = operation.getOutputs();
    for (int j = 0; j < outputs.size(); j++) {

      Operand output = outputs.get(j);
      if (output.getType() != OperandType.internalData) {
        if (!output.isImmutable()) {
          Logger.getLogger(SingleStaticAssignment.class.getName())
              .warning(
                  "Mutable output of type '" + output.getType() + "' bypassed SSA transformation.");
        }
        continue;
      }

      InternalData iData = (InternalData) output;
      String registerName = iData.getName();

      // Update version
      Integer version = versionTable.get(registerName);
      if (version == null) {
        version = 0;
      }
      version++;
      versionTable.put(registerName, version);

      // New name
      String ssaName = Ssa.buildSsaName(registerName, version);
      // New InternalData
      InternalData newData = new InternalData(ssaName, iData.getBits());
      // Substitute
      outputs.set(j, newData);
    }
  }
Ejemplo n.º 2
0
  private void processInputs(Operation operation) {
    List<Operand> inputs = operation.getInputs();

    for (int j = 0; j < inputs.size(); j++) {
      Operand input = inputs.get(j);

      // SSA is only over internal data. Check if a mutable kind of
      // data as went undetected
      if (input.getType() != OperandType.internalData) {
        if (!input.isImmutable()) {
          Logger.getLogger(SingleStaticAssignment.class.getName())
              .warning(
                  "Mutable input of type '" + input.getType() + "' bypassed SSA transformation.");
        }
        continue;
      }

      InternalData iData = (InternalData) input;

      // Get version
      Integer version = versionTable.get(iData.getName());
      if (version == null) {
        version = 0;
        versionTable.put(iData.getName(), version);
      }

      // Get SSA name
      String ssaName = Ssa.buildSsaName(iData.getName(), version);
      // New InternalData
      InternalData newData = new InternalData(ssaName, iData.getBits());
      newData.setPrefix(iData.getPrefix());

      // Substitute
      inputs.set(j, newData);
    }
  }