elk: Pass brw_codegen to next_offset
In the next commit we will use this to assert that we are not reading past the end of `p->store`. Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33101>
This commit is contained in:
@@ -1915,8 +1915,9 @@ bool elk_validate_instructions(const struct elk_isa_info *isa,
|
||||
struct elk_disasm_info *disasm);
|
||||
|
||||
static inline int
|
||||
next_offset(const struct intel_device_info *devinfo, void *store, int offset)
|
||||
next_offset(struct elk_codegen *p, void *store, int offset)
|
||||
{
|
||||
const struct intel_device_info *devinfo = p->devinfo;
|
||||
elk_inst *insn = (elk_inst *)((char *)store + offset);
|
||||
|
||||
if (elk_inst_cmpt_control(devinfo, insn))
|
||||
|
||||
@@ -2010,7 +2010,7 @@ elk_compact_instructions(struct elk_codegen *p, int start_offset,
|
||||
/* Fix up control flow offsets. */
|
||||
p->next_insn_offset = start_offset + offset;
|
||||
for (offset = 0; offset < p->next_insn_offset - start_offset;
|
||||
offset = next_offset(devinfo, store, offset)) {
|
||||
offset = next_offset(p, store, offset)) {
|
||||
elk_inst *insn = store + offset;
|
||||
int this_old_ip = old_ip[offset / sizeof(elk_compact_inst)];
|
||||
int this_compacted_count = compacted_counts[this_old_ip];
|
||||
@@ -2123,7 +2123,7 @@ elk_compact_instructions(struct elk_codegen *p, int start_offset,
|
||||
sizeof(elk_inst) != group->offset) {
|
||||
assert(start_offset + old_ip[offset / sizeof(elk_compact_inst)] *
|
||||
sizeof(elk_inst) < group->offset);
|
||||
offset = next_offset(devinfo, store, offset);
|
||||
offset = next_offset(p, store, offset);
|
||||
}
|
||||
|
||||
group->offset = start_offset + offset;
|
||||
|
||||
@@ -2518,9 +2518,9 @@ elk_find_next_block_end(struct elk_codegen *p, int start_offset)
|
||||
|
||||
int depth = 0;
|
||||
|
||||
for (offset = next_offset(devinfo, store, start_offset);
|
||||
for (offset = next_offset(p, store, start_offset);
|
||||
offset < p->next_insn_offset;
|
||||
offset = next_offset(devinfo, store, offset)) {
|
||||
offset = next_offset(p, store, offset)) {
|
||||
elk_inst *insn = store + offset;
|
||||
|
||||
switch (elk_inst_opcode(p->isa, insn)) {
|
||||
@@ -2568,9 +2568,9 @@ elk_find_loop_end(struct elk_codegen *p, int start_offset)
|
||||
/* Always start after the instruction (such as a WHILE) we're trying to fix
|
||||
* up.
|
||||
*/
|
||||
for (offset = next_offset(devinfo, store, start_offset);
|
||||
for (offset = next_offset(p, store, start_offset);
|
||||
offset < p->next_insn_offset;
|
||||
offset = next_offset(devinfo, store, offset)) {
|
||||
offset = next_offset(p, store, offset)) {
|
||||
elk_inst *insn = store + offset;
|
||||
|
||||
if (elk_inst_opcode(p->isa, insn) == ELK_OPCODE_WHILE) {
|
||||
|
||||
Reference in New Issue
Block a user