Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: rewrite the C code generator #1333

Draft
wants to merge 20 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/backend/backends.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import
idioms
]

import compiler/utils/measure

export TranslationConfig

type
Expand Down Expand Up @@ -319,6 +321,7 @@ proc preprocess*(queue: var WorkQueue, graph: ModuleGraph, idgen: IdGenerator,
## needed for fully processing the procedure. `module` is the module the
## step was queued from: it's used as the module the next processing is
## queued from.
measure("transf")
let prc = env[id]
if exfDynamicLib in prc.extFlags:
# a procedure imported at runtime, it has no body
Expand Down Expand Up @@ -374,6 +377,7 @@ proc process(body: var MirBody, prc: PSym, graph: ModuleGraph,
of backendNimVm: targetVm
of backendInvalid: unreachable()

measure("MIR passes")
applyPasses(body, prc, env, graph, target)

proc translate*(id: ProcedureId, body: PNode, graph: ModuleGraph,
Expand All @@ -385,6 +389,7 @@ proc translate*(id: ProcedureId, body: PNode, graph: ModuleGraph,
let prc = env[id]
if optCursorInference in graph.config.options and
shouldInjectDestructorCalls(prc):
measure("cursor inference")
# TODO: turn cursor inference into a MIR pass and remove this part
computeCursors(prc, body, graph)

Expand Down
Loading