Move polly options into separate option category

Use the new cl::OptionCategory support to move the Polly options into a separate
option category. The aim is to hide most options and show by default only the
options a user needs to influence '-O3 -polly'. The available options probably
need some care, but here is the current status:

Polly Options:
Configure the polly loop optimizer

  -enable-polly-openmp              - Generate OpenMP parallel code
  -polly                            - Enable the polly optimizer (only at -O3)
  -polly-no-tiling                  - Disable tiling in the scheduler
  -polly-only-func=<function-name>  - Only run on a single function
  -polly-report                     - Print information about the activities
                                      of Polly
  -polly-vectorizer                 - Select the vectorization strategy
    =none                           -   No Vectorization
    =polly                          -   Polly internal vectorizer
    =unroll-only                    -   Only grouped unroll the vectorize
                                        candidate loops
    =bb                             -   The Basic Block vectorizer driven by
                                        Polly

llvm-svn: 181295
This commit is contained in:
Tobias Grosser 2013-05-07 07:31:10 +00:00
parent e602a07662
commit 637bd63123
16 changed files with 105 additions and 69 deletions

View File

@ -0,0 +1,20 @@
//===--------------- polly/Options.h - The Polly option category *- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Introduce an option category for Polly.
//
//===----------------------------------------------------------------------===//
#ifndef POLLY_OPTIONS_H
#define POLLY_OPTIONS_H
#include "llvm/Support/CommandLine.h"
extern llvm::cl::OptionCategory PollyCategory;
#endif

View File

@ -23,13 +23,10 @@
#include "polly/Dependences.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
#define DEBUG_TYPE "polly-dependences"
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
#include <isl/aff.h>
#include <isl/flow.h>
#include <isl/map.h>
@ -41,12 +38,12 @@ using namespace llvm;
static cl::opt<bool>
LegalityCheckDisabled("disable-polly-legality",
cl::desc("Disable polly legality check"), cl::Hidden,
cl::init(false));
cl::init(false), cl::cat(PollyCategory));
static cl::opt<bool>
ValueDependences("polly-value-dependences",
cl::desc("Use value instead of memory based dependences"),
cl::Hidden, cl::init(true));
cl::Hidden, cl::init(true), cl::cat(PollyCategory));
//===----------------------------------------------------------------------===//
Dependences::Dependences() : ScopPass(ID) { RAW = WAR = WAW = NULL; }

View File

@ -46,6 +46,7 @@
#include "polly/CodeGen/BlockGenerators.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/Support/ScopHelper.h"
#include "polly/Support/SCEVValidator.h"
@ -58,7 +59,6 @@
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/DebugInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Assembly/Writer.h"
#define DEBUG_TYPE "polly-detect"
@ -70,23 +70,24 @@ using namespace llvm;
using namespace polly;
static cl::opt<std::string>
OnlyFunction("polly-detect-only", cl::desc("Only detect scops in function"),
cl::Hidden, cl::value_desc("The function name to detect scops in"),
cl::ValueRequired, cl::init(""));
OnlyFunction("polly-only-func", cl::desc("Only run on a single function"),
cl::value_desc("function-name"), cl::ValueRequired, cl::init(""),
cl::cat(PollyCategory));
static cl::opt<bool>
IgnoreAliasing("polly-ignore-aliasing",
cl::desc("Ignore possible aliasing of the array bases"),
cl::Hidden, cl::init(false));
cl::Hidden, cl::init(false), cl::cat(PollyCategory));
static cl::opt<bool> ReportLevel("polly-report",
cl::desc("Print information about Polly"),
cl::Hidden, cl::init(false));
static cl::opt<bool>
ReportLevel("polly-report",
cl::desc("Print information about the activities of Polly"),
cl::init(false), cl::cat(PollyCategory));
static cl::opt<bool>
AllowNonAffine("polly-allow-nonaffine",
cl::desc("Allow non affine access functions in arrays"),
cl::Hidden, cl::init(false));
cl::Hidden, cl::init(false), cl::cat(PollyCategory));
//===----------------------------------------------------------------------===//
// Statistics.

View File

@ -16,6 +16,7 @@
#include "polly/ScopInfo.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/CodeGen/BlockGenerators.h"
#include "polly/Options.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/SCEVValidator.h"
#include "polly/Support/ScopHelper.h"
@ -24,7 +25,6 @@
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Support/CommandLine.h"
#include "isl/aff.h"
#include "isl/set.h"
@ -35,12 +35,12 @@ using namespace polly;
static cl::opt<bool>
Aligned("enable-polly-aligned", cl::desc("Assumed aligned memory accesses."),
cl::Hidden, cl::value_desc("OpenMP code generation enabled if true"),
cl::init(false), cl::ZeroOrMore);
cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
static cl::opt<bool, true>
SCEVCodegenF("polly-codegen-scev", cl::desc("Use SCEV based code generation."),
cl::Hidden, cl::location(SCEVCodegen), cl::init(false),
cl::ZeroOrMore);
cl::ZeroOrMore, cl::cat(PollyCategory));
bool polly::SCEVCodegen;

