[LLVMdev] LLVM assembly without basic block
Seung Jae Lee
lee225 at uiuc.edu
Fri Jun 29 12:08:23 PDT 2007
Hello, guys.
I just wonder if there is any way to spit out LLVM assembly without any basic block division.
E.g.,
If I emit LLVM assembly for the following simple code:
------------------------------------------------------------
void f_loop(long* c, long sz) {
long i;
for (i = 0; i < sz; i++) {
long offset = i * sz;
long* out = c + offset;
out[i] = 0;
}
}
------------------------------------------------------------
You know the LLVM assembly is printed out as follows for this code.
------------------------------------------------------------
void %f_loop(int* %c, int %sz) {
entry:
%sz = cast int %sz to uint ; <uint> [#uses=1]
%tmp18 = setgt int %sz, 0 ; <bool> [#uses=1]
br bool %tmp18, label %bb, label %return
bb: ; preds = %bb, %entry
%indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ] ; <uint> [#uses=2]
%i.0.0 = cast uint %indvar to int ; <int> [#uses=2]
%tmp2 = mul int %i.0.0, %sz ; <int> [#uses=1]
%tmp4.sum = add int %tmp2, %i.0.0 ; <int> [#uses=1]
%tmp7 = getelementptr int* %c, int %tmp4.sum ; <int*> [#uses=1]
store int 0, int* %tmp7
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=2]
%exitcond = seteq uint %indvar.next, %sz ; <bool> [#uses=1]
br bool %exitcond, label %return, label %bb
return: ; preds = %bb, %entry
ret void
}
------------------------------------------------------------
As you can see, there are three basic blocks composing this code.
Is there any way to get the assembly for this function without any basic block division?
I know this may be absurd but curious.
Thanks,
Seung Jae Lee
More information about the llvm-dev
mailing list