Commit bc82ba6a authored by guruhegde's avatar guruhegde

updated .gitignore

parent 8ab91126
......@@ -2,3 +2,8 @@
build
cmake-build-debug
examples
test/litTests/batch_fn_test2/batch_process_test1
test/litTests/batch_fn_test2/batch_process_test1.ll
*.o
// RUN: clang -S -emit-llvm %s -o %t.ll
// RUN: opt -load lib/libTASPrototypePasses.so < %t.ll >/dev/null -tas-loop-fission -debug-only=tas
#include <stdio.h>
#include <stdlib.h>
#define EXPENSIVE __attribute__((annotate("expensive")))
#define TAS_BATCH __attribute__((annotate("tas_batch")))
void annotate_ptr() TAS_BATCH {
for (int i = 0; i < 10; ++i) {
int EXPENSIVE * a;
a = malloc(sizeof(int));
printf("c = %d\n", *a);
free(a);
}
}
int main() {
annotate_ptr();
return 0;
};
; ModuleID = 'annotate_ptr.c'
source_filename = "annotate_ptr.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"expensive\00", section "llvm.metadata"
@.str.1 = private unnamed_addr constant [15 x i8] c"annotate_ptr.c\00", section "llvm.metadata"
@.str.2 = private unnamed_addr constant [8 x i8] c"c = %d\0A\00", align 1
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local void @funcA() #0 {
%1 = alloca i32*, align 8
%2 = bitcast i32** %1 to i8*
call void @llvm.var.annotation(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i32 0, i32 0), i32 5)
%3 = call noalias i8* @malloc(i64 4) #1
%4 = bitcast i8* %3 to i32*
store i32* %4, i32** %1, align 8
%5 = load i32*, i32** %1, align 8
%6 = load i32, i32* %5, align 4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i32 %6)
ret void
}
; Function Attrs: nounwind
declare void @llvm.var.annotation(i8*, i8*, i8*, i32) #1
; Function Attrs: nounwind
declare noalias i8* @malloc(i64) #2
declare i32 @printf(i8*, ...) #3
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
call void @funcA()
ret i32 0
}
attributes #0 = { noinline nounwind optnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
attributes #2 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
#include <stdio.h>
#include <stdlib.h>
void funcA() {
int __attribute__((annotate("expensive"))) a;
a = 10;
printf("c = %d\n", a);
}
int main() {
funcA();
return 0;
};
#include <stdio.h>
void funcA(int * a) {
printf("size of a is %lu\n", sizeof(a));
}
int main() {
int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
funcA(a);
return 0;
}
; ModuleID = 'array.c'
source_filename = "array.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [18 x i8] c"size of a is %lu\0A\00", align 1
@main.a = private unnamed_addr constant [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9], align 16
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local void @funcA(i32*) #0 {
%2 = alloca i32*, align 8
store i32* %0, i32** %2, align 8
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i32 0, i32 0), i64 8)
ret void
}
declare i32 @printf(i8*, ...) #1
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
%2 = alloca [10 x i32], align 16
store i32 0, i32* %1, align 4
%3 = bitcast [10 x i32]* %2 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %3, i8* align 16 bitcast ([10 x i32]* @main.a to i8*), i64 40, i1 false)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i32 0, i32 0
call void @funcA(i32* %4)
ret i32 0
}
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #2
attributes #0 = { noinline nounwind optnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { argmemonly nounwind }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
#include <stdio.h>
#define EXPENSIVE __attribute__((annotate("expensive")))
#define TAS_BATCH __attribute__((annotate("tas_batch")))
int a_src[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int b_src[10] = {11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
int tas_batch_process_fn(int n) TAS_BATCH {
int * a EXPENSIVE;
int * b EXPENSIVE;
int c = 10; // for random computation purpose
for (int i = 0; i < n; ++i) {
printf("starting loop\n");
c = c + 10;
c = c % 8;
a = &a_src[0];
printf("value of a[0] = %d\n", a[0]);
c = c / 2;
c = c % 10;
b = &b_src[0];
printf("value of b[0] = %d\n", b[0]);
}
return 0;
}
int main() {
tas_batch_process_fn(32);
return 0;
}
This diff is collapsed.
; ModuleID = 'hello_world.c'
source_filename = "hello_world.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"expensive\00", section "llvm.metadata"
@.str.1 = private unnamed_addr constant [14 x i8] c"hello_world.c\00", section "llvm.metadata"
@.str.2 = private unnamed_addr constant [8 x i8] c"c = %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"tas_attr1\00", section "llvm.metadata"
@llvm.global.annotations = appending global [1 x { i8*, i8*, i8*, i32 }] [{ i8*, i8*, i8*, i32 } { i8* bitcast (void (i32, i32)* @funcWithPhi to i8*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 10 }], section "llvm.metadata"
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local void @funcA() #0 {
%1 = alloca i32, align 4
%2 = bitcast i32* %1 to i8*
call void @llvm.var.annotation(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 5)
store i32 10, i32* %1, align 4
%3 = load i32, i32* %1, align 4
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i32 %3)
ret void
}
; Function Attrs: nounwind
declare void @llvm.var.annotation(i8*, i8*, i8*, i32) #1
declare i32 @printf(i8*, ...) #2
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local void @funcWithPhi(i32, i32) #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* %4, align 4
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
; <label>:8: ; preds = %2
%9 = load i32, i32* %3, align 4
%10 = icmp ne i32 %9, 0
br label %11
; <label>:11: ; preds = %8, %2
%12 = phi i1 [ true, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
store i32 %13, i32* %5, align 4
ret void
}
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
call void @funcA()
ret i32 0
}
attributes #0 = { noinline nounwind optnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
; ModuleID = 'hello_world.c'
source_filename = "hello_world.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [14 x i8] c"hello World!\0A\00", align 1
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @funcA() #0 {
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4
%4 = alloca i32, align 4
store i32 10, i32* %2, align 4
store i32 20, i32* %3, align 4
%5 = load i32, i32* %2, align 4
%6 = load i32, i32* %3, align 4
%7 = add nsw i32 %5, %6
store i32 %7, i32* %4, align 4
%8 = load i32, i32* %4, align 4
%9 = icmp sgt i32 %8, 10
br i1 %9, label %10, label %12
; <label>:10: ; preds = %0
%11 = load i32, i32* %4, align 4
store i32 %11, i32* %1, align 4
br label %14
; <label>:12: ; preds = %0
%13 = load i32, i32* %3, align 4
store i32 %13, i32* %1, align 4
br label %14
; <label>:14: ; preds = %12, %10
%15 = load i32, i32* %1, align 4
ret i32 %15
}
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
declare i32 @printf(i8*, ...) #1
attributes #0 = { noinline nounwind optnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
; ModuleID = 'hello_world.c'
source_filename = "hello_world.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"expensive\00", section "llvm.metadata"
@.str.1 = private unnamed_addr constant [14 x i8] c"hello_world.c\00", section "llvm.metadata"
@.str.2 = private unnamed_addr constant [8 x i8] c"c = %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"tas_attr1\00", section "llvm.metadata"
@.str.4 = private unnamed_addr constant [14 x i8] c"hello World!\0A\00", align 1
@llvm.global.annotations = appending global [2 x { i8*, i8*, i8*, i32 }] [{ i8*, i8*, i8*, i32 } { i8* bitcast (i32 ()* @funcA to i8*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 4 }, { i8*, i8*, i8*, i32 } { i8* bitcast (void (i32, i32)* @funcWithPhi to i8*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 17 }], section "llvm.metadata"
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @funcA() #0 {
%1 = alloca i32*, align 8
%2 = alloca i32, align 4
%3 = alloca i32, align 4
%4 = bitcast i32** %1 to i8*
call void @llvm.var.annotation(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 5)
store i32 10, i32* %2, align 4
store i32 20, i32* %3, align 4
%5 = call noalias i8* @malloc(i64 4) #1
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %1, align 8
%7 = load i32, i32* %3, align 4
%8 = load i32*, i32** %1, align 8
%9 = load i32, i32* %8, align 4
%10 = add nsw i32 %7, %9
store i32 %10, i32* %3, align 4
%11 = load i32, i32* %3, align 4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i32 %11)
%13 = load i32*, i32** %1, align 8
%14 = bitcast i32* %13 to i8*
call void @free(i8* %14) #1
%15 = load i32, i32* %3, align 4
ret i32 %15
}
; Function Attrs: nounwind
declare void @llvm.var.annotation(i8*, i8*, i8*, i32) #1
; Function Attrs: nounwind
declare noalias i8* @malloc(i64) #2
declare i32 @printf(i8*, ...) #3
; Function Attrs: nounwind
declare void @free(i8*) #2
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local void @funcWithPhi(i32, i32) #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* %4, align 4
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
; <label>:8: ; preds = %2
%9 = load i32, i32* %3, align 4
%10 = icmp ne i32 %9, 0
br label %11
; <label>:11: ; preds = %8, %2
%12 = phi i1 [ true, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
store i32 %13, i32* %5, align 4
ret void
}
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i32 0, i32 0))
ret i32 0
}
attributes #0 = { noinline nounwind optnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
attributes #2 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
; ModuleID = 'hello_world.c'
source_filename = "hello_world.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"tas_attr2\00", section "llvm.metadata"
@.str.1 = private unnamed_addr constant [14 x i8] c"hello_world.c\00", section "llvm.metadata"
@.str.2 = private unnamed_addr constant [10 x i8] c"tas_attr1\00", section "llvm.metadata"
@llvm.global.annotations = appending global [2 x { i8*, i8*, i8*, i32 }] [{ i8*, i8*, i8*, i32 } { i8* bitcast (i32 ()* @funcA to i8*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 3 }, { i8*, i8*, i8*, i32 } { i8* bitcast (void (i32, i32)* @funcWithPhi to i8*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i32 16 }], section "llvm.metadata"
@str = private unnamed_addr constant [13 x i8] c"hello World!\00"
; Function Attrs: nounwind sspstrong uwtable
define dso_local i32 @funcA() #0 {
%1 = alloca i32, align 4
%2 = bitcast i32* %1 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2) #2
call void @llvm.var.annotation(i8* nonnull %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 4)
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2) #2
ret i32 0
}
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
; Function Attrs: nounwind
declare void @llvm.var.annotation(i8*, i8*, i8*, i32) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
; Function Attrs: norecurse nounwind readnone sspstrong uwtable
define dso_local void @funcWithPhi(i32, i32) #3 {
ret void
}
; Function Attrs: nounwind sspstrong uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
%1 = tail call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
; Function Attrs: nounwind
declare i32 @puts(i8* nocapture readonly) local_unnamed_addr #2
attributes #0 = { nounwind sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
attributes #2 = { nounwind }
attributes #3 = { norecurse nounwind readnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define EXPENSIVE __attribute__((annotate("expensive")))
#define TAS_BATCH __attribute__((annotate("tas_batch")))
#define BucketSize 8192
#define N 48
struct packet {
int id;
unsigned long size;
};
uint32_t hashes[BucketSize];
struct packet packet_buffer[N];
uint32_t expected[N];
// Key == Value
void fill_hashTable() {
for (int i = 0; i < BucketSize; ++i) {
hashes[i] = i;
}
}
void fill_packet_buffer(struct packet ** pkts, int n) {
for (int i = 0; i < n; ++i) {
packet_buffer[i].id = i;
packet_buffer[i].size = 32; // Fixed sized packets
}
}
void test_loop_function() {
int M = 10;
int sum = 0;
for (int i = 0; i < M; ++i) {
for (int j = 0; j < M; ++j) {
sum = sum + j;
}
}
}
void hash_lookup_loopSplit(struct packet * pkt) TAS_BATCH {
int n = N;
struct packet * p EXPENSIVE;
for (int i = 0; i < n; ++i) {
p = pkt;
uint32_t h;
h = hashes[p->id];
printf("%d", h);
}
printf("access %d", p->id);
for (int i = 0; i < n; ++i) {
printf("loop 2\n");
}
return;
}
void hash_lookup_v2(struct packet * pkt) {
int n = N;
for (int i = 0; i < n; ++i) {
uint32_t h;
h = hashes[pkt->id];
printf("%d", h);
for (int i = 0; i < 10; ++i) {
printf("loop 2\n");
}
}
return;
}
void hash_lookup(struct packet * pkt EXPENSIVE) {
uint32_t h;
struct packet * p EXPENSIVE;
h = hashes[pkt->id];
printf("%d", h);
printf("loop 2\n");
return;
}
/*
void hash_lookup_batched(struct packet ** pkts, uint16_t B) {
uint32_t h[B];
for (int i = 0; i < B; ++i) {
h[i] = hashes[pkts[i]->id];
}
}
*/
int main() {
struct packet ** pkts_buf = malloc(N * sizeof(struct packet *));
for (int i = 0; i < N; ++i)
pkts_buf[i] = malloc(sizeof(struct packet));
fill_hashTable();
fill_packet_buffer(pkts_buf, N);
for (int i = 0; i < N; ++i) {
hash_lookup(pkts_buf[i]);
}
// Release memory
for (int i = 0; i < N; ++i)
free(pkts_buf[i]);
free(pkts_buf);
return EXIT_SUCCESS;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "BatchMaker.h"
#include "BatchProcess.h"
#include "ForLoop.h"
#include "Util.h"
......@@ -24,23 +25,14 @@ namespace tas {
bool BatchMaker::run() {
/* Steps:
*
* 1. Identify batch and non-batch related arguments in scalar function (non-batch)
* 2. Create batch function with appropriate input parameter types.
* 3. Create Entry basic block [ENTRYBB].
* 4. Move instructions with non-batch related arguments to entry basic block.
* 5. Create basic block with set up related to batched argument, followed by entry basic block [BATCH_ENTRYBB].
* 6. Add empty for loop followed by BATCH_ENTRYBB.