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

Add support for global variables in nback.llvm #127

Closed
heshanpadmasiri opened this issue Jun 24, 2021 · 4 comments · Fixed by #128
Closed

Add support for global variables in nback.llvm #127

heshanpadmasiri opened this issue Jun 24, 2021 · 4 comments · Fixed by #128
Assignees
Milestone

Comments

@heshanpadmasiri
Copy link
Member

heshanpadmasiri commented Jun 24, 2021

This is to support #91.

@jclark for this I am thinking of adding a new function getOrInsertGlobal(string name, Type ty) returns Value similar to getOrInsertGlobal in C api

@jclark
Copy link
Contributor

jclark commented Jun 24, 2021

@heshanpadmasiri The link you gave is the C++ API. What is the C API?

@heshanpadmasiri
Copy link
Member Author

C API
Add global variable: LLVMAddGlobal
Get global variable:LLVMGetNamedGlobal

@jclark
Copy link
Contributor

jclark commented Jun 24, 2021

I think we should follow the C API and add methods to Module corresponding to those two functions.

Be careful about types: I believe if you add a global x of type i8, then @x is of type i8*. Please test with LLVM.

@jclark
Copy link
Contributor

jclark commented Jun 25, 2021

@heshanpadmasiri You shouldn't rely on iteration order over a map. I fixed this. I also cleaned up getIntrinsicDeclaration and tweaked a few other things. Please try to follow my style. 2b3629c

@jclark jclark closed this as completed Jun 25, 2021
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 a pull request may close this issue.

2 participants