pet.git
2 months agolink against isl libraries firstmaster
Sven Verdoolaege [Sat, 10 Feb 2024 11:37:48 +0000 (10 12:37 +0100)]
link against isl libraries first

In particular, link against the isl libraries before linking
against libLLVM.  If LLVM was compiled with Polly support,
then it will also contain isl symbols.  This is usually not a problem
since these symbols are versioned.  However, if libLLVM is
a shared library and libpet is dynamically loaded,
then libpet may end up calling isl symbols inside libLLVM.
Linking against libisl first prevent this.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
8 months agopet_stmt_build_ast_exprs: handle some nested operations inside accesses
Sven Verdoolaege [Sat, 5 Aug 2023 10:30:34 +0000 (5 12:30 +0200)]
pet_stmt_build_ast_exprs: handle some nested operations inside accesses

In particular, support additions and subtractions,
as well as integer constants.
These are handled by calling the corresponding operation
on objects of type isl_ast_expr.

The same mechanism could be used for other operations,
but only if there is a corresponding isl_ast_expr operation.

For operations that do not have a corresponding isl_ast_expr operation,
a different mechanism would have to be used.
One possibility would be to leave in the identifier
holding a pointer to an isl_ast_expr and then to introduce
an isl_ast_expr_print in isl taking an isl_ast_print_options object
with a callback for printing identifiers.

Requested-by: Emil Vatai <emil.vatai@gmail.com>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
9 months agoprint.c: rename pet_expr_build_ast_expr to pet_expr_access_build_ast_expr
Sven Verdoolaege [Sat, 5 Aug 2023 09:58:16 +0000 (5 11:58 +0200)]
print.c: rename pet_expr_build_ast_expr to pet_expr_access_build_ast_expr

This reflects that this function is only meant to be called
on access expressions.
It also make room for a more generic pet_expr_build_ast_expr
in the next commit.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
9 months agoallow extraction of function summary to fail
Sven Verdoolaege [Sat, 5 Aug 2023 14:12:28 +0000 (5 16:12 +0200)]
allow extraction of function summary to fail

If so, do not try to extract more accurate access relations
from the called function and simply use the default heuristics instead.

This is illustrated by the two new test cases.
In call9, the called function can be analyzed and
the access relations in the caller can be updated
to reflect that only odd elements are being accessed.
In call10, the called function cannot be analyzed
(because it contains a goto) and this extra information
is not available in the access relations of the caller.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
9 months agointroduce PetScan::no_summary
Sven Verdoolaege [Sat, 5 Aug 2023 13:11:00 +0000 (5 15:11 +0200)]
introduce PetScan::no_summary

This will be used in the next commit to indicate that no summary
could be constructed.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
9 months agoPetScan::get_summary: extract out PetScan::cache_summary
Sven Verdoolaege [Sat, 5 Aug 2023 13:18:12 +0000 (5 15:18 +0200)]
PetScan::get_summary: extract out PetScan::cache_summary

This will be reused in an upcoming commit.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
9 months agoPetScan::get_summary: extract out PetScan::get_summary_from_tree
Sven Verdoolaege [Sat, 5 Aug 2023 13:00:14 +0000 (5 15:00 +0200)]
PetScan::get_summary: extract out PetScan::get_summary_from_tree

This separates out the extraction of a pet_tree
from the construction of a pet_scop from this pet_tree.
This makes it easier for an upcoming commit to handle
the failure of extracting a pet_tree covering
the entire body of the function.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
9 months agoPetScan::summary_cache: fix typo in comment
Sven Verdoolaege [Sat, 5 Aug 2023 15:40:47 +0000 (5 17:40 +0200)]
PetScan::summary_cache: fix typo in comment

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agopet 0.11.7pet-0.11.7
Sven Verdoolaege [Sat, 1 Apr 2023 16:08:01 +0000 (1 18:08 +0200)]
pet 0.11.7

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agoREADME: update supported versions of clang
Sven Verdoolaege [Sat, 1 Apr 2023 15:37:49 +0000 (1 17:37 +0200)]
README: update supported versions of clang

In particular, update the latest supported version to the latest release
and update the earliest supported version to 3.5.
Versions before that may still work, but it is becoming difficult to test.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agoupdate isl to version 0.26
Sven Verdoolaege [Sat, 1 Apr 2023 15:36:50 +0000 (1 17:36 +0200)]
update isl to version 0.26

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agowhen linking against libclang-cpp, check linking of LLVM libs
Sven Verdoolaege [Fri, 31 Mar 2023 20:40:30 +0000 (31 22:40 +0200)]
when linking against libclang-cpp, check linking of LLVM libs

