SPIRV-Tools/source/opt/compact_ids_pass.h
Steven Perron a1f9e1342e Preserve inst-to-block and def-use in passes.
The following passes are updated to preserve the inst-to-block and
def-use analysies:

	private-to-local
	aggressive dead-code elimination
	dead branch elimination
	local-single-block elimination
	local-single-store elimination
	reduce load size
	compact ids (inst-to-block only)
	merge block
	dead-insert elimination
	ccp

The one execption is that compact ids still kills the def-use manager.
This is because it changes so many ids it is faster to kill and rebuild.

Does everything in
https://github.com/KhronosGroup/SPIRV-Tools/issues/1593 except for the
changes to merge return.
2018-06-04 13:48:30 -04:00

45 lines
1.4 KiB
C++

// Copyright (c) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LIBSPIRV_OPT_COMPACT_IDS_PASS_H_
#define LIBSPIRV_OPT_COMPACT_IDS_PASS_H_
#include "ir_context.h"
#include "module.h"
#include "pass.h"
namespace spvtools {
namespace opt {
// See optimizer.hpp for documentation.
class CompactIdsPass : public Pass {
public:
const char* name() const override { return "compact-ids"; }
Status Process(ir::IRContext*) override;
// Return the mask of preserved Analyses.
ir::IRContext::Analysis GetPreservedAnalyses() override {
return ir::IRContext::kAnalysisInstrToBlockMapping |
ir::IRContext::kAnalysisCombinators | ir::IRContext::kAnalysisCFG |
ir::IRContext::kAnalysisDominatorAnalysis |
ir::IRContext::kAnalysisLoopAnalysis |
ir::IRContext::kAnalysisNameMap;
}
};
} // namespace opt
} // namespace spvtools
#endif // LIBSPIRV_OPT_COMPACT_IDS_PASS_H_