Get Value from ValueRef
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 372
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 10
Description
I am currently trying to manipulate an existing llvm IR file. I have the following IR file that I compiled from a simple hello world function:
```
@.str = private unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 1
; Function Attrs: noinline nounwind optnone ssp uwtable
define i32 @main() #0 {
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
```
How can I change "Hello World" to "Goodbye World"? I can currently obtain the ValueRef object but I am confused as to how to get the actual Value of the object so I can manipulate its contents.
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start from the ValueRef obtained for the @.str global in the LLVM IR shown. Check the llvmlite ValueRef API and its handling of global constant initializers; done means determining whether the existing IR can be changed and verifying that the resulting string is “Goodbye World.”
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100