Apparently, the LLVM libraries may already be linked into libclang-cpp,
in which case linking against the LLVM libraries again may cause
errors about options being registered more than once.
Check whether the LLVM libraries should be linked in as well.
Fail if libclang-cpp cannot be used with or without the LLVM libraries.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agom4/ax_detect_clang.m4: preserve clang specific CPPFLAGS across clang-cpp check
Sven Verdoolaege [Fri, 31 Mar 2023 20:38:21 +0000 (31 22:38 +0200)]
m4/ax_detect_clang.m4: preserve clang specific CPPFLAGS across clang-cpp check

This will be needed in the next commit, to compile (and link)
a test program.
For simplicity, save and restore all modified flags together.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agoperform library check using C++ compiler
Sven Verdoolaege [Fri, 31 Mar 2023 20:45:53 +0000 (31 22:45 +0200)]
perform library check using C++ compiler

An upcoming will compile (and link) a C++ test program
when checking for libclang-cpp, so this section needs
to continue to use the C++ compiler.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agoalways let libtool add clang library search path to pet run-time path
Sven Verdoolaege [Fri, 31 Mar 2023 20:57:54 +0000 (31 22:57 +0200)]
always let libtool add clang library search path to pet run-time path

Ever since pet-0.08-26-ga22f984 (link against single libLLVM
shared library when available, Wed Feb 24 14:26:25 2016 +0100),
the clang library search path has been added to the pet run-time path
if a single libLLVM shared library is found (and used),
but the clang libraries themselves may also be shared libraries and
the dynamic linker also needs to be able to find those.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agoupdate isl for better linking of libclang-cpp
Sven Verdoolaege [Sat, 1 Apr 2023 10:39:34 +0000 (1 12:39 +0200)]
update isl for better linking of libclang-cpp

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
13 months agoupdate isl for change in coalescing
Sven Verdoolaege [Tue, 7 Mar 2023 20:51:04 +0000 (7 21:51 +0100)]
update isl for change in coalescing

This has an effect on one of the test cases.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
14 months agoupdate to move of llvm/Support/Host.h to llvm/TargetParser/Host.h
Sven Verdoolaege [Sun, 12 Feb 2023 11:28:53 +0000 (12 12:28 +0100)]
update to move of llvm/Support/Host.h to llvm/TargetParser/Host.h

The header llvm/Support/Host.h was moved to llvm/TargetParser/Host.h
in LLVM commit llvmorg-16-init-15123-gf09cf34d0062 ([Support]
Move TargetParsers to new component, Tue Dec 20 10:24:02 2022 +0000),
leaving in a forwarding header and this forwarding header was deprecated
in LLVM commit llvmorg-17-init-1742-gd768bf994f50 ([NFC][TargetParser]
Replace uses of llvm/Support/Host.h, Fri Feb 10 09:59:46 2023 +0000).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
14 months agoupdate isl for support for recent versions of clang
Sven Verdoolaege [Sun, 12 Feb 2023 21:34:29 +0000 (12 22:34 +0100)]
update isl for support for recent versions of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
14 months agoscop_plus.h: declare operator() of std::set compare function const
Sven Verdoolaege [Sun, 12 Feb 2023 11:24:29 +0000 (12 12:24 +0100)]
scop_plus.h: declare operator() of std::set compare function const

This is required in C++-17 and LLVM switched to C++-17 in
llvmorg-16-init-975-gb1356504e63a ([LLVM] Update C++ standard to 17,
Fri Aug 5 21:45:55 2022 +0200).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
14 months agoscan.h: declare operator() of std::set compare function const
Sven Verdoolaege [Sun, 12 Feb 2023 11:00:07 +0000 (12 12:00 +0100)]
scan.h: declare operator() of std::set compare function const

This is required in C++-17 and LLVM switched to C++-17 in
llvmorg-16-init-975-gb1356504e63a ([LLVM] Update C++ standard to 17,
Fri Aug 5 21:45:55 2022 +0200).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
14 months agopet_clang_base_or_typedef_type: desugar any ElaboratedType
Sven Verdoolaege [Sun, 12 Feb 2023 11:25:17 +0000 (12 12:25 +0100)]
pet_clang_base_or_typedef_type: desugar any ElaboratedType

