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

Refactor main module to support multiple backends #1068

Open
manuranga opened this issue Sep 6, 2022 · 3 comments
Open

Refactor main module to support multiple backends #1068

manuranga opened this issue Sep 6, 2022 · 3 comments
Assignees

Comments

@manuranga
Copy link
Contributor

Refactor compile.bal such that import resolution and job system can be shared by multiple backends.

Prerequisite for #1031

@manuranga manuranga self-assigned this Sep 6, 2022
@manuranga
Copy link
Contributor Author

manuranga commented Sep 6, 2022

I propose a new object type to be implemented per each backend. Implementation classes will live in separate files in the main module. (Moving it into respective backends will create a dependency between nback and llvm.print)

proposed interface:

type Backend object {
   // Build and write the output to a file.
   function buildModule(bir:Module birMod) returns CompileError;
   // Called after all calls to buildModule.
   function buildInitModule(map<bir:FunctionSignature> potentialEntryFuncs) returns CompileError;
}

@jclark
Copy link
Contributor

jclark commented Sep 6, 2022

That looks reasonable, but I don't think we need separate files.

@manuranga
Copy link
Contributor Author

I was thinking of Emitter or EmitStage and emitModule.
https://en.wikipedia.org/wiki/Emitter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants