From: Lei Zhang Date: Wed, 21 Sep 2016 21:16:31 +0000 (-0400) Subject: Clean up header dependency. X-Git-Tag: upstream/2018.6~1026 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc6e4834d63da07593c67fdc13af278d3db63696;p=platform%2Fupstream%2FSPIRV-Tools.git Clean up header dependency. --- diff --git a/source/binary.cpp b/source/binary.cpp index c8b7c38..689937f 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -20,13 +20,14 @@ #include #include #include +#include #include "assembly_grammar.h" #include "diagnostic.h" #include "ext_inst.h" #include "opcode.h" #include "operand.h" -#include "spirv-tools/libspirv.h" +#include "spirv/1.1/spirv.h" #include "spirv_constant.h" #include "spirv_endian.h" diff --git a/source/binary.h b/source/binary.h index dd48258..375e010 100644 --- a/source/binary.h +++ b/source/binary.h @@ -16,7 +16,6 @@ #define LIBSPIRV_BINARY_H_ #include "spirv-tools/libspirv.h" -#include "spirv/1.1/spirv.h" #include "spirv_definition.h" // Functions diff --git a/source/diagnostic.h b/source/diagnostic.h index 72d537a..78f9a5b 100644 --- a/source/diagnostic.h +++ b/source/diagnostic.h @@ -16,7 +16,7 @@ #define LIBSPIRV_DIAGNOSTIC_H_ #include -#include +#include #include "spirv-tools/libspirv.hpp" diff --git a/source/libspirv.cpp b/source/libspirv.cpp index 9afb9cb..02e87ea 100644 --- a/source/libspirv.cpp +++ b/source/libspirv.cpp @@ -14,7 +14,6 @@ #include "spirv-tools/libspirv.hpp" -#include "message.h" #include "table.h" namespace spvtools { diff --git a/source/message.h b/source/message.h index 1489090..60f5d56 100644 --- a/source/message.h +++ b/source/message.h @@ -17,7 +17,7 @@ #include -#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/libspirv.h" namespace spvtools { diff --git a/source/opt/build_module.h b/source/opt/build_module.h index 1dc2c11..d396a3a 100644 --- a/source/opt/build_module.h +++ b/source/opt/build_module.h @@ -17,7 +17,6 @@ #include #include -#include #include "module.h" #include "spirv-tools/libspirv.hpp" diff --git a/source/opt/constants.h b/source/opt/constants.h index 24574fc..d6199e8 100644 --- a/source/opt/constants.h +++ b/source/opt/constants.h @@ -15,8 +15,8 @@ #ifndef LIBSPIRV_OPT_CONSTANTS_H_ #define LIBSPIRV_OPT_CONSTANTS_H_ -#include #include +#include #include #include "make_unique.h" diff --git a/source/opt/def_use_manager.cpp b/source/opt/def_use_manager.cpp index 19178eb..2d0e79a 100644 --- a/source/opt/def_use_manager.cpp +++ b/source/opt/def_use_manager.cpp @@ -14,11 +14,7 @@ #include "def_use_manager.h" -#include - -#include "instruction.h" #include "log.h" -#include "module.h" #include "reflect.h" namespace spvtools { diff --git a/source/opt/def_use_manager.h b/source/opt/def_use_manager.h index 41c405a..cd779d5 100644 --- a/source/opt/def_use_manager.h +++ b/source/opt/def_use_manager.h @@ -17,12 +17,11 @@ #include #include -#include #include #include "instruction.h" -#include "message.h" #include "module.h" +#include "spirv-tools/libspirv.hpp" namespace spvtools { namespace opt { diff --git a/source/opt/fold_spec_constant_op_and_composite_pass.cpp b/source/opt/fold_spec_constant_op_and_composite_pass.cpp index 0170dcb..8424814 100644 --- a/source/opt/fold_spec_constant_op_and_composite_pass.cpp +++ b/source/opt/fold_spec_constant_op_and_composite_pass.cpp @@ -14,10 +14,9 @@ #include "fold_spec_constant_op_and_composite_pass.h" +#include #include -#include #include -#include #include "constants.h" #include "make_unique.h" @@ -249,6 +248,20 @@ FoldSpecConstantOpAndCompositePass::FoldSpecConstantOpAndCompositePass() type_mgr_(nullptr), id_to_const_val_() {} +Pass::Status FoldSpecConstantOpAndCompositePass::Process(ir::Module* module) { + Initialize(module); + return ProcessImpl(module); +} + +void FoldSpecConstantOpAndCompositePass::Initialize(ir::Module* module) { + type_mgr_.reset(new analysis::TypeManager(consumer(), *module)); + def_use_mgr_.reset(new analysis::DefUseManager(consumer(), module)); + for (const auto& id_def : def_use_mgr_->id_to_defs()) { + max_id_ = std::max(max_id_, id_def.first); + } + module_ = module; +}; + Pass::Status FoldSpecConstantOpAndCompositePass::ProcessImpl( ir::Module* module) { bool modified = false; diff --git a/source/opt/fold_spec_constant_op_and_composite_pass.h b/source/opt/fold_spec_constant_op_and_composite_pass.h index 8bca3e5..6e2eea1 100644 --- a/source/opt/fold_spec_constant_op_and_composite_pass.h +++ b/source/opt/fold_spec_constant_op_and_composite_pass.h @@ -15,7 +15,6 @@ #ifndef LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ #define LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ -#include #include #include #include @@ -35,22 +34,13 @@ class FoldSpecConstantOpAndCompositePass : public Pass { FoldSpecConstantOpAndCompositePass(); const char* name() const override { return "fold-spec-const-op-composite"; } - Status Process(ir::Module* module) override { - Initialize(module); - return ProcessImpl(module); - }; + + Status Process(ir::Module* module) override; private: // Initializes the type manager, def-use manager and get the maximal id used // in the module. - void Initialize(ir::Module* module) { - type_mgr_.reset(new analysis::TypeManager(consumer(), *module)); - def_use_mgr_.reset(new analysis::DefUseManager(consumer(), module)); - for (const auto& id_def : def_use_mgr_->id_to_defs()) { - max_id_ = std::max(max_id_, id_def.first); - } - module_ = module; - }; + void Initialize(ir::Module* module); // The real entry of processing. Iterates through the types-constants-globals // section of the given module, finds the Spec Constants defined with diff --git a/source/opt/instruction.cpp b/source/opt/instruction.cpp index 40e2951..bccac12 100644 --- a/source/opt/instruction.cpp +++ b/source/opt/instruction.cpp @@ -14,7 +14,6 @@ #include "instruction.h" -#include #include #include "reflect.h" diff --git a/source/opt/ir_loader.h b/source/opt/ir_loader.h index c5c7359..bcb55f1 100644 --- a/source/opt/ir_loader.h +++ b/source/opt/ir_loader.h @@ -19,9 +19,8 @@ #include "basic_block.h" #include "instruction.h" -#include "message.h" #include "module.h" -#include "spirv-tools/libspirv.h" +#include "spirv-tools/libspirv.hpp" namespace spvtools { namespace ir { diff --git a/source/opt/iterator.h b/source/opt/iterator.h index ba25fea..0430638 100644 --- a/source/opt/iterator.h +++ b/source/opt/iterator.h @@ -15,6 +15,7 @@ #ifndef LIBSPIRV_OPT_ITERATOR_H_ #define LIBSPIRV_OPT_ITERATOR_H_ +#include // for ptrdiff_t #include #include #include @@ -29,10 +30,9 @@ namespace ir { // std::vector<|ValueType|>. template class UptrVectorIterator - : public std::iterator< - std::random_access_iterator_tag, - typename std::conditional::type, - ptrdiff_t> { + : public std::iterator::type> { public: using super = std::iterator< std::random_access_iterator_tag, diff --git a/source/opt/log.h b/source/opt/log.h index 0d5ce4b..717a362 100644 --- a/source/opt/log.h +++ b/source/opt/log.h @@ -20,7 +20,7 @@ #include #include -#include "message.h" +#include "spirv-tools/libspirv.hpp" // Asserts the given condition is true. Otherwise, sends a message to the // consumer and exits the problem with failure code. Accepts the following diff --git a/source/opt/pass.h b/source/opt/pass.h index 7449bc1..6e5df74 100644 --- a/source/opt/pass.h +++ b/source/opt/pass.h @@ -15,10 +15,10 @@ #ifndef LIBSPIRV_OPT_PASS_H_ #define LIBSPIRV_OPT_PASS_H_ -#include +#include -#include "message.h" #include "module.h" +#include "spirv-tools/libspirv.hpp" namespace spvtools { namespace opt { diff --git a/source/opt/pass_manager.h b/source/opt/pass_manager.h index e1bdc7a..0bf29f7 100644 --- a/source/opt/pass_manager.h +++ b/source/opt/pass_manager.h @@ -19,10 +19,11 @@ #include #include "log.h" -#include "message.h" #include "module.h" #include "pass.h" +#include "spirv-tools/libspirv.hpp" + namespace spvtools { namespace opt { diff --git a/source/opt/set_spec_constant_default_value_pass.cpp b/source/opt/set_spec_constant_default_value_pass.cpp index 2e9f36f..d49e2f1 100644 --- a/source/opt/set_spec_constant_default_value_pass.cpp +++ b/source/opt/set_spec_constant_default_value_pass.cpp @@ -16,18 +16,15 @@ #include #include -#include #include -#include #include -#include "spirv-tools/libspirv.h" -#include "util/parse_number.h" - #include "def_use_manager.h" #include "make_unique.h" +#include "spirv-tools/libspirv.h" #include "type_manager.h" #include "types.h" +#include "util/parse_number.h" namespace spvtools { namespace opt { diff --git a/source/opt/type_manager.cpp b/source/opt/type_manager.cpp index ce4b676..ed8a13c 100644 --- a/source/opt/type_manager.cpp +++ b/source/opt/type_manager.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include "type_manager.h" + +#include #include "log.h" #include "reflect.h" -#include "type_manager.h" namespace spvtools { namespace opt { diff --git a/source/opt/type_manager.h b/source/opt/type_manager.h index 48fa212..fa04d80 100644 --- a/source/opt/type_manager.h +++ b/source/opt/type_manager.h @@ -18,9 +18,10 @@ #include #include #include +#include -#include "message.h" #include "module.h" +#include "spirv-tools/libspirv.hpp" #include "types.h" namespace spvtools { diff --git a/source/table.cpp b/source/table.cpp index 24ab520..8f85802 100644 --- a/source/table.cpp +++ b/source/table.cpp @@ -14,7 +14,7 @@ #include "table.h" -#include +#include spv_context spvContextCreate(spv_target_env env) { switch (env) { diff --git a/source/table.h b/source/table.h index 6b86313..4b21587 100644 --- a/source/table.h +++ b/source/table.h @@ -19,7 +19,7 @@ #include "enum_set.h" #include "message.h" -#include "spirv-tools/libspirv.h" +#include "spirv-tools/libspirv.hpp" namespace libspirv {