Since LLVM commit llvmorg-16-init-22-g15f3cd6bfc67 ([clang] Implement
ElaboratedType sugaring for types written bare,
Mon Oct 11 18:15:36 2021 +0200), TypedefType objects may get wrapped
in an additional ElaboratedType.  Look through this sugar.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
14 months agoadd configure~ to .gitignore
Sven Verdoolaege [Sun, 12 Feb 2023 21:28:10 +0000 (12 22:28 +0100)]
add configure~ to .gitignore

Autoconf 2.70 (and later) may leave such backup files.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
15 months agopet_loopback.c: add missing include
Sven Verdoolaege [Fri, 3 Feb 2023 22:01:06 +0000 (3 23:01 +0100)]
pet_loopback.c: add missing include

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
16 months agoadd example application that prints out parsed code without transformation
Sven Verdoolaege [Sat, 17 Sep 2022 15:58:01 +0000 (17 17:58 +0200)]
add example application that prints out parsed code without transformation

This illustrates how to print out code from a pet_scop.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
19 months agopet_scop_get_{tagged_,}may_writes: include reads in statement arguments
Sven Verdoolaege [Sat, 17 Sep 2022 15:57:53 +0000 (17 17:57 +0200)]
pet_scop_get_{tagged_,}may_writes: include reads in statement arguments

The reads performed by the statement arguments are also part
of the scop containing the statement, so these reads
should be included in the result of pet_scop_get_{tagged_,}may_writes.

Reported-by: Maciej Poliwoda <maciejpoliwoda@gmail.com>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
19 months agoscop.c: fix typo in comment
Sven Verdoolaege [Sun, 18 Sep 2022 12:12:52 +0000 (18 14:12 +0200)]
scop.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agopet 0.11.6pet-0.11.6
Sven Verdoolaege [Sat, 2 Jul 2022 12:40:26 +0000 (2 14:40 +0200)]
pet 0.11.6

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoREADME: update latest release of clang
Sven Verdoolaege [Sat, 2 Jul 2022 12:26:39 +0000 (2 14:26 +0200)]
README: update latest release of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoupdate isl to version 0.25
Sven Verdoolaege [Sat, 2 Jul 2022 12:24:26 +0000 (2 14:24 +0200)]
update isl to version 0.25

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoinclude header mapped to memory buffer to inject declarations
Sven Verdoolaege [Sat, 25 Jun 2022 09:34:25 +0000 (25 11:34 +0200)]
include header mapped to memory buffer to inject declarations

The original (hackish) way of injecting these declarations is no longer
possible since LLVM commit llvmorg-15-init-9837-g6bbf51f3ed59 ([Frontend]
Move, don't copy the predefines buffer into PP. NFC.,
Sun May 8 01:03:35 2022 +0200).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agopet.cc: add_predefines: extract out pencil_predefines
Sven Verdoolaege [Sat, 25 Jun 2022 09:34:25 +0000 (25 11:34 +0200)]
pet.cc: add_predefines: extract out pencil_predefines

The same predefines will be communicated differently
to clang in the next commit.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agopet.cc: mark add_predefines static
Sven Verdoolaege [Sat, 2 Jul 2022 10:18:18 +0000 (2 12:18 +0200)]
pet.cc: mark add_predefines static

This function is only used inside pet.cc.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoupdate to rename of diag::ext_implicit_function_decl
Sven Verdoolaege [Sat, 25 Jun 2022 08:32:17 +0000 (25 10:32 +0200)]
update to rename of diag::ext_implicit_function_decl

LLVM commit llvmorg-15-init-8223-g7d644e1215b3 ([C11/C2x] Change
the behavior of the implicit function declaration warning,
Wed Apr 20 11:25:35 2022 -0400) also renames
diag::ext_implicit_function_decl to diag::ext_implicit_function_decl_c99.
Adjust the code to this renaming.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoexplicitly turn off treating implicit function declaration warnings as errors
Sven Verdoolaege [Wed, 29 Jun 2022 16:45:26 +0000 (29 18:45 +0200)]
explicitly turn off treating implicit function declaration warnings as errors

Implicitly declared functions are (ab)used to make some
functions such as "min" and "max" available by default.
A special TextDiagnosticPrinter is used to avoid printing
warnings on this functions.
However, since LLVM commit llvmorg-15-init-8223-g7d644e1215b3 ([C11/C2x]
Change the behavior of the implicit function declaration warning,
Wed Apr 20 11:25:35 2022 -0400), these warnings are treated as errors
by default.
Turn this off to be able to continue using this mechanism,
at least on C99 input.

