[LLVMdev] mov instruction in LLVM IR

Mike Stump mrs at apple.com
Thu May 28 16:48:21 PDT 2009


On May 28, 2009, at 4:23 PM, Vinod Grover wrote:
> The input language is at assembly level,

And C makes for an excellent assembler:

$ cat s.c
main() {
   volatile register int i, j;
   i = j;
}
$ clang -O4 s.c -o - -S
; ModuleID = 's.c'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32- 
i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64- 
f80:128:128"
target triple = "x86_64-apple-darwin10.0"

define i32 @main() nounwind readnone {
entry:
	%i = alloca i32, align 4		; <i32*> [#uses=1]
	%j = alloca i32, align 4		; <i32*> [#uses=1]
	%tmp = volatile load i32* %j		; <i32> [#uses=1]
	volatile store i32 %tmp, i32* %i
	ret i32 undef
}

?  Since you didn't give enough information on how the above is  
different from what you want to do, I can't do better.

> and the location akin to a %temp ( a virtual register if you will)  
> and contains moves from one virtual to another. Though these are not  
> like memory but I could represent them as local variables and do  
> loads and stores; so I dont know how to represent it in C except as  
> local variables.



More information about the llvm-dev mailing list