Commit Graph

13 Commits

Author SHA1 Message Date
Andreas Rumpf
e081f565cb IC: use better packed line information format (#22917) 2023-11-07 11:25:57 +01:00
Andreas Rumpf
b79b39128e NIR: C codegen additions (#22914) 2023-11-06 18:33:28 +01:00
Andreas Rumpf
eb8824d71c NIR: C codegen, WIP (#22903) 2023-11-05 20:25:25 +01:00
Andreas Rumpf
801c02bf48 so close... (#22885) 2023-10-31 21:32:09 +01:00
ringabout
afa2f2ebf6 fixes nightlies; fixes incompatible types with csource_v2 (#22889)
ref
https://github.com/nim-lang/nightlies/actions/runs/6686795512/job/18166625042#logs

> /home/runner/work/nightlies/nightlies/nim/compiler/nir/nirvm.nim(163,
35) Error: type mismatch: got 'BiggestInt' for
'b.m.lit.numbers[litId(b.m.types.nodes[int(y)])]' but expected 'int'

Or unifies the type in one way or another
2023-10-30 17:03:19 +01:00
Andreas Rumpf
403e0118ae NIR: progress (#22884) 2023-10-29 21:53:28 +01:00
ringabout
e17237ce9d prepare for the enforcement of std prefix (#22873)
follow up https://github.com/nim-lang/Nim/pull/22851
2023-10-29 14:48:11 +01:00
Andreas Rumpf
0c26d19e22 NIR: VM + refactorings (#22835) 2023-10-29 14:47:22 +01:00
Andreas Rumpf
3c48af7ebe NIR: temporary ID generation bugfix (#22830) 2023-10-16 15:47:13 +02:00
Andreas Rumpf
10c3ab6269 NIR: store sizes, alignments and offsets in the type graph; beginning… (#22822)
…s of a patent-pending new VM
2023-10-16 00:01:33 +02:00
Andreas Rumpf
8990626ca9 NIR: progress (#22817)
Done:

- [x] Implement conversions to openArray/varargs.
- [x] Implement index/range checking.
2023-10-12 23:33:38 +02:00
SirOlaf
68ba45cc04 Import std/stackframes in ast2ir.nim (#22815)
Ref https://github.com/nim-lang/Nim/pull/22777#issuecomment-1758090410

Co-authored-by: SirOlaf <>
2023-10-11 21:05:51 +02:00
Andreas Rumpf
816589b667 NIR: Nim intermediate representation (#22777)
Theoretical Benefits / Plans: 

- Typed assembler-like language.
- Allows for a CPS transformation.
- Can replace the existing C backend by a new C backend.
- Can replace the VM.
- Can do more effective "not nil" checking and static array bounds
checking.
- Can be used instead of the DFA.
- Easily translatable to LLVM.
- Reasonably easy to produce native code from.
- Tiny memory consumption. No pointers, no cry.

**In very early stages of development.**

Todo:
- [x] Map Nim types to IR types.
- [ ] Map Nim AST to IR instructions:
  - [x] Map bitsets to bitops.
  - [ ] Implement string cases.
  - [ ] Implement range and index checks.
  - [x] Implement `default(T)` builtin.
  - [x] Implement multi string concat.
- [ ] Write some analysis passes.
- [ ] Write a backend.
- [x] Integrate into the compilation pipeline.
2023-10-11 17:44:14 +02:00