Use a call to DiagnosticsEngine::setDiagnosticGroupWarningAsError
to change the default.  An alternative would be to add an extra
argument in construct_invocation, but the DiagnosticsEngine
has already been created at this point, so this would not have
any effect on it.
(Note that clang first uses a temporary DiagnosticsEngine and
creates the "actual" DiagnosticsEngine after parsing command line options.)

22 months agoupdate to move of setLangDefaults method
Sven Verdoolaege [Sat, 25 Jun 2022 08:09:38 +0000 (25 10:09 +0200)]
update to move of setLangDefaults method

In LLVM commit llvmorg-15-init-7544-g93471e65df48 ([clang] NFC,
move CompilerInvocation::setLangDefaults to LangOptions.h,
Fri Apr 8 13:23:12 2022 +0200), the method was moved from
CompilerInvocation to LangOptions.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoupdate isl for support for recent versions of clang
Sven Verdoolaege [Fri, 1 Jul 2022 20:50:20 +0000 (1 22:50 +0200)]
update isl for support for recent versions of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoreplace obsolete AC_PROG_LIBTOOL by LT_INIT
Sven Verdoolaege [Sun, 26 Jun 2022 07:33:47 +0000 (26 09:33 +0200)]
replace obsolete AC_PROG_LIBTOOL by LT_INIT

It has been obsolete since libtool 2.2.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoreplace obsolete AC_TRY_COMPILE by AC_COMPILE_IFELSE
Sven Verdoolaege [Sat, 25 Jun 2022 08:06:13 +0000 (25 10:06 +0200)]
replace obsolete AC_TRY_COMPILE by AC_COMPILE_IFELSE

It has been obsolete since autoconf 2.55.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agoreplace obsolete AC_ERROR calls by AC_MSG_ERROR
Sven Verdoolaege [Sat, 25 Jun 2022 16:15:08 +0000 (25 18:15 +0200)]
replace obsolete AC_ERROR calls by AC_MSG_ERROR

It was already obsolete when the call was introduced in
2d4dd95 (update for rename of getInstantiationLineNumber to
getExpansionLineNumber, Thu Jul 28 11:03:07 2011 +0200).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
22 months agopreserve array extents in case of empty context
Sven Verdoolaege [Sat, 25 Jun 2022 07:36:51 +0000 (25 09:36 +0200)]
preserve array extents in case of empty context

The context can be empty if it turns out the scop cannot
be executed for any value of the parameters.
Taking the gist with respect to such a context completely removes
any information about the array extents.
Even though these extents may not be strictly required
in such cases, there is no need to force the user
to add specific support for these cases.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
2 years agointerface/pet.py: convert strings for Python 3 compatibility
Sven Verdoolaege [Sat, 21 Aug 2021 07:58:45 +0000 (21 09:58 +0200)]
interface/pet.py: convert strings for Python 3 compatibility

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
2 years agopet_expr_is_equal: compare index expressions using isl_multi_pw_aff_is_equal
Sven Verdoolaege [Sun, 25 Jul 2021 08:55:08 +0000 (25 10:55 +0200)]
pet_expr_is_equal: compare index expressions using isl_multi_pw_aff_is_equal

Originally, the test was performed using isl_multi_pw_aff_plain_is_equal.
This was changed in pet-0.04-321-gbd0ad36 (pet_expr_is_equal: compare
index expressions up to reordering of parameters,
Thu Feb 20 10:40:36 2014 +0100) to allow for parameters appearing
in a different order.
It is not clear why isl_multi_pw_aff_is_equal was not used instead,
which allows for further differences (at a higher cost because
the affine expressions may internally need to be converted to a map).
Since pet_expr_is_equal is meant to check for equivalent expressions
(rather than identical expressions), it should allow more variation
in the index expression.
In fact, since the index expressions are relative to the expression domain,
in theory it should allow any pairs of expressions that are equivlant
on that domain, but this commit does not go that far.

The more relaxed comparison is useful for expressions such as

[N, M] -> { [S_9[i] -> [i1]] -> [((0) : i1 = N - i;
(1) : -i <= i1 < N - i; (0) : i1 = -1 - i)] }

This could also be represented as

[N, M] -> { [S_9[i] -> [i1]] -> [((0) : i1 = N - i or
i1 = -1 - i; (1) : -i <= i1 < N - i)] }

