#include "source/opt/fold.h"
#include <cassert>
#include <cstdint>
#include <vector>
#include "source/opt/const_folding_rules.h"
#include "source/opt/def_use_manager.h"
#include "source/opt/folding_rules.h"
#include "source/opt/ir_context.h"
namespace spvtools {
namespace opt {
namespace {
#ifndef INT32_MIN
#define INT32_MIN …
#endif
#ifndef INT32_MAX
#define INT32_MAX …
#endif
#ifndef UINT32_MAX
#define UINT32_MAX …
#endif
}
uint32_t InstructionFolder::UnaryOperate(spv::Op opcode,
uint32_t operand) const { … }
uint32_t InstructionFolder::BinaryOperate(spv::Op opcode, uint32_t a,
uint32_t b) const { … }
uint32_t InstructionFolder::TernaryOperate(spv::Op opcode, uint32_t a,
uint32_t b, uint32_t c) const { … }
uint32_t InstructionFolder::OperateWords(
spv::Op opcode, const std::vector<uint32_t>& operand_words) const { … }
bool InstructionFolder::FoldInstructionInternal(Instruction* inst) const { … }
uint32_t InstructionFolder::FoldScalars(
spv::Op opcode,
const std::vector<const analysis::Constant*>& operands) const { … }
bool InstructionFolder::FoldBinaryIntegerOpToConstant(
Instruction* inst, const std::function<uint32_t(uint32_t)>& id_map,
uint32_t* result) const { … }
bool InstructionFolder::FoldBinaryBooleanOpToConstant(
Instruction* inst, const std::function<uint32_t(uint32_t)>& id_map,
uint32_t* result) const { … }
bool InstructionFolder::FoldIntegerOpToConstant(
Instruction* inst, const std::function<uint32_t(uint32_t)>& id_map,
uint32_t* result) const { … }
std::vector<uint32_t> InstructionFolder::FoldVectors(
spv::Op opcode, uint32_t num_dims,
const std::vector<const analysis::Constant*>& operands) const { … }
bool InstructionFolder::IsFoldableOpcode(spv::Op opcode) const { … }
bool InstructionFolder::IsFoldableConstant(
const analysis::Constant* cst) const { … }
Instruction* InstructionFolder::FoldInstructionToConstant(
Instruction* inst, std::function<uint32_t(uint32_t)> id_map) const { … }
bool InstructionFolder::IsFoldableType(Instruction* type_inst) const { … }
bool InstructionFolder::IsFoldableScalarType(Instruction* type_inst) const { … }
bool InstructionFolder::IsFoldableVectorType(Instruction* type_inst) const { … }
bool InstructionFolder::FoldInstruction(Instruction* inst) const { … }
}
}