Polly 19.0.0git
Utils.h
Go to the documentation of this file.
1//===- Utils.h - Utility functions for code generation ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains utility functions for the code generation.
10//===----------------------------------------------------------------------===//
11
12#ifndef POLLY_CODEGEN_UTILS_H
13#define POLLY_CODEGEN_UTILS_H
14
15#include <utility>
16
17namespace llvm {
18class Pass;
19class Value;
20class BasicBlock;
21class DominatorTree;
22class RegionInfo;
23class LoopInfo;
24class BranchInst;
25} // namespace llvm
26
27namespace polly {
28
29class Scop;
30
31using BBPair = std::pair<llvm::BasicBlock *, llvm::BasicBlock *>;
32/// Execute a Scop conditionally wrt @p RTC.
33///
34/// In the CFG the optimized code of the Scop is generated next to the
35/// original code. Both the new and the original version of the code remain
36/// in the CFG. A branch statement decides which version is executed based on
37/// the runtime value of @p RTC.
38///
39/// Before transformation:
40///
41/// bb0
42/// |
43/// orig_scop
44/// |
45/// bb1
46///
47/// After transformation:
48/// bb0
49/// |
50/// polly.splitBlock
51/// / \.
52/// | startBlock
53/// | |
54/// orig_scop new_scop
55/// \ /
56/// \ /
57/// bb1 (joinBlock)
58///
59/// @param S The Scop to execute conditionally.
60/// @param P A reference to the pass calling this function.
61/// @param RTC The runtime condition checked before executing the new SCoP.
62///
63/// @return An std::pair:
64/// - The first element is a BBPair of (StartBlock, EndBlock).
65/// - The second element is the BranchInst which conditionally
66/// branches to the SCoP based on the RTC.
67///
68std::pair<BBPair, llvm::BranchInst *>
69executeScopConditionally(Scop &S, llvm::Value *RTC, llvm::DominatorTree &DT,
70 llvm::RegionInfo &RI, llvm::LoopInfo &LI);
71} // namespace polly
72#endif
Static Control Part.
Definition: ScopInfo.h:1628
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
std::pair< llvm::BasicBlock *, llvm::BasicBlock * > BBPair
Type to hold region delimiters (entry & exit block).
Definition: Utils.h:31
@ Value
MemoryKind::Value: Models an llvm::Value.
std::pair< BBPair, llvm::BranchInst * > executeScopConditionally(Scop &S, llvm::Value *RTC, llvm::DominatorTree &DT, llvm::RegionInfo &RI, llvm::LoopInfo &LI)
Execute a Scop conditionally wrt RTC.