Clean up header dependency.

This commit is contained in:
Lei Zhang 2016-09-21 17:16:31 -04:00
parent c6b23f8237
commit dc6e4834d6
22 changed files with 43 additions and 49 deletions

View File

@ -20,13 +20,14 @@
#include <iterator>
#include <limits>
#include <unordered_map>
#include <vector>
#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"

View File

@ -16,7 +16,6 @@
#define LIBSPIRV_BINARY_H_
#include "spirv-tools/libspirv.h"
#include "spirv/1.1/spirv.h"
#include "spirv_definition.h"
// Functions

View File

@ -16,7 +16,7 @@
#define LIBSPIRV_DIAGNOSTIC_H_
#include <sstream>
#include <utility>
#include <string>
#include "spirv-tools/libspirv.hpp"

View File

@ -14,7 +14,6 @@
#include "spirv-tools/libspirv.hpp"
#include "message.h"
#include "table.h"
namespace spvtools {

View File

@ -17,7 +17,7 @@
#include <string>
#include "spirv-tools/libspirv.hpp"
#include "spirv-tools/libspirv.h"
namespace spvtools {

View File

@ -17,7 +17,6 @@
#include <memory>
#include <string>
#include <vector>
#include "module.h"
#include "spirv-tools/libspirv.hpp"

View File

@ -15,8 +15,8 @@
#ifndef LIBSPIRV_OPT_CONSTANTS_H_
#define LIBSPIRV_OPT_CONSTANTS_H_
#include <cassert>
#include <memory>
#include <utility>
#include <vector>
#include "make_unique.h"

View File

@ -14,11 +14,7 @@
#include "def_use_manager.h"
#include <functional>
#include "instruction.h"
#include "log.h"
#include "module.h"
#include "reflect.h"
namespace spvtools {

View File

@ -17,12 +17,11 @@
#include <list>
#include <unordered_map>
#include <utility>
#include <vector>
#include "instruction.h"
#include "message.h"
#include "module.h"
#include "spirv-tools/libspirv.hpp"
namespace spvtools {
namespace opt {

View File

@ -14,10 +14,9 @@
#include "fold_spec_constant_op_and_composite_pass.h"
#include <algorithm>
#include <initializer_list>
#include <memory>
#include <tuple>
#include <unordered_map>
#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;

View File

@ -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 <algorithm>
#include <memory>
#include <unordered_map>
#include <vector>
@ -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

View File

@ -14,7 +14,6 @@
#include "instruction.h"
#include <cassert>
#include <initializer_list>
#include "reflect.h"

View File

@ -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 {

View File

@ -15,6 +15,7 @@
#ifndef LIBSPIRV_OPT_ITERATOR_H_
#define LIBSPIRV_OPT_ITERATOR_H_
#include <cstddef> // for ptrdiff_t
#include <iterator>
#include <memory>
#include <type_traits>
@ -29,10 +30,9 @@ namespace ir {
// std::vector<|ValueType|>.
template <typename ValueType, bool IsConst = false>
class UptrVectorIterator
: public std::iterator<
std::random_access_iterator_tag,
typename std::conditional<IsConst, const ValueType, ValueType>::type,
ptrdiff_t> {
: public std::iterator<std::random_access_iterator_tag,
typename std::conditional<IsConst, const ValueType,
ValueType>::type> {
public:
using super = std::iterator<
std::random_access_iterator_tag,

View File

@ -20,7 +20,7 @@
#include <utility>
#include <vector>
#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

View File

@ -15,10 +15,10 @@
#ifndef LIBSPIRV_OPT_PASS_H_
#define LIBSPIRV_OPT_PASS_H_
#include <memory>
#include <utility>
#include "message.h"
#include "module.h"
#include "spirv-tools/libspirv.hpp"
namespace spvtools {
namespace opt {

View File

@ -19,10 +19,11 @@
#include <vector>
#include "log.h"
#include "message.h"
#include "module.h"
#include "pass.h"
#include "spirv-tools/libspirv.hpp"
namespace spvtools {
namespace opt {

View File

@ -16,18 +16,15 @@
#include <cctype>
#include <cstring>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#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 {

View File

@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <algorithm>
#include "type_manager.h"
#include <utility>
#include "log.h"
#include "reflect.h"
#include "type_manager.h"
namespace spvtools {
namespace opt {

View File

@ -18,9 +18,10 @@
#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "message.h"
#include "module.h"
#include "spirv-tools/libspirv.hpp"
#include "types.h"
namespace spvtools {

View File

@ -14,7 +14,7 @@
#include "table.h"
#include <cstdlib>
#include <utility>
spv_context spvContextCreate(spv_target_env env) {
switch (env) {

View File

@ -19,7 +19,7 @@
#include "enum_set.h"
#include "message.h"
#include "spirv-tools/libspirv.h"
#include "spirv-tools/libspirv.hpp"
namespace libspirv {