View File

@ -26,6 +26,7 @@
#define DEBUG_TYPE "polly-codegen"
#include "polly/Dependences.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/TempScopInfo.h"
#include "polly/CodeGen/CodeGeneration.h"
@ -41,7 +42,6 @@
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@ -63,19 +63,19 @@ struct isl_set;
namespace polly {
static cl::opt<bool>
OpenMP("enable-polly-openmp", cl::desc("Generate OpenMP parallel code"),
cl::Hidden, cl::value_desc("OpenMP code generation enabled if true"),
cl::init(false), cl::ZeroOrMore);
cl::value_desc("OpenMP code generation enabled if true"),
cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
#ifdef GPU_CODEGEN
static cl::opt<bool>
GPGPU("enable-polly-gpgpu", cl::desc("Generate GPU parallel code"), cl::Hidden,
cl::value_desc("GPGPU code generation enabled if true"), cl::init(false),
cl::ZeroOrMore);
cl::ZeroOrMore, cl::cat(PollyCategory));
static cl::opt<std::string>
GPUTriple("polly-gpgpu-triple",
cl::desc("Target triple for GPU code generation"), cl::Hidden,
cl::init(""));
cl::init(""), cl::cat(PollyCategory));
#endif /* GPU_CODEGEN */
typedef DenseMap<const char *, Value *> CharMapT;

View File

