This is an archive of the discontinued LLVM Phabricator instance.

[Polly] [FlattenAlgo] Translate to C++ bindings
ClosedPublic

Authored by grosser on Mar 5 2017, 8:16 AM.

Details

Summary

Translate the full algorithm to use the new isl C++ bindings

This is a large piece of code that has been written with the Polly IslPtr<>
memory management tool, which only performed memory management, but did not
provide a method interface. As such the code was littered with calls to
give(), copy(), keep(), and take(). The diff of this change should give a
good example how the new method interface simplifies the code by removing the
need for switching between managed types and C functions all the time
and consequently also the need to use the long C function names.

These are a couple of examples comparing the old IslPtr memory management
interface with the complete method interface.

Check properties

Before:

if (isl_aff_is_zero(Aff.get()) ||  isl_aff_is_one(Aff.get()))
  return true;

After:

if (Aff.isZero() || Aff.isOne())
  return true;

Type conversion

Before:

isl_union_pw_multi_aff *UPMA =
    give(isl_union_pw_multi_aff_from_union_map(UMap.copy());

After:

isl::UnionPwMultiAff UPMA = UMap;

Type construction

Before:

auto Empty = give(isl_union_map_empty(Space.copy());

After:

auto Empty = isl::UnionMap::empty(Space);

Operations

Before:

Set = give(isl_union_set_intersect(Set.copy(), Set2.copy());

After:

Set = Set.intersect(Set2);

Event Timeline

grosser created this revision.Mar 5 2017, 8:16 AM
Meinersbur edited edge metadata.Mar 6 2017, 2:58 AM

Looks straigtforward.

Meinersbur accepted this revision.Mar 10 2017, 4:02 AM
This revision is now accepted and ready to land.Mar 10 2017, 4:02 AM
This revision was automatically updated to reflect the committed changes.