-
Notifications
You must be signed in to change notification settings - Fork 46
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
Use LLVM unnamed local identifiers #153
Comments
@jclark if I understand how LLVM does this correctly what it does it is it start (from 0) numbering parameters then skip the next number and start numbering variables. It gives the next number to the basic block. For example
It start naming parameters from 0 . Then skipped 1 and start naming variables from 2 to 4 in the first basic block. It named the next basic block 5 and start naming its variables from 6 to 8 and so on. (It uses a single object to generate names for variables and basic blocks in the print stage) |
No, that's not okay: Ballerina variable names can be arbitrary strings (because of escapes and quoting), and we need to be able to handle that. You should transform the user-specified name into a valid LLVM identifier by using quotes and So a user specified name of |
Check what happens in the JNI API if you specify a name parameter starting with a digit e.g. |
It will become |
Can't you just use In |
I would suggest you represent each line as an array of strings, where each string is either
At the output stage, you just transform strings of type 2 via a lookup in a map and concatenate the members of the array. This should hopefully reduce the performance hit from implementing this issue. |
At the moment, llvm.nback uses a named LLVM local identifier starting with
_
(e.g.%_17
) when the API user does not specify aname
argument. It would be better for it to use an unnamed LLVM identifier (e.g.%17
). This would improve the similarity of code generated using llvm.nback and using #19.This isn't as simple as just leaving out the
_
: LLVM has a specify method of numbering basic blocks and variables that the use of unnamed identifiers must comply with.The text was updated successfully, but these errors were encountered: