Project

General

Profile

Actions

Feature #88

open

Add add_ptr instruction for the pointer arithmetic

Feature #88: Add add_ptr instruction for the pointer arithmetic

Added by Eugen Wissner 10 days ago. Updated about 14 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
IR
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Adding a number to a pointer always advances the pointer by one byte. This is wrong since the pointer should be advanced by the number multiplied by the size of the pointer base type.

To support this a new TAC instruction should be introduced, "add_ptr": add_ptr(pointer, index, scale, destination).

Updated by Eugen Wissner about 14 hours ago Actions #1

  • I add a new temporary operator for the pointer arithmetic, | (since the token is known but isn't used yet for anything else). The support for this operator is ported to the stage 19. After that I replace all usages of addition for pointer + number with the pipe operator in stage 20.
  • I implement addition of the right size to a pointer in stage 20, but it won't be used in stage 20 (since stage 19 cannot understand it).
  • New stage 21 can use plus operator for the pointer and number addition and can free the | token again.
Actions

Also available in: PDF Atom