Update isl-cpp bindings

We upstreamed the export of isl_val_2exp, to the official cpp bindings.
In this process, we concluded that pow2 is a better and more widely used
name for this functionality. Hence, both the official isl-cpp bindings
and our derived variant use now the term pow2.

llvm-svn: 339312
This commit is contained in:
Tobias Grosser 2018-08-09 05:07:14 +00:00
parent 26269d34d4
commit 7164b7d347
3 changed files with 17 additions and 17 deletions

View File

@ -3659,7 +3659,6 @@ public:
inline std::string to_str() const; inline std::string to_str() const;
inline void dump() const; inline void dump() const;
inline val two_exp() const;
inline val abs() const; inline val abs() const;
inline boolean abs_eq(const val &v2) const; inline boolean abs_eq(const val &v2) const;
inline val add(val v2) const; inline val add(val v2) const;
@ -3706,6 +3705,7 @@ public:
static inline val neginfty(ctx ctx); static inline val neginfty(ctx ctx);
static inline val negone(ctx ctx); static inline val negone(ctx ctx);
static inline val one(ctx ctx); static inline val one(ctx ctx);
inline val pow2() const;
inline val set_si(long i) const; inline val set_si(long i) const;
inline int sgn() const; inline int sgn() const;
inline val sub(val v2) const; inline val sub(val v2) const;
@ -14168,7 +14168,7 @@ stat schedule_node::foreach_ancestor_top_down(const std::function<stat(schedule_
} fn_data = { &fn }; } fn_data = { &fn };
auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_stat { auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_stat {
auto *data = static_cast<struct fn_data *>(arg_1); auto *data = static_cast<struct fn_data *>(arg_1);
stat ret = (*data->func)(manage(arg_0)); stat ret = (*data->func)(manage_copy(arg_0));
return ret.release(); return ret.release();
}; };
auto res = isl_schedule_node_foreach_ancestor_top_down(get(), fn_lambda, &fn_data); auto res = isl_schedule_node_foreach_ancestor_top_down(get(), fn_lambda, &fn_data);
@ -19087,12 +19087,6 @@ void val::dump() const {
} }
val val::two_exp() const
{
auto res = isl_val_2exp(copy());
return manage(res);
}
val val::abs() const val val::abs() const
{ {
auto res = isl_val_abs(copy()); auto res = isl_val_abs(copy());
@ -19369,6 +19363,12 @@ val val::one(ctx ctx)
return manage(res); return manage(res);
} }
val val::pow2() const
{
auto res = isl_val_pow2(copy());
return manage(res);
}
val val::set_si(long i) const val val::set_si(long i) const
{ {
auto res = isl_val_set_si(copy(), i); auto res = isl_val_set_si(copy(), i);

View File

@ -157,7 +157,7 @@ isl::pw_aff SCEVAffinator::addModuloSemantic(isl::pw_aff PWA,
unsigned Width = TD.getTypeSizeInBits(ExprType); unsigned Width = TD.getTypeSizeInBits(ExprType);
auto ModVal = isl::val::int_from_ui(Ctx, Width); auto ModVal = isl::val::int_from_ui(Ctx, Width);
ModVal = ModVal.two_exp(); ModVal = ModVal.pow2();
isl::set Domain = PWA.domain(); isl::set Domain = PWA.domain();
isl::pw_aff AddPW = isl::pw_aff AddPW =

View File

@ -145,7 +145,7 @@ TEST(Isl, APIntToIslVal) {
{ {
APInt APNOne(32, (1ull << 32) - 1, false); APInt APNOne(32, (1ull << 32) - 1, false);
auto IslNOne = valFromAPInt(IslCtx, APNOne, false); auto IslNOne = valFromAPInt(IslCtx, APNOne, false);
auto IslRef = isl::val(IslCtx, 32).two_exp().sub_ui(1); auto IslRef = isl::val(IslCtx, 32).pow2().sub_ui(1);
EXPECT_EQ(IslNOne, IslRef); EXPECT_EQ(IslNOne, IslRef);
} }
@ -154,7 +154,7 @@ TEST(Isl, APIntToIslVal) {
APLarge = APLarge.shl(70); APLarge = APLarge.shl(70);
auto IslLarge = valFromAPInt(IslCtx, APLarge, false); auto IslLarge = valFromAPInt(IslCtx, APLarge, false);
auto IslRef = isl::val(IslCtx, 71); auto IslRef = isl::val(IslCtx, 71);
IslRef = IslRef.two_exp(); IslRef = IslRef.pow2();
EXPECT_EQ(IslLarge, IslRef); EXPECT_EQ(IslLarge, IslRef);
} }
@ -232,7 +232,7 @@ TEST(Isl, IslValToAPInt) {
} }
{ {
auto IslNOne = isl::val(IslCtx, 32).two_exp().sub_ui(1); auto IslNOne = isl::val(IslCtx, 32).pow2().sub_ui(1);
auto APNOne = APIntFromVal(IslNOne); auto APNOne = APIntFromVal(IslNOne);
EXPECT_EQ((1ull << 32) - 1, APNOne); EXPECT_EQ((1ull << 32) - 1, APNOne);
EXPECT_EQ(33u, APNOne.getBitWidth()); EXPECT_EQ(33u, APNOne.getBitWidth());
@ -240,7 +240,7 @@ TEST(Isl, IslValToAPInt) {
{ {
auto IslLargeNum = isl::val(IslCtx, 60); auto IslLargeNum = isl::val(IslCtx, 60);
IslLargeNum = IslLargeNum.two_exp(); IslLargeNum = IslLargeNum.pow2();
IslLargeNum = IslLargeNum.sub_ui(1); IslLargeNum = IslLargeNum.sub_ui(1);
auto APLargeNum = APIntFromVal(IslLargeNum); auto APLargeNum = APIntFromVal(IslLargeNum);
EXPECT_EQ((1ull << 60) - 1, APLargeNum); EXPECT_EQ((1ull << 60) - 1, APLargeNum);
@ -249,7 +249,7 @@ TEST(Isl, IslValToAPInt) {
{ {
auto IslExp = isl::val(IslCtx, 500); auto IslExp = isl::val(IslCtx, 500);
auto IslLargePow2 = IslExp.two_exp(); auto IslLargePow2 = IslExp.pow2();
auto APLargePow2 = APIntFromVal(IslLargePow2); auto APLargePow2 = APIntFromVal(IslLargePow2);
EXPECT_TRUE(APLargePow2.isPowerOf2()); EXPECT_TRUE(APLargePow2.isPowerOf2());
EXPECT_EQ(502u, APLargePow2.getBitWidth()); EXPECT_EQ(502u, APLargePow2.getBitWidth());
@ -258,7 +258,7 @@ TEST(Isl, IslValToAPInt) {
{ {
auto IslExp = isl::val(IslCtx, 500); auto IslExp = isl::val(IslCtx, 500);
auto IslLargeNPow2 = IslExp.two_exp().neg(); auto IslLargeNPow2 = IslExp.pow2().neg();
auto APLargeNPow2 = APIntFromVal(IslLargeNPow2); auto APLargeNPow2 = APIntFromVal(IslLargeNPow2);
EXPECT_EQ(501u, APLargeNPow2.getBitWidth()); EXPECT_EQ(501u, APLargeNPow2.getBitWidth());
EXPECT_EQ(501u, APLargeNPow2.getMinSignedBits()); EXPECT_EQ(501u, APLargeNPow2.getMinSignedBits());
@ -267,7 +267,7 @@ TEST(Isl, IslValToAPInt) {
{ {
auto IslExp = isl::val(IslCtx, 512); auto IslExp = isl::val(IslCtx, 512);
auto IslLargePow2 = IslExp.two_exp(); auto IslLargePow2 = IslExp.pow2();
auto APLargePow2 = APIntFromVal(IslLargePow2); auto APLargePow2 = APIntFromVal(IslLargePow2);
EXPECT_TRUE(APLargePow2.isPowerOf2()); EXPECT_TRUE(APLargePow2.isPowerOf2());
EXPECT_EQ(514u, APLargePow2.getBitWidth()); EXPECT_EQ(514u, APLargePow2.getBitWidth());
@ -276,7 +276,7 @@ TEST(Isl, IslValToAPInt) {
{ {
auto IslExp = isl::val(IslCtx, 512); auto IslExp = isl::val(IslCtx, 512);
auto IslLargeNPow2 = IslExp.two_exp().neg(); auto IslLargeNPow2 = IslExp.pow2().neg();
auto APLargeNPow2 = APIntFromVal(IslLargeNPow2); auto APLargeNPow2 = APIntFromVal(IslLargeNPow2);
EXPECT_EQ(513u, APLargeNPow2.getBitWidth()); EXPECT_EQ(513u, APLargeNPow2.getBitWidth());
EXPECT_EQ(513u, APLargeNPow2.getMinSignedBits()); EXPECT_EQ(513u, APLargeNPow2.getMinSignedBits());