#include "source/opt/copy_prop_arrays.h"
#include <utility>
#include "source/opt/ir_builder.h"
namespace spvtools {
namespace opt {
namespace {
constexpr uint32_t kLoadPointerInOperand = …;
constexpr uint32_t kStorePointerInOperand = …;
constexpr uint32_t kStoreObjectInOperand = …;
constexpr uint32_t kCompositeExtractObjectInOperand = …;
constexpr uint32_t kTypePointerStorageClassInIdx = …;
constexpr uint32_t kTypePointerPointeeInIdx = …;
bool IsDebugDeclareOrValue(Instruction* di) { … }
uint32_t GetNumberOfMembers(const analysis::Type* type, IRContext* context) { … }
}
Pass::Status CopyPropagateArrays::Process() { … }
std::unique_ptr<CopyPropagateArrays::MemoryObject>
CopyPropagateArrays::FindSourceObjectIfPossible(Instruction* var_inst,
Instruction* store_inst) { … }
Instruction* CopyPropagateArrays::FindStoreInstruction(
const Instruction* var_inst) const { … }
void CopyPropagateArrays::PropagateObject(Instruction* var_inst,
MemoryObject* source,
Instruction* insertion_point) { … }
Instruction* CopyPropagateArrays::BuildNewAccessChain(
Instruction* insertion_point,
CopyPropagateArrays::MemoryObject* source) const { … }
bool CopyPropagateArrays::HasNoStores(Instruction* ptr_inst) { … }
bool CopyPropagateArrays::HasValidReferencesOnly(Instruction* ptr_inst,
Instruction* store_inst) { … }
std::unique_ptr<CopyPropagateArrays::MemoryObject>
CopyPropagateArrays::GetSourceObjectIfAny(uint32_t result) { … }
std::unique_ptr<CopyPropagateArrays::MemoryObject>
CopyPropagateArrays::BuildMemoryObjectFromLoad(Instruction* load_inst) { … }
std::unique_ptr<CopyPropagateArrays::MemoryObject>
CopyPropagateArrays::BuildMemoryObjectFromExtract(Instruction* extract_inst) { … }
std::unique_ptr<CopyPropagateArrays::MemoryObject>
CopyPropagateArrays::BuildMemoryObjectFromCompositeConstruct(
Instruction* conststruct_inst) { … }
std::unique_ptr<CopyPropagateArrays::MemoryObject>
CopyPropagateArrays::BuildMemoryObjectFromInsert(Instruction* insert_inst) { … }
bool CopyPropagateArrays::IsAccessChainIndexValidAndEqualTo(
const AccessChainEntry& entry, uint32_t value) const { … }
bool CopyPropagateArrays::IsPointerToArrayType(uint32_t type_id) { … }
bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst,
uint32_t type_id) { … }
void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst,
Instruction* new_ptr_inst) { … }
uint32_t CopyPropagateArrays::GetMemberTypeId(
uint32_t id, const std::vector<uint32_t>& access_chain) const { … }
void CopyPropagateArrays::MemoryObject::PushIndirection(
const std::vector<AccessChainEntry>& access_chain) { … }
uint32_t CopyPropagateArrays::MemoryObject::GetNumberOfMembers() { … }
template <class iterator>
CopyPropagateArrays::MemoryObject::MemoryObject(Instruction* var_inst,
iterator begin, iterator end)
: variable_inst_(var_inst) { … }
std::vector<uint32_t> CopyPropagateArrays::MemoryObject::GetAccessIds() const { … }
bool CopyPropagateArrays::MemoryObject::Contains(
CopyPropagateArrays::MemoryObject* other) { … }
void CopyPropagateArrays::MemoryObject::BuildConstants() { … }
}
}