[LLVMdev] mov instruction in LLVM IR

Vinod Grover vgrover528 at gmail.com
Thu May 28 16:55:39 PDT 2009


Indeed that is the closest to what I want to do, without the volatile. I was
hoping I could represent it directly without using local variables, but that
might be the simplest way and since the address of these is never taken,
LLVM can clean them up  as one might hope.
Thanks
Vinod


On Thu, May 28, 2009 at 4:48 PM, Mike Stump <mrs at apple.com> wrote:

> 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.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090528/31108266/attachment.html>


More information about the llvm-dev mailing list