Esempio n. 1
0
// Adds the edge F -> T with weight Weight.
APInt IneqGraph::findShortestPath(Value *F, Value *T) {
  DEBUG(dbgs() << "IneqGraph: findShortestPath: " << *F << " ==> " << *T << "\n");
  if (isa<ConstantInt>(F) || isa<ConstantInt>(T)) {
    APInt RangeF = getUpper(F);
    APInt RangeT = getLower(T);
    DEBUG(dbgs() << "Ranges: " << RangeF << " and " << RangeT << "\n");
    if (RangeF.isMaxSignedValue() || RangeF.isMinSignedValue() ||
        RangeT.isMaxSignedValue() || RangeT.isMinSignedValue())
      return APInt::getSignedMaxValue(64);
    return RangeF.sextOrSelf(64) - RangeT.sextOrSelf(64);
  }
  GraphNode *FN = getOrCreateNode(F);
  GraphNode *TN = getOrCreateNode(T);
  return FN->findShortestPath(TN);
}
Esempio n. 2
0
Value *IslExprBuilder::createInt(__isl_take isl_ast_expr *Expr) {
  assert(isl_ast_expr_get_type(Expr) == isl_ast_expr_int &&
         "Expression not of type isl_ast_expr_int");
  isl_int Int;
  Value *V;
  APInt APValue;
  IntegerType *T;

  isl_int_init(Int);
  isl_ast_expr_get_int(Expr, &Int);
  APValue = APInt_from_MPZ(Int);
  T = getType(Expr);
  APValue = APValue.sextOrSelf(T->getBitWidth());
  V = ConstantInt::get(T, APValue);

  isl_ast_expr_free(Expr);
  isl_int_clear(Int);
  return V;
}