diff options
| author | Tobias Grosser <tobias@grosser.es> | 2015-02-04 20:55:43 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2015-02-04 20:55:43 +0000 |
| commit | 52a25237d894fd5736a90f11df2c5c9391d13fd5 (patch) | |
| tree | 2b0e65b1e1de52b56aaa9b04999fe6223d1a7b0f /polly/lib/External/isl/cat.c | |
| parent | b6472fe3da9a20bcceb7b24af4ce9f0c4e79b254 (diff) | |
| download | bcm5719-llvm-52a25237d894fd5736a90f11df2c5c9391d13fd5.tar.gz bcm5719-llvm-52a25237d894fd5736a90f11df2c5c9391d13fd5.zip | |
Import isl(+imath) as an external library into Polly
With this patch Polly is always GPL-free (no dependency on GMP any more). As a
result, building and distributing Polly will be easier. Furthermore, there is no
need to tightly coordinate isl and Polly releases anymore.
We import isl b3e0fa7a05d as well as imath 4d707e5ef2. These are the git
versions Polly currently was tested with when using utils/checkout_isl.sh. The
imported libraries are both MIT-style licensed.
We build isl and imath with -fvisibility=hidden to avoid clashes in case other
projects (such as gcc) use conflicting versions of isl. The use of imath can
temporarily reduce compile-time performance of Polly. We will work on
performance tuning in tree.
Patches to isl should be contributed first to the main isl repository and can
then later be reimported to Polly.
This patch is also a prerequisite for the upcoming isl C++ interface.
llvm-svn: 228193
Diffstat (limited to 'polly/lib/External/isl/cat.c')
| -rw-r--r-- | polly/lib/External/isl/cat.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/polly/lib/External/isl/cat.c b/polly/lib/External/isl/cat.c new file mode 100644 index 00000000000..63131420592 --- /dev/null +++ b/polly/lib/External/isl/cat.c @@ -0,0 +1,58 @@ +#include <assert.h> +#include <isl/obj.h> +#include <isl/printer.h> +#include <isl/stream.h> +#include <isl/options.h> + +struct isl_arg_choice cat_format[] = { + {"isl", ISL_FORMAT_ISL}, + {"omega", ISL_FORMAT_OMEGA}, + {"polylib", ISL_FORMAT_POLYLIB}, + {"ext-polylib", ISL_FORMAT_EXT_POLYLIB}, + {"latex", ISL_FORMAT_LATEX}, + {0} +}; + +struct cat_options { + struct isl_options *isl; + unsigned format; +}; + +ISL_ARGS_START(struct cat_options, cat_options_args) +ISL_ARG_CHILD(struct cat_options, isl, "isl", &isl_options_args, "isl options") +ISL_ARG_CHOICE(struct cat_options, format, 0, "format", \ + cat_format, ISL_FORMAT_ISL, "output format") +ISL_ARGS_END + +ISL_ARG_DEF(cat_options, struct cat_options, cat_options_args) + +int main(int argc, char **argv) +{ + struct isl_ctx *ctx; + struct isl_stream *s; + struct isl_obj obj; + struct cat_options *options; + isl_printer *p; + + options = cat_options_new_with_defaults(); + assert(options); + argc = cat_options_parse(options, argc, argv, ISL_ARG_ALL); + + ctx = isl_ctx_alloc_with_options(&cat_options_args, options); + + s = isl_stream_new_file(ctx, stdin); + obj = isl_stream_read_obj(s); + isl_stream_free(s); + + p = isl_printer_to_file(ctx, stdout); + p = isl_printer_set_output_format(p, options->format); + p = obj.type->print(p, obj.v); + p = isl_printer_end_line(p); + isl_printer_free(p); + + obj.type->free(obj.v); + + isl_ctx_free(ctx); + + return 0; +} |

