From 8b7a42d6d0b15508940e095642136c53d0c7dcee Mon Sep 17 00:00:00 2001 From: Daniel Schürmann Date: Wed, 8 Jan 2020 12:46:47 +0100 Subject: aco: compact aco::span 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 Tested-by: Marge Bot Part-of: --- src/amd/compiler/aco_ir.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/amd/compiler/aco_ir.h') 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*)(data + sizeof(T)), num_operands); - inst->definitions = aco::span((Definition*)inst->operands.end(), num_definitions); + uint16_t operands_offset = data + sizeof(T) - (char*)&inst->operands; + inst->operands = aco::span(operands_offset, num_operands); + uint16_t definitions_offset = (char*)inst->operands.end() - (char*)&inst->definitions; + inst->definitions = aco::span(definitions_offset, num_definitions); return inst; } -- cgit v1.2.3