However, these are not considered to be obviously equivalent,
especially since the first gets more complicated domains
after parsing because the cells overlap.
These expressions are the result of a gist with respect to some domain.
Arguably, the overlapping cells make the first expression
an invalid representation of a piecewise expression,
even though the overlap only occurs outside of the domain
with respect to which the gist was taken.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agopet 0.11.5pet-0.11.5
Sven Verdoolaege [Sun, 25 Apr 2021 16:48:28 +0000 (25 18:48 +0200)]
pet 0.11.5

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoREADME: update latest release of clang
Sven Verdoolaege [Sun, 25 Apr 2021 16:45:57 +0000 (25 18:45 +0200)]
README: update latest release of clang

Also update README to switch of LLVM/clang from svn to git.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoupdate isl to version 0.24
Sven Verdoolaege [Sun, 25 Apr 2021 16:43:59 +0000 (25 18:43 +0200)]
update isl to version 0.24

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agopet.cc: pass correct 4th argument to CompilerInvocation::setLangDefaults
Sven Verdoolaege [Mon, 5 Apr 2021 08:27:00 +0000 (5 10:27 +0200)]
pet.cc: pass correct 4th argument to CompilerInvocation::setLangDefaults

Since llvmorg-12-init-16745-gc495dfe0268b ([clang][cli] NFC: Decrease
the scope of ParseLangArgs parameters, Thu Jan 14 08:26:12 2021 +0100),
the fourth argument of CompilerInvocation::setLangDefaults is
a std::vector<std::string> rather than a clang::PreprocessorOptions.
Introduce a setLangDefaultsArg4 to pass in the right argument
depending on what is expected by the specific version of clang.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoupdate isl for support for recent versions of clang
Sven Verdoolaege [Mon, 5 Apr 2021 08:10:27 +0000 (5 10:10 +0200)]
update isl for support for recent versions of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoREADME: update URLs
Sven Verdoolaege [Fri, 18 Dec 2020 14:14:29 +0000 (18 15:14 +0100)]
README: update URLs

The original ones are outdated.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agopet 0.11.4pet-0.11.4
Sven Verdoolaege [Sun, 1 Nov 2020 14:07:40 +0000 (1 15:07 +0100)]
pet 0.11.4

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoREADME: update latest release of clang
Sven Verdoolaege [Wed, 11 Nov 2020 15:43:44 +0000 (11 16:43 +0100)]
README: update latest release of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoupdate isl to version 0.23
Sven Verdoolaege [Sun, 1 Nov 2020 14:02:02 +0000 (1 15:02 +0100)]
update isl to version 0.23

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoimprove detection of clangEdit
Sven Verdoolaege [Thu, 9 Jul 2020 08:16:34 +0000 (9 10:16 +0200)]
improve detection of clangEdit

The check for clangEdit may fail on some systems
if it is not linked together with its dependencies.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agolink against single libclang-cpp library if available
Sven Verdoolaege [Fri, 3 Jul 2020 16:36:06 +0000 (3 18:36 +0200)]
link against single libclang-cpp library if available

Some distributions choose to only install libclang-cpp.
It should also be less error-prone, so use it by default
if it is available.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
3 years agoupdate isl for linking against single libclang-cpp library if available
Sven Verdoolaege [Fri, 3 Jul 2020 16:28:09 +0000 (3 18:28 +0200)]
update isl for linking against single libclang-cpp library if available

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agoconfigure.ac: link in llvm frontendopenmp component when available
Sven Verdoolaege [Sun, 22 Mar 2020 20:35:22 +0000 (22 21:35 +0100)]
configure.ac: link in llvm frontendopenmp component when available

Since LLVM commit llvmorg-10-init-11542-geb3e81f43f0 ([OpenMP][NFCI]
Introduce llvm/IR/OpenMPConstants.h, Mon Nov 4 22:00:49 2019 -0600),
clang uses this library, while it may not be present in the output
of llvm-config --libs by default.

Reported-by: Chris Elrod <elrodc@gmail.com>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agorerun configure when llvm-config is updated
Sven Verdoolaege [Fri, 17 Jan 2020 19:37:56 +0000 (17 20:37 +0100)]
rerun configure when llvm-config is updated

Several flags are obtained from llvm-config by configure and
these may have changed in an updated llvm-config.
configure should therefore be run again when llvm-config is changed.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agopet.cc: directly include required header
Sven Verdoolaege [Wed, 15 Jan 2020 21:49:32 +0000 (15 22:49 +0100)]
pet.cc: directly include required header

Do so instead of relying on the header getting included indirectly.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agoupdate isl to version 0.22.1
Sven Verdoolaege [Wed, 15 Jan 2020 21:49:12 +0000 (15 22:49 +0100)]
update isl to version 0.22.1

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agopet 0.11.3pet-0.11.3
Sven Verdoolaege [Sat, 12 Oct 2019 10:53:20 +0000 (12 12:53 +0200)]
pet 0.11.3

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agoupdate isl to version 0.22
Sven Verdoolaege [Sat, 12 Oct 2019 10:07:15 +0000 (12 12:07 +0200)]
update isl to version 0.22

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agoREADME: update latest release of clang
Sven Verdoolaege [Sun, 20 Oct 2019 08:30:12 +0000 (20 10:30 +0200)]
README: update latest release of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agointerface/extract_interface.cc: set language defaults first
Sven Verdoolaege [Sat, 19 Oct 2019 21:30:29 +0000 (19 23:30 +0200)]
interface/extract_interface.cc: set language defaults first

In particular, set them before constructing a CompilerInvocation.
LLVM commit 5e866e411ca (Add -fgnuc-version= to control
__GNUC__ and other GCC macros, Thu Oct 10 21:04:25 2019 +0000)
introduced a GNUCVersion option, which gets set
inside CompilerInvocation::CreateFromArgs based
on the command line arguments generated inside BuildCompilation.
Calling CompilerInvocation::setLangDefaults afterwards
caused the flag to be cleared, meaning that the macros
are not defined, possibly resulting in unexpected consequences.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agopet.cc: handle change in CompilerInvocation::CreateFromArgs arguments
Sven Verdoolaege [Sat, 19 Oct 2019 21:27:45 +0000 (19 23:27 +0200)]
pet.cc: handle change in CompilerInvocation::CreateFromArgs arguments

Since LLVM commit 1fac68b0dc1 (ArrayRef'ized
CompilerInvocation::CreateFromArgs, Tue Aug 27 22:13:31 2019 +0000),
CompilerInvocation::CreateFromArgs takes an ArrayRef<const char *>.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agopet.cc: undefine PACKAGE
Sven Verdoolaege [Sat, 19 Oct 2019 21:23:37 +0000 (19 23:23 +0200)]
pet.cc: undefine PACKAGE

Since LLVM commit a079a427085 ([analyzer] Analysis: Silence checkers,
Fri Aug 16 01:53:14 2019 +0000), a PACKAGE symbol is defined in
the clang/StaticAnalyzer/Core/AnalyzerOptions.h header.
Undefine the one defined by config.h to avoid warnings.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agoupdate isl for support for recent versions of clang
Sven Verdoolaege [Sat, 19 Oct 2019 21:22:24 +0000 (19 23:22 +0200)]
update isl for support for recent versions of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agom4/ax_detect_clang.m4: handle replacement of InputKind::C by Language::C
Sven Verdoolaege [Sat, 10 Aug 2019 19:58:10 +0000 (10 21:58 +0200)]
m4/ax_detect_clang.m4: handle replacement of InputKind::C by Language::C

In particular, LLVM commit 09d890d728e extracted Language from InputKind
and made it available as a top-level enum in clang/Basic/LangStandard.h.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agopet.cc: handle FileManager::getFile returning ErrorOr<const FileEntry *>
Sven Verdoolaege [Fri, 9 Aug 2019 15:58:19 +0000 (9 17:58 +0200)]
pet.cc: handle FileManager::getFile returning ErrorOr<const FileEntry *>

LLVM commit 461f0722dd2 changed the return value of
FileManager::getFile to llvm::ErrorOr<const FileEntry *>.
Extract out the embedded const FileEntry * in this case,
while not modifying the return value if it is already
of type const FileEntry * (for older versions of LLVM/clang).
The code uses templates to pick the right version
because llvm::ErrorOr may not even be defined
(in really old versions of LLVM/clang).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agom4/ax_detect_clang.m4: check presence of clang/Basic/LangStandard.h
Sven Verdoolaege [Fri, 9 Aug 2019 15:54:18 +0000 (9 17:54 +0200)]
m4/ax_detect_clang.m4: check presence of clang/Basic/LangStandard.h

This header was introduced in LLVM commit 09d890d728e and
replace clang/Frontend/LangStandard.h.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agoupdate isl for support for recent versions of clang
Sven Verdoolaege [Tue, 6 Aug 2019 20:04:11 +0000 (6 22:04 +0200)]
update isl for support for recent versions of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
4 years agouse PragmaIntroducer as HandlePragma argument
Sven Verdoolaege [Sun, 21 Jul 2019 17:27:21 +0000 (21 19:27 +0200)]
use PragmaIntroducer as HandlePragma argument

LLVM commit ddde0ec1e47 replaced the PragmaIntroducerKind argument
by an PragmaIntroducer argument.  Adjust the argument
in the overriding methods accordingly.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agopet 0.11.2pet-0.11.2
Sven Verdoolaege [Sun, 3 Mar 2019 13:25:24 +0000 (3 14:25 +0100)]
pet 0.11.2

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoupdate isl to version 0.21
Sven Verdoolaege [Sun, 3 Mar 2019 13:25:01 +0000 (3 14:25 +0100)]
update isl to version 0.21

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoREADME: update latest release of clang
Sven Verdoolaege [Sun, 3 Mar 2019 13:15:45 +0000 (3 14:15 +0100)]
README: update latest release of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoREADME: mention that llvm-config is also needed
Sven Verdoolaege [Sun, 3 Mar 2019 13:14:19 +0000 (3 14:14 +0100)]
README: mention that llvm-config is also needed

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoREADME: mention dependence on pkg-config when compiling from git repo
Sven Verdoolaege [Sun, 13 Jan 2019 14:42:19 +0000 (13 15:42 +0100)]
README: mention dependence on pkg-config when compiling from git repo

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoskip functions without valid scops when autodetecting
Sven Verdoolaege [Sun, 13 Jan 2019 14:40:58 +0000 (13 15:40 +0100)]
skip functions without valid scops when autodetecting

When autodetecting, PetScan::scan will return a NULL pointer
when it cannot find a valid scop in a given function.
This NULL pointer gets passed to call_fn, resulting in an error
being raised and no further functions being considered,
without any feedback to the user (since autodetection turn
off diagnostics).  This is especially problematic when
an unanalyzable function appears in an included header.
Simply ignore functions without a valid scop and move on
to the next function (if any).

Reported-by: Daniel Maier <daniel.maier@tu-berlin.de>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agopet.cc: use llvm::opt::ArgStringList when available
Sven Verdoolaege [Sun, 13 Jan 2019 11:31:22 +0000 (13 12:31 +0100)]
pet.cc: use llvm::opt::ArgStringList when available

ArgStringList started out as clang::driver::ArgStringList and
was later moved to llvm::opt::ArgStringList with
a re-export as clang::driver::ArgStringList.  However,
since clang revision 344398, llvm::opt::ArgStringList is no longer
re-exported as clang::driver::ArgStringList,
so use llvm::opt::ArgStringList whenever it is available
(and clang::driver::ArgStringList otherwise).

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agohandle rename of getLocStart to getBeginLoc and getLocEnd to getEndLoc
Sven Verdoolaege [Sun, 13 Jan 2019 11:29:03 +0000 (13 12:29 +0100)]
handle rename of getLocStart to getBeginLoc and getLocEnd to getEndLoc

The old names were deprecated in clang revision 339403 and
removed in clang revision 341573.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoupdate isl for support for recent versions of clang
Sven Verdoolaege [Sun, 13 Jan 2019 13:50:35 +0000 (13 14:50 +0100)]
update isl for support for recent versions of clang

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agorestore ignoring of implicit function declaration warnings on pet built-ins
Sven Verdoolaege [Fri, 21 Sep 2018 13:54:11 +0000 (21 15:54 +0200)]
restore ignoring of implicit function declaration warnings on pet built-ins

Older versions of clang generate a diag::ext_implicit_function_decl
with a single argument, but since revision 314872, the warning
has a second argument (indicating whether the language is OpenCL).
Also ignore the warning in the presence of such an extra argument.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoupdate isl for move of interface/all.h
Sven Verdoolaege [Sun, 12 Aug 2018 09:10:21 +0000 (12 11:10 +0200)]
update isl for move of interface/all.h

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agointerface: make language bindings depend on all relevant headers
Sven Verdoolaege [Sun, 12 Aug 2018 08:45:42 +0000 (12 10:45 +0200)]
interface: make language bindings depend on all relevant headers

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoonly build isl.py and when extract_interface is available
Sven Verdoolaege [Sun, 12 Aug 2018 08:53:54 +0000 (12 10:53 +0200)]
only build isl.py and when extract_interface is available

