Skip to content

Instantly share code, notes, and snippets.

@fables-tales
Created July 22, 2010 13:23
Show Gist options
  • Save fables-tales/485957 to your computer and use it in GitHub Desktop.
Save fables-tales/485957 to your computer and use it in GitHub Desktop.
@values = internal global [8192 x i32] zeroinitializer
define i32 @main()
{
entry:
;create location and store zero to it
%location = alloca i32
store i32 0, i32* %location
;get the addr of the first element
%firstelementaddr = getelementptr [8192 x i32]* @values, i32 0, i32 %location
%dereference = load i32* %firstelementaddr
;increment dereference by 3
%inc = add i32 3, %dereference
;store it back
store i32 %inc, i32* %firstelementaddr
%ponies = load i32* %firstelementaddr
ret i32 %return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment