Polly 20.0.0git
|
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/CodeGen/IRBuilder.h"
#include "polly/CodeGen/IslAst.h"
#include "polly/CodeGen/IslNodeBuilder.h"
#include "polly/CodeGen/PerfMonitor.h"
#include "polly/CodeGen/Utils.h"
#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/ScopHelper.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "isl/ast.h"
#include <cassert>
#include "polly/Support/PollyDebug.h"
Go to the source code of this file.
Namespaces | |
namespace | polly |
Macros | |
#define | DEBUG_TYPE "polly-codegen" |
Functions | |
static cl::opt< bool > | Verify ("polly-codegen-verify", cl::desc("Verify the function generated by Polly"), cl::Hidden, cl::cat(PollyCategory)) |
static cl::opt< bool, true > | XPerfMonitoring ("polly-codegen-perf-monitoring", cl::desc("Add run-time performance monitoring"), cl::Hidden, cl::location(polly::PerfMonitoring), cl::cat(PollyCategory)) |
STATISTIC (ScopsProcessed, "Number of SCoP processed") | |
STATISTIC (CodegenedScops, "Number of successfully generated SCoPs") | |
STATISTIC (CodegenedAffineLoops, "Number of original affine loops in SCoPs that have been generated") | |
STATISTIC (CodegenedBoxedLoops, "Number of original boxed loops in SCoPs that have been generated") | |
void | polly::markBlockUnreachable (BasicBlock &Block, PollyIRBuilder &Builder) |
Mark a basic block unreachable. | |
static void | verifyGeneratedFunction (Scop &S, Function &F, IslAstInfo &AI) |
static void | fixRegionInfo (Function &F, Region &ParentRegion, RegionInfo &RI) |
static void | removeLifetimeMarkers (Region *R) |
Remove all lifetime markers (llvm.lifetime.start, llvm.lifetime.end) from @R. | |
static bool | generateCode (Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT, ScalarEvolution &SE, RegionInfo &RI) |
INITIALIZE_PASS_BEGIN (CodeGeneration, "polly-codegen", "Polly - Create LLVM-IR from SCoPs", false, false) | |
INITIALIZE_PASS_DEPENDENCY (DependenceInfo) | |
INITIALIZE_PASS_DEPENDENCY (DominatorTreeWrapperPass) | |
INITIALIZE_PASS_DEPENDENCY (LoopInfoWrapperPass) | |
INITIALIZE_PASS_DEPENDENCY (RegionInfoPass) | |
INITIALIZE_PASS_DEPENDENCY (ScalarEvolutionWrapperPass) | |
INITIALIZE_PASS_DEPENDENCY (ScopDetectionWrapperPass) | |
#define DEBUG_TYPE "polly-codegen" |
Definition at line 51 of file CodeGeneration.cpp.
|
static |
Definition at line 107 of file CodeGeneration.cpp.
Referenced by generateCode().
|
static |
Definition at line 169 of file CodeGeneration.cpp.
References polly::IslNodeBuilder::addParameters(), polly::IslNodeBuilder::allocateNewArrays(), assert, polly::ScopAnnotator::buildAliasScopes(), polly::IslNodeBuilder::create(), polly::IslNodeBuilder::createRTC(), polly::executeScopConditionally(), polly::IslNodeBuilder::finalize(), fixRegionInfo(), Function, polly::IslAst::getAst(), polly::IslAstInfo::getIslAst(), polly::IslNodeBuilder::getParallelSubfunctions(), polly::IslAstInfo::getRunCondition(), polly::IslAst::getSharedIslCtx(), polly::PerfMonitor::initialize(), polly::PerfMonitor::insertRegionEnd(), polly::PerfMonitor::insertRegionStart(), isl::ast_node::is_null(), polly::markBlockUnreachable(), polly::PerfMonitoring, POLLY_DEBUG, polly::IslNodeBuilder::preloadInvariantLoads(), isl::ast_expr::release(), isl::ast_node::release(), removeLifetimeMarkers(), polly::simplifyRegion(), polly::Value, and verifyGeneratedFunction().
Referenced by polly::CodeGenerationPass::run().
INITIALIZE_PASS_BEGIN | ( | CodeGeneration | , |
"polly-codegen" | , | ||
"Polly - Create LLVM-IR from SCoPs" | , | ||
false | , | ||
false | |||
) |
INITIALIZE_PASS_DEPENDENCY | ( | DependenceInfo | ) |
INITIALIZE_PASS_DEPENDENCY | ( | DominatorTreeWrapperPass | ) |
INITIALIZE_PASS_DEPENDENCY | ( | LoopInfoWrapperPass | ) |
INITIALIZE_PASS_DEPENDENCY | ( | RegionInfoPass | ) |
INITIALIZE_PASS_DEPENDENCY | ( | ScalarEvolutionWrapperPass | ) |
INITIALIZE_PASS_DEPENDENCY | ( | ScopDetectionWrapperPass | ) |
|
static |
Remove all lifetime markers (llvm.lifetime.start, llvm.lifetime.end) from @R.
CodeGeneration does not copy lifetime markers into the optimized SCoP, which would leave the them only in the original path. This can transform code such as
llvm.lifetime.start(%p) llvm.lifetime.end(%p)
into
if (RTC) { // generated code } else { // original code llvm.lifetime.start(%p) } llvm.lifetime.end(%p)
The current StackColoring algorithm cannot handle if some, but not all, paths from the end marker to the entry block cross the start marker. Same for start markers that do not always cross the end markers. We avoid any issues by removing all lifetime markers, even from the original code.
A better solution could be to hoist all llvm.lifetime.start to the split node and all llvm.lifetime.end to the merge node, which should be conservatively correct.
Definition at line 144 of file CodeGeneration.cpp.
Referenced by generateCode().
STATISTIC | ( | CodegenedAffineLoops | , |
"Number of original affine loops in SCoPs that have been generated" | |||
) |
STATISTIC | ( | CodegenedBoxedLoops | , |
"Number of original boxed loops in SCoPs that have been generated" | |||
) |
STATISTIC | ( | CodegenedScops | , |
"Number of successfully generated SCoPs" | |||
) |
STATISTIC | ( | ScopsProcessed | , |
"Number of SCoP processed" | |||
) |
|
static |
Referenced by polly::ScopDetection::isMaxRegionInScop(), and verifyGeneratedFunction().
|
static |
Definition at line 86 of file CodeGeneration.cpp.
References POLLY_DEBUG, polly::IslAstInfo::print(), and Verify().
Referenced by generateCode().
|
static |