mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-30 06:50:06 +00:00
spirv-fuzz: Add GetParameters (#3454)
Adds a GetParameters function to fuzzerutil.
This commit is contained in:
parent
8e586e46a2
commit
71a5b6770d
@ -675,6 +675,18 @@ bool IsPermutationOfRange(const std::vector<uint32_t>& arr, uint32_t lo,
|
||||
*min_max.second == hi;
|
||||
}
|
||||
|
||||
std::vector<opt::Instruction*> GetParameters(opt::IRContext* ir_context,
|
||||
uint32_t function_id) {
|
||||
auto* function = FindFunction(ir_context, function_id);
|
||||
assert(function && "|function_id| is invalid");
|
||||
|
||||
std::vector<opt::Instruction*> result;
|
||||
function->ForEachParam(
|
||||
[&result](opt::Instruction* inst) { result.push_back(inst); });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace fuzzerutil
|
||||
|
||||
} // namespace fuzz
|
||||
|
@ -261,6 +261,11 @@ bool HasDuplicates(const std::vector<uint32_t>& arr);
|
||||
bool IsPermutationOfRange(const std::vector<uint32_t>& arr, uint32_t lo,
|
||||
uint32_t hi);
|
||||
|
||||
// Returns OpFunctionParameter instructions corresponding to the function
|
||||
// with result id |function_id|.
|
||||
std::vector<opt::Instruction*> GetParameters(opt::IRContext* ir_context,
|
||||
uint32_t function_id);
|
||||
|
||||
} // namespace fuzzerutil
|
||||
|
||||
} // namespace fuzz
|
||||
|
Loading…
Reference in New Issue
Block a user