#include "instrument_pass.h"
#include "source/cfa.h"
#include "source/spirv_constant.h"
namespace spvtools {
namespace opt {
namespace {
constexpr int kEntryPointFunctionIdInIdx = …;
}
void InstrumentPass::MovePreludeCode(
BasicBlock::iterator ref_inst_itr,
UptrVectorIterator<BasicBlock> ref_block_itr,
std::unique_ptr<BasicBlock>* new_blk_ptr) { … }
void InstrumentPass::MovePostludeCode(
UptrVectorIterator<BasicBlock> ref_block_itr, BasicBlock* new_blk_ptr) { … }
std::unique_ptr<Instruction> InstrumentPass::NewLabel(uint32_t label_id) { … }
std::unique_ptr<Function> InstrumentPass::StartFunction(
uint32_t func_id, const analysis::Type* return_type,
const std::vector<const analysis::Type*>& param_types) { … }
std::unique_ptr<Instruction> InstrumentPass::EndFunction() { … }
std::vector<uint32_t> InstrumentPass::AddParameters(
Function& func, const std::vector<const analysis::Type*>& param_types) { … }
std::unique_ptr<Instruction> InstrumentPass::NewName(
uint32_t id, const std::string& name_str) { … }
uint32_t InstrumentPass::Gen32BitCvtCode(uint32_t val_id,
InstructionBuilder* builder) { … }
uint32_t InstrumentPass::GenUintCastCode(uint32_t val_id,
InstructionBuilder* builder) { … }
uint32_t InstrumentPass::GenVarLoad(uint32_t var_id,
InstructionBuilder* builder) { … }
uint32_t InstrumentPass::GenStageInfo(uint32_t stage_idx,
InstructionBuilder* builder) { … }
bool InstrumentPass::AllConstant(const std::vector<uint32_t>& ids) { … }
uint32_t InstrumentPass::GenReadFunctionCall(
uint32_t return_id, uint32_t func_id,
const std::vector<uint32_t>& func_call_args,
InstructionBuilder* ref_builder) { … }
bool InstrumentPass::IsSameBlockOp(const Instruction* inst) const { … }
void InstrumentPass::CloneSameBlockOps(
std::unique_ptr<Instruction>* inst,
std::unordered_map<uint32_t, uint32_t>* same_blk_post,
std::unordered_map<uint32_t, Instruction*>* same_blk_pre,
BasicBlock* block_ptr) { … }
void InstrumentPass::UpdateSucceedingPhis(
std::vector<std::unique_ptr<BasicBlock>>& new_blocks) { … }
analysis::Integer* InstrumentPass::GetInteger(uint32_t width, bool is_signed) { … }
analysis::Struct* InstrumentPass::GetStruct(
const std::vector<const analysis::Type*>& fields) { … }
analysis::RuntimeArray* InstrumentPass::GetRuntimeArray(
const analysis::Type* element) { … }
analysis::Array* InstrumentPass::GetArray(const analysis::Type* element,
uint32_t length) { … }
analysis::Function* InstrumentPass::GetFunction(
const analysis::Type* return_val,
const std::vector<const analysis::Type*>& args) { … }
analysis::RuntimeArray* InstrumentPass::GetUintXRuntimeArrayType(
uint32_t width, analysis::RuntimeArray** rarr_ty) { … }
analysis::RuntimeArray* InstrumentPass::GetUintRuntimeArrayType(
uint32_t width) { … }
void InstrumentPass::AddStorageBufferExt() { … }
uint32_t InstrumentPass::GetFloatId() { … }
uint32_t InstrumentPass::GetVec4FloatId() { … }
uint32_t InstrumentPass::GetUintId() { … }
uint32_t InstrumentPass::GetUint64Id() { … }
uint32_t InstrumentPass::GetUint8Id() { … }
uint32_t InstrumentPass::GetVecUintId(uint32_t len) { … }
uint32_t InstrumentPass::GetVec4UintId() { … }
uint32_t InstrumentPass::GetVec3UintId() { … }
uint32_t InstrumentPass::GetBoolId() { … }
uint32_t InstrumentPass::GetVoidId() { … }
void InstrumentPass::SplitBlock(
BasicBlock::iterator inst_itr, UptrVectorIterator<BasicBlock> block_itr,
std::vector<std::unique_ptr<BasicBlock>>* new_blocks) { … }
bool InstrumentPass::InstrumentFunction(Function* func, uint32_t stage_idx,
InstProcessFunction& pfn) { … }
bool InstrumentPass::InstProcessCallTreeFromRoots(InstProcessFunction& pfn,
std::queue<uint32_t>* roots,
uint32_t stage_idx) { … }
bool InstrumentPass::InstProcessEntryPointCallTree(InstProcessFunction& pfn) { … }
void InstrumentPass::InitializeInstrument() { … }
}
}