mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
[qfcc] Move constant pointer offset into address expr
This is the intended purpose of the offset field in address expressions, and will make struct and array accesses more efficient when I sort out the code generation side.
This commit is contained in:
parent
b668759b7d
commit
6f49b919ec
1 changed files with 6 additions and 0 deletions
|
@ -2622,6 +2622,12 @@ offset_pointer_expr (expr_t *pointer, expr_t *offset)
|
|||
if (pointer->type == ex_alias && !pointer->e.alias.offset
|
||||
&& is_integral (get_type (pointer->e.alias.expr))) {
|
||||
ptr = pointer->e.alias.expr;
|
||||
} else if (pointer->type == ex_address && is_constant (offset)) {
|
||||
if (pointer->e.address.offset) {
|
||||
offset = binary_expr ('+', pointer->e.address.offset, offset);
|
||||
}
|
||||
pointer->e.address.offset = offset;
|
||||
return pointer;
|
||||
} else {
|
||||
ptr = cast_expr (&type_int, pointer);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue