diff options
author | Daniel Schürmann <[email protected]> | 2020-01-08 12:46:47 +0100 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-10 17:49:18 +0000 |
commit | 8b7a42d6d0b15508940e095642136c53d0c7dcee (patch) | |
tree | 14a18fd6e206676bc94d6705bfcf95c9fcb751ac /src/amd/compiler/aco_ir.h | |
parent | ffb4790279ca779572ec393ba84d71ef1036b437 (diff) |
aco: compact aco::span<T> to use uint16_t offset and size instead of pointer and size_t.
This reduces the size of the Instruction base class
from 40 bytes to 16 bytes. No pipelinedb changes.
Reviewed-by: Rhys Perry <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3332>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3332>
Diffstat (limited to 'src/amd/compiler/aco_ir.h')
-rw-r--r-- | src/amd/compiler/aco_ir.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 388bf064000..1ee31d23702 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -929,8 +929,10 @@ T* create_instruction(aco_opcode opcode, Format format, uint32_t num_operands, u inst->opcode = opcode; inst->format = format; - inst->operands = aco::span<Operand>((Operand*)(data + sizeof(T)), num_operands); - inst->definitions = aco::span<Definition>((Definition*)inst->operands.end(), num_definitions); + uint16_t operands_offset = data + sizeof(T) - (char*)&inst->operands; + inst->operands = aco::span<Operand>(operands_offset, num_operands); + uint16_t definitions_offset = (char*)inst->operands.end() - (char*)&inst->definitions; + inst->definitions = aco::span<Definition>(definitions_offset, num_definitions); return inst; } |