@ -24,10 +24,10 @@
#include "polly/LinkAllPasses.h"
#include "polly/Dependences.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#define DEBUG_TYPE "polly-ast"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "isl/union_map.h"
@ -42,11 +42,13 @@ using namespace polly;
static cl::opt<bool> UseContext("polly-ast-use-context",
cl::desc("Use context"), cl::Hidden,
cl::init(false), cl::ZeroOrMore);
cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
static cl::opt<bool> DetectParallel("polly-ast-detect-parallel",
cl::desc("Detect parallelism"), cl::Hidden,
cl::init(false), cl::ZeroOrMore);
cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
namespace polly {
class IslAst {

View File

@ -13,10 +13,10 @@
#include "polly/LinkAllPasses.h"
#include "polly/Dependences.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/system_error.h"
@ -46,13 +46,13 @@ static cl::opt<std::string>
ImportDir("polly-import-jscop-dir",
cl::desc("The directory to import the .jscop files from."),
cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
cl::init("."));
cl::init("."), cl::cat(PollyCategory));
static cl::opt<std::string>
ImportPostfix("polly-import-jscop-postfix",
cl::desc("Postfix to append to the import .jsop files."),
cl::Hidden, cl::value_desc("File postfix"), cl::ValueRequired,
cl::init(""));
cl::init(""), cl::cat(PollyCategory));
struct JSONExporter : public ScopPass {
static char ID;

View File

@ -15,10 +15,10 @@
#ifdef OPENSCOP_FOUND
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Assembly/Writer.h"
#define OPENSCOP_INT_T_IS_MP
@ -36,7 +36,8 @@ namespace {
static cl::opt<std::string>
ExportDir("polly-export-dir",
cl::desc("The directory to export the .scop files to."), cl::Hidden,
cl::value_desc("Directory path"), cl::ValueRequired, cl::init("."));
cl::value_desc("Directory path"), cl::ValueRequired, cl::init("."),
cl::cat(PollyCategory));
struct ScopExporter : public ScopPass {
static char ID;

View File

@ -15,10 +15,9 @@
#include "polly/LinkAllPasses.h"
#include "polly/Dependences.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Assembly/Writer.h"
#ifdef OPENSCOP_FOUND

View File

@ -15,11 +15,11 @@
#ifdef SCOPLIB_FOUND
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "polly/ScopLib.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Assembly/Writer.h"
#include "stdio.h"
@ -34,7 +34,7 @@ static cl::opt<std::string>
ExportDir("polly-export-scoplib-dir",
cl::desc("The directory to export the .scoplib files to."),
cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
cl::init("."));
cl::init("."), cl::cat(PollyCategory));
class ScopLibExporter : public ScopPass {
Scop *S;

View File

@ -16,10 +16,11 @@
#ifdef SCOPLIB_FOUND
#include "polly/Dependences.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/ScopLib.h"
#include "polly/Dependences.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Assembly/Writer.h"
#define SCOPLIB_INT_T_IS_MP
@ -36,12 +37,13 @@ static cl::opt<std::string>
ImportDir("polly-import-scoplib-dir",
cl::desc("The directory to import the .scoplib files from."),
cl::Hidden, cl::value_desc("Directory path"), cl::ValueRequired,
cl::init("."));
cl::init("."), cl::cat(PollyCategory));
static cl::opt<std::string>
ImportPostfix("polly-import-scoplib-postfix",
cl::desc("Postfix to append to the import .scoplib files."),
cl::Hidden, cl::value_desc("File postfix"), cl::ValueRequired,
cl::init(""));
cl::init(""), cl::cat(PollyCategory));
struct ScopLibImporter : public RegionPass {
static char ID;

View File

@ -17,12 +17,12 @@
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/Dependences.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
#define DEBUG_TYPE "polly-opt-pluto"
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
#include "pluto/libpluto.h"
#include "isl/map.h"
@ -31,7 +31,8 @@ using namespace llvm;
using namespace polly;
static cl::opt<bool> EnableTiling("polly-pluto-tile", cl::desc("Enable tiling"),
cl::Hidden, cl::init(false));
cl::Hidden, cl::init(false),
cl::cat(PollyCategory));
namespace {
/// Convert an int into a string.

View File

@ -21,6 +21,7 @@
#ifdef SCOPLIB_FOUND
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/Dependences.h"
#include "polly/Options.h"
#include "polly/ScheduleOptimizer.h"
#include "polly/ScopInfo.h"
@ -29,7 +30,6 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/system_error.h"
#include "llvm/ADT/OwningPtr.h"
@ -44,7 +44,8 @@ using namespace polly;
static cl::opt<std::string> PlutoFuse("pluto-fuse", cl::desc(""), cl::Hidden,
cl::value_desc("Set fuse mode of Pluto"),
cl::init("maxfuse"));
cl::init("maxfuse"),
cl::cat(PollyCategory));
namespace {

View File

@ -26,22 +26,24 @@
#include "polly/CodeGen/Cloog.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/Dependences.h"
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/ScopInfo.h"
#include "polly/TempScopInfo.h"
#include "llvm/Analysis/CFGPrinter.h"
#include "llvm/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/Transforms/Vectorize.h"
using namespace llvm;
cl::OptionCategory PollyCategory("Polly Options",
"Configure the polly loop optimizer");
static cl::opt<bool>
PollyEnabled("polly", cl::desc("Enable the default passes of Polly in -O3"),
cl::init(false), cl::ZeroOrMore);
PollyEnabled("polly", cl::desc("Enable the polly optimizer (only at -O3)"),
cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
enum OptimizerChoice {
OPTIMIZER_NONE,
@ -66,7 +68,8 @@ static cl::opt<OptimizerChoice> Optimizer(
#endif
clEnumValN(OPTIMIZER_ISL, "isl", "The isl scheduling optimizer"),
clEnumValEnd),
cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore);
cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore,
cl::cat(PollyCategory));
enum CodeGenChoice {
#ifdef CLOOG_FOUND
@ -90,11 +93,12 @@ static cl::opt<CodeGenChoice> CodeGenerator(
#endif
clEnumValN(CODEGEN_ISL, "isl", "isl code generator"),
clEnumValN(CODEGEN_NONE, "none", "no code generation"), clEnumValEnd),
cl::Hidden, cl::init(DefaultCodeGen), cl::ZeroOrMore);
cl::Hidden, cl::init(DefaultCodeGen), cl::ZeroOrMore,
cl::cat(PollyCategory));
VectorizerChoice polly::PollyVectorizerChoice;
static cl::opt<polly::VectorizerChoice, true> Vectorizer(
"polly-vectorizer", cl::desc("Select the scheduling optimizer"),
"polly-vectorizer", cl::desc("Select the vectorization strategy"),
cl::values(clEnumValN(polly::VECTORIZER_NONE, "none", "No Vectorization"),
clEnumValN(polly::VECTORIZER_POLLY, "polly",
"Polly internal vectorizer"),
@ -103,44 +107,52 @@ static cl::opt<polly::VectorizerChoice, true> Vectorizer(
clEnumValN(polly::VECTORIZER_BB, "bb",
"The Basic Block vectorizer driven by Polly"),
clEnumValEnd),
cl::Hidden, cl::location(PollyVectorizerChoice),
cl::init(polly::VECTORIZER_NONE), cl::ZeroOrMore);
cl::location(PollyVectorizerChoice), cl::init(polly::VECTORIZER_NONE),
cl::ZeroOrMore, cl::cat(PollyCategory));
static cl::opt<bool>
ImportJScop("polly-import",
cl::desc("Export the polyhedral description of the detected Scops"),
cl::Hidden, cl::init(false), cl::ZeroOrMore);
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
static cl::opt<bool>
ExportJScop("polly-export",
cl::desc("Export the polyhedral description of the detected Scops"),
cl::Hidden, cl::init(false), cl::ZeroOrMore);
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
static cl::opt<bool> DeadCodeElim("polly-run-dce",
cl::desc("Run the dead code elimination"),
cl::Hidden, cl::init(false), cl::ZeroOrMore);
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
static cl::opt<bool>
PollyViewer("polly-show", cl::desc("Enable the Polly DOT viewer in -O3"),
cl::Hidden, cl::value_desc("Run the Polly DOT viewer at -O3"),
cl::init(false), cl::ZeroOrMore);
cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
static cl::opt<bool> PollyOnlyViewer(
"polly-show-only",
cl::desc("Enable the Polly DOT viewer in -O3 (no BB content)"), cl::Hidden,
cl::value_desc("Run the Polly DOT viewer at -O3 (no BB content"),
cl::init(false));
cl::init(false), cl::cat(PollyCategory));
static cl::opt<bool>
PollyPrinter("polly-dot", cl::desc("Enable the Polly DOT printer in -O3"),
cl::Hidden, cl::value_desc("Run the Polly DOT printer at -O3"),
cl::init(false));
cl::init(false), cl::cat(PollyCategory));
static cl::opt<bool> PollyOnlyPrinter(
"polly-dot-only",
cl::desc("Enable the Polly DOT printer in -O3 (no BB content)"), cl::Hidden,
cl::value_desc("Run the Polly DOT printer at -O3 (no BB content"),
cl::init(false));
cl::init(false), cl::cat(PollyCategory));
static cl::opt<bool>
CFGPrinter("polly-view-cfg",
cl::desc("Show the Polly CFG right after code generation"),
cl::Hidden, cl::init(false));
cl::Hidden, cl::init(false), cl::cat(PollyCategory));
namespace {
static void initializePollyPasses(PassRegistry &Registry) {

View File

@ -22,6 +22,7 @@
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/Dependences.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "isl/aff.h"
@ -34,7 +35,6 @@
#define DEBUG_TYPE "polly-opt-isl"
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
using namespace polly;
@ -42,38 +42,38 @@ using namespace polly;
namespace polly { bool DisablePollyTiling; }
static cl::opt<bool, true>
DisableTiling("polly-no-tiling", cl::desc("Disable tiling in the scheduler"),
cl::Hidden, cl::location(polly::DisablePollyTiling),
cl::init(false));
cl::location(polly::DisablePollyTiling), cl::init(false),
cl::cat(PollyCategory));
static cl::opt<std::string>
OptimizeDeps("polly-opt-optimize-only",
cl::desc("Only a certain kind of dependences (all/raw)"),
cl::Hidden, cl::init("all"));
cl::Hidden, cl::init("all"), cl::cat(PollyCategory));
static cl::opt<std::string>
SimplifyDeps("polly-opt-simplify-deps",
cl::desc("Dependences should be simplified (yes/no)"), cl::Hidden,
cl::init("yes"));
cl::init("yes"), cl::cat(PollyCategory));
static cl::opt<int>
MaxConstantTerm("polly-opt-max-constant-term",
cl::desc("The maximal constant term allowed (-1 is unlimited)"),
cl::Hidden, cl::init(20));
cl::Hidden, cl::init(20), cl::cat(PollyCategory));
static cl::opt<int>
MaxCoefficient("polly-opt-max-coefficient",
cl::desc("The maximal coefficient allowed (-1 is unlimited)"),
cl::Hidden, cl::init(20));
cl::Hidden, cl::init(20), cl::cat(PollyCategory));
static cl::opt<std::string>
FusionStrategy("polly-opt-fusion",
cl::desc("The fusion strategy to choose (min/max)"), cl::Hidden,
cl::init("min"));
cl::init("min"), cl::cat(PollyCategory));
static cl::opt<std::string>
MaximizeBandDepth("polly-opt-maximize-bands",
cl::desc("Maximize the band depth (yes/no)"), cl::Hidden,
cl::init("yes"));
cl::init("yes"), cl::cat(PollyCategory));
namespace {

View File

@ -1,4 +1,4 @@
; RUN: opt %loadPolly %defaultOpts -polly-cloog -analyze -polly-detect-only=bar < %s | FileCheck %s
; RUN: opt %loadPolly %defaultOpts -polly-cloog -analyze -polly-only-func=bar < %s | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"