TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

Find a InstructionValue based on its name #415

Closed Faouzi1406 closed 1 year ago

Faouzi1406 commented 1 year ago

Is your feature request related to a problem? Please describe.

I am currently writing my own compiler, while writing it I tried to get an instruction based on its name, inside a block, but found out this was not possible. I already added the feature to my own project and thought it would be a useful feature for the library itself.

Describe the solution you'd like

I made a solution that adds a function to both the implementation of basic block, and InstructionValue, the implementation of IntstructionValue goes through all instruction using get_next_instruction(). If it finds an instruction where the name is equal to that of the argument name, it returns that.

I am making this issue to request if I can make a merge request for the feature/ others want or need it.

Describe possible drawbacks to your solution

I don't think there are any drawbacks.

TheDan64 commented 1 year ago

I'm not sure I totally understand the issue. I'd be open to reviewing a PR, but I can't guarantee it'll be accepted if it seems too high level