Selection DAG from LLVM IR?

166 views Asked by At

I have fetched LLVM-IR via

clang -S -emit-llvm demo.c

where demo.c is as follows

int demo(int a, int b){
int c = a+b;
return c;
}

The IR looks like

define dso_local i32 @demo(i32 %0, i32 %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 %0, i32* %3, align 4
  store i32 %1, i32* %4, align 4
  %6 = load i32, i32* %3, align 4
  %7 = load i32, i32* %4, align 4
  %8 = add nsw i32 %6, %7
  store i32 %8, i32* %5, align 4
  %9 = load i32, i32* %5, align 4
  ret i32 %9
}

from here I need only extract target independent selection DAG information so that I can use DAG information to my own pipeline. So is there any way to get information till selection DAG, or should I need to write my own selection DAG, if it is yes , what are those exact ways to encounter? any suggestion will be helpful to me.

I have built via cmake -DCMAKE_BUILD_TYPE=Debug .. cmake --build . the after compiling using clang I execute the file demo.ll via llc -fast-isel=false -view-dag-combine1-dags foo.ll and llc -debug foo.ll but both the command giving same error

0

There are 0 answers