Ejemplo n.º 1
0
  public ImExpr lookupVar(GimpleExpr gimpleExpr) {
    if (gimpleExpr instanceof SymbolRef) {
      SymbolRef symbol = (SymbolRef) gimpleExpr;
      ImExpr variable = symbolTable.get(symbol.getId());

      if (variable != null) {
        return variable;
      }

      if (symbol.getName() != null) {
        variable = translationContext.findGlobal(symbol.getName());
      }

      if (variable == null) {
        throw new IllegalArgumentException(
            "No such variable '" + gimpleExpr + "' (id=" + symbol.getId() + ")");
      }
      return variable;
    } else {
      throw new UnsupportedOperationException(
          "Expected GimpleVar, got: "
              + gimpleExpr
              + " ["
              + gimpleExpr.getClass().getSimpleName()
              + "]");
    }
  }