Skip to content

Conversation

robertoraggi
Copy link
Owner

Introduce initial code generation for subscript operations, including local variable allocation and subscript operation lowering. Indices are not bundled yet.

int main() {
  int a[10];
  for (int i = 0; i < 10; i = i + 1) a[i] = i;
  int r = 0;
  for (int i = 0; i < 10; i = i + 1) r = r + a[i];
  return r;
}

Enough for

$ cxx -emit-ir x.c | mlir-translate --mlir-to-llvmir |lli; echo $?
45

Indices are not bundled yet and all locals
are allocated at the beginning of the function.
@robertoraggi robertoraggi merged commit 448edf5 into main Aug 10, 2025
9 checks passed
@robertoraggi robertoraggi deleted the rational-giraffe branch August 10, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant