Use i8* instead of void* for generated LLVM IR
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
It looks like LLVM doesn't like using void* for opaque pointers. Trying to compile some LLVM IR actually gave me a useful hint:
```
$ /usr/local/Cellar/llvm/4.0.0_1/bin/opt add.ll
/usr/local/Cellar/llvm/4.0.0_1/bin/opt: add.ll:6:22: error: pointers to void are invalid - use i8* instead
define i32 @main(void*) {
```
Apparently, at least until [opaque pointer types](http://llvm.org/devmtg/2015-10/slides/Blaikie-OpaquePointerTypes.pdf) come to LLVM IR, the right type to use for this sort of thing is a pointer to 8-bit integers.
One easy way to do this would be to define a constant for the i8* type (called `FUNCTION_ENV_TYPE`?) and then use it wherever we currently have `llvm.PointerType.create(llvm.VoidType.create(), 0)`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Search the repository for uses of llvm.PointerType.create(llvm.VoidType.create(), 0) and inspect the generated LLVM IR around those entry points. Replace the relevant void-pointer type uses with an i8* type, then run the generated IR through LLVM's opt command to confirm the pointers-to-void error is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100