#include "source/opt/scalar_replacement_pass.h"
#include <algorithm>
#include <queue>
#include <tuple>
#include <utility>
#include "source/extensions.h"
#include "source/opt/reflect.h"
#include "source/opt/types.h"
#include "source/util/make_unique.h"
namespace spvtools {
namespace opt {
namespace {
constexpr uint32_t kDebugValueOperandValueIndex = …;
constexpr uint32_t kDebugValueOperandExpressionIndex = …;
constexpr uint32_t kDebugDeclareOperandVariableIndex = …;
}
Pass::Status ScalarReplacementPass::Process() { … }
Pass::Status ScalarReplacementPass::ProcessFunction(Function* function) { … }
Pass::Status ScalarReplacementPass::ReplaceVariable(
Instruction* inst, std::queue<Instruction*>* worklist) { … }
bool ScalarReplacementPass::ReplaceWholeDebugDeclare(
Instruction* dbg_decl, const std::vector<Instruction*>& replacements) { … }
bool ScalarReplacementPass::ReplaceWholeDebugValue(
Instruction* dbg_value, const std::vector<Instruction*>& replacements) { … }
bool ScalarReplacementPass::ReplaceWholeLoad(
Instruction* load, const std::vector<Instruction*>& replacements) { … }
bool ScalarReplacementPass::ReplaceWholeStore(
Instruction* store, const std::vector<Instruction*>& replacements) { … }
bool ScalarReplacementPass::ReplaceAccessChain(
Instruction* chain, const std::vector<Instruction*>& replacements) { … }
bool ScalarReplacementPass::CreateReplacementVariables(
Instruction* inst, std::vector<Instruction*>* replacements) { … }
Instruction* ScalarReplacementPass::GetUndef(uint32_t type_id) { … }
void ScalarReplacementPass::TransferAnnotations(
const Instruction* source, std::vector<Instruction*>* replacements) { … }
void ScalarReplacementPass::CreateVariable(
uint32_t type_id, Instruction* var_inst, uint32_t index,
std::vector<Instruction*>* replacements) { … }
uint32_t ScalarReplacementPass::GetOrCreatePointerType(uint32_t id) { … }
void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source,
uint32_t index,
Instruction* newVar) { … }
uint64_t ScalarReplacementPass::GetArrayLength(
const Instruction* arrayType) const { … }
uint64_t ScalarReplacementPass::GetNumElements(const Instruction* type) const { … }
bool ScalarReplacementPass::IsSpecConstant(uint32_t id) const { … }
Instruction* ScalarReplacementPass::GetStorageType(
const Instruction* inst) const { … }
bool ScalarReplacementPass::CanReplaceVariable(
const Instruction* varInst) const { … }
bool ScalarReplacementPass::CheckType(const Instruction* typeInst) const { … }
bool ScalarReplacementPass::CheckTypeAnnotations(
const Instruction* typeInst) const { … }
bool ScalarReplacementPass::CheckAnnotations(const Instruction* varInst) const { … }
bool ScalarReplacementPass::CheckUses(const Instruction* inst) const { … }
bool ScalarReplacementPass::CheckUses(const Instruction* inst,
VariableStats* stats) const { … }
bool ScalarReplacementPass::CheckUsesRelaxed(const Instruction* inst) const { … }
bool ScalarReplacementPass::CheckImageTexelPointer(uint32_t index) const { … }
bool ScalarReplacementPass::CheckLoad(const Instruction* inst,
uint32_t index) const { … }
bool ScalarReplacementPass::CheckStore(const Instruction* inst,
uint32_t index) const { … }
bool ScalarReplacementPass::CheckDebugDeclare(uint32_t index) const { … }
bool ScalarReplacementPass::IsLargerThanSizeLimit(uint64_t length) const { … }
std::unique_ptr<std::unordered_set<int64_t>>
ScalarReplacementPass::GetUsedComponents(Instruction* inst) { … }
uint64_t ScalarReplacementPass::GetMaxLegalIndex(
const Instruction* var_inst) const { … }
void ScalarReplacementPass::CopyDecorationsToVariable(Instruction* from,
Instruction* to,
uint32_t member_index) { … }
void ScalarReplacementPass::CopyPointerDecorationsToVariable(Instruction* from,
Instruction* to) { … }
void ScalarReplacementPass::CopyNecessaryMemberDecorationsToVariable(
Instruction* from, Instruction* to, uint32_t member_index) { … }
}
}