The isl.py target in itself is fairly harmless since isl.py
is not built by default and therefore only results in failures
when the bindings are being built explicitly (or on "make dist").
However, the next commit will introduce a libdep.a target,
which well get built by default while
it can only be built with a bundled or build isl submodule.
Hide the entire isl.py machinery behind a conditional to avoid
failures when a system isl submodule is being used.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agodetect failures in isl.py generation
Sven Verdoolaege [Sun, 12 Aug 2018 08:37:13 +0000 (12 10:37 +0200)]
detect failures in isl.py generation

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoMakefile.am: use automatic variable for target
Sven Verdoolaege [Sun, 12 Aug 2018 08:32:20 +0000 (12 10:32 +0200)]
Makefile.am: use automatic variable for target

This should be less error-prone.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agopet 0.11.1pet-0.11.1
Sven Verdoolaege [Tue, 17 Jul 2018 09:12:04 +0000 (17 11:12 +0200)]
pet 0.11.1

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
5 years agoupdate isl to version 0.20
Sven Verdoolaege [Tue, 17 Jul 2018 09:08:44 +0000 (17 11:08 +0200)]
update isl to version 0.20

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agosummary.c: directly include required headers
Sven Verdoolaege [Tue, 24 Apr 2018 17:07:40 +0000 (24 19:07 +0200)]
summary.c: directly include required headers

Do so instead of relying on the headers getting included indirectly.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agosubstituter.cc: directly include required headers
Sven Verdoolaege [Tue, 24 Apr 2018 17:07:09 +0000 (24 19:07 +0200)]
substituter.cc: directly include required headers

Do so instead of relying on the headers getting included indirectly.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agopet 0.11pet-0.11
Sven Verdoolaege [Sat, 17 Feb 2018 15:08:40 +0000 (17 16:08 +0100)]
pet 0.11

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agoupdate isl to version 0.19
Sven Verdoolaege [Sat, 17 Feb 2018 13:41:23 +0000 (17 14:41 +0100)]
update isl to version 0.19

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agoconfigure.ac: drop -Wl,--no-keep-files-mapped from llvm-config --cxxflags output
Sven Verdoolaege [Sat, 17 Feb 2018 14:50:55 +0000 (17 15:50 +0100)]
configure.ac: drop -Wl,--no-keep-files-mapped from llvm-config --cxxflags output

Apparently, Ubuntu compiles clang with "-Wl,--no-keep-files-mapped",
which is a linker flag that is specific to gold, and it ends up
in the output of "llvm-config --cxxflags".  Now, "-fuse-ld=gold"
also appears in the output, but that flag apparently gets
stripped off by libtool, resulting in linker errors when
trying to link libpet.la if gold is not the default linker.
Arguably, these flags should not be included in the output
of "llvm-config --cxxflags", but remove "-Wl,--no-keep-files-mapped"
if it does.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agoPetScan::set_upper_bounds: avoid invalid access in case of error
Sven Verdoolaege [Sun, 10 Dec 2017 15:57:47 +0000 (10 16:57 +0100)]
PetScan::set_upper_bounds: avoid invalid access in case of error

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agoPetASTConsumer: propagate errors during construction of pet_scop
Sven Verdoolaege [Wed, 29 Nov 2017 08:22:04 +0000 (29 09:22 +0100)]
PetASTConsumer: propagate errors during construction of pet_scop

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agopet.cc: pet_transform: handle NULL input
Sven Verdoolaege [Mon, 27 Nov 2017 15:49:19 +0000 (27 16:49 +0100)]
pet.cc: pet_transform: handle NULL input

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agopet.cc: pet_foreach_scop_in_C_source: return isl_stat
Sven Verdoolaege [Thu, 30 Nov 2017 09:16:02 +0000 (30 10:16 +0100)]
pet.cc: pet_foreach_scop_in_C_source: return isl_stat

This clarifies what the possible return values are.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agopet_expr_access_project_out_arg: improve error handling
Sven Verdoolaege [Mon, 27 Nov 2017 14:31:54 +0000 (27 15:31 +0100)]
pet_expr_access_project_out_arg: improve error handling

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agopet_expr_insert_arg: use pet_expr_access_get_domain_space
Sven Verdoolaege [Mon, 27 Nov 2017 14:18:16 +0000 (27 15:18 +0100)]
pet_expr_insert_arg: use pet_expr_access_get_domain_space

Do so instead of peeking into a (possibly NULL) pet_expr.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
6 years agoscop_plus.cc: extract_list: improve error handling
Sven Verdoolaege [Mon, 27 Nov 2017 15:44:27 +0000 (27 16:44 +0100)]
scop_plus.cc: extract_list: improve error handling

In particular, avoid an infinite recursion on NULL input.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>