[LLVMdev] Fwd: Create superblock in LLVM IR
Tomas Minac
minac.tomas at gmail.com
Tue Sep 4 09:05:06 PDT 2012
Hello,
I am member of research team on our Faculty of Information Technology
(university VUT in Brno Czech Republic). We use LLVM for many projects
and actually we want to create system, which will be able compile and
profile aplication for VLIW processors in few iterations.
We want to load profile information in 'opt' part of LLVM and use it for
create superblocks. Note, when superblocks will be created, we want to
use llc for our specials backends.
*.ll -> opt -> llc -> *.asm
|
profile information
We are thinking about creating superblocks in two ways:
1. Simply join basic blocks and branch instrunction in the join
point replace by some intrinsic instrunction.
Example:
define i32 @foo(i32 %a, i32 %b) nounwind uwtable {
entry:
...
br i1 %cond, label %if.then, label %if.else
if.then: ; preds = %entry
...
br label %if.end
if.else: ; preds = %entry
...
br label %if.end
if.end: ; preds = %if.else,
%if.then
...
ret i32 %add7
It will be transformed to:
define i32 @foo(i32 %a, i32 %b) nounwind uwtable {
entry:
...
spec.instrinsic.instr.with.label.on.if.else()
...
br label %if.end
if.else: ; preds = %entry
...
br label %if.end
if.end: ; preds = %if.else,
%if.then
...
ret i32 %add7
2. Create class named SuperBlock, which will be very similar to
BasicBlock class and has vector of contained BasicBlocks. Of course, in
this case, we will have to create MachineSuperBlock class, because we
want to use llc, how I noted above. Result can looks like that:
Example:
define i32 @foo(i32 %a, i32 %b) nounwind uwtable {
superblock.entry.start:
entry:
...
br i1 %cond, label %if.then, label %if.else
if.then: ; preds = %entry
...
br label %if.end
superblock.entry.end:
superblock.if.else.start:
if.else: ; preds = %entry
...
br label %if.end
superblock.if.else.end:
superblock.if.end.start:
if.end: ; preds = %if.else,
%if.then
...
ret i32 %add7
superblock.if.end.end:
What do you think which way will bring less problems for additional
processing with llc?
I hope and looking for some more advices or any notes to our drafts I
will be thankfull.
Regards,
Tomas Minac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120904/0ba1864d/attachment.html>
More information about the llvm-dev
mailing list