Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/opt/ir_context.h')
-rw-r--r--source/opt/ir_context.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/opt/ir_context.h b/source/opt/ir_context.h
index 2f27942b4..9dee84e9b 100644
--- a/source/opt/ir_context.h
+++ b/source/opt/ir_context.h
@@ -35,6 +35,7 @@
#include "source/opt/dominator_analysis.h"
#include "source/opt/feature_manager.h"
#include "source/opt/fold.h"
+#include "source/opt/liveness.h"
#include "source/opt/loop_descriptor.h"
#include "source/opt/module.h"
#include "source/opt/register_pressure.h"
@@ -81,6 +82,7 @@ class IRContext {
kAnalysisConstants = 1 << 14,
kAnalysisTypes = 1 << 15,
kAnalysisDebugInfo = 1 << 16,
+ kAnalysisLiveness = 1 << 17,
kAnalysisEnd = 1 << 17
};
@@ -248,6 +250,15 @@ class IRContext {
return def_use_mgr_.get();
}
+ // Returns a pointer to a liveness manager. If the liveness manager is
+ // invalid, it is rebuilt first.
+ analysis::LivenessManager* get_liveness_mgr() {
+ if (!AreAnalysesValid(kAnalysisLiveness)) {
+ BuildLivenessManager();
+ }
+ return liveness_mgr_.get();
+ }
+
// Returns a pointer to a value number table. If the liveness analysis is
// invalid, it is rebuilt first.
ValueNumberTable* GetValueNumberTable() {
@@ -625,6 +636,10 @@ class IRContext {
// the function that contains |bb|.
bool IsReachable(const opt::BasicBlock& bb);
+ // Return the stage of the module. Will generate error if entry points don't
+ // all have the same stage.
+ SpvExecutionModel GetStage();
+
private:
// Builds the def-use manager from scratch, even if it was already valid.
void BuildDefUseManager() {
@@ -632,6 +647,12 @@ class IRContext {
valid_analyses_ = valid_analyses_ | kAnalysisDefUse;
}
+ // Builds the liveness manager from scratch, even if it was already valid.
+ void BuildLivenessManager() {
+ liveness_mgr_ = MakeUnique<analysis::LivenessManager>(this);
+ valid_analyses_ = valid_analyses_ | kAnalysisLiveness;
+ }
+
// Builds the instruction-block map for the whole module.
void BuildInstrToBlockMapping() {
instr_to_block_.clear();
@@ -852,6 +873,9 @@ class IRContext {
std::unique_ptr<StructuredCFGAnalysis> struct_cfg_analysis_;
+ // The liveness manager for |module_|.
+ std::unique_ptr<analysis::LivenessManager> liveness_mgr_;
+
// The maximum legal value for the id bound.
uint32_t max_id_bound_;