diff --git a/TDs/TD1/CODE/1-VECTOR/Makefile b/TDs/TD1/CODE/1-VECTOR/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..3fec3ae785321b5573042281d04b96c5b7b78131 --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/Makefile @@ -0,0 +1,17 @@ +CC=gcc +CFLAGS=-Wall -c -O3 + +all: main + ./main + +main: compute.o libvector.so + $(CC) main.c compute.o -o main -L. -lvector -O3 + +compute.o: + $(CC) $(CFLAGS) compute.c + +libvector.so: vector.o + $(CC) -shared -fPIC -o libvector.so vector.o -O3 + +vector.o: + $(CC) $(CFLAGS) vector.c \ No newline at end of file diff --git a/TDs/TD1/CODE/1-VECTOR/compute.c b/TDs/TD1/CODE/1-VECTOR/compute.c new file mode 100644 index 0000000000000000000000000000000000000000..1e479a89fed6003c700fe81646d394dcfe7f0bc0 --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/compute.c @@ -0,0 +1,70 @@ +/** + * \file compute.c + * \brief Allocate, add vectors and print results + */ +#include <stdlib.h> +#include <stdio.h> +#include "compute.h" +#include "vector.h" +#include "timer.h" + +/** + * \brief Print vectors to check if V1 + V2 = V3 + * \param v1 source vector V1 + * \param v2 source vector V2 + * \param v3 result vector V3 + * \param size size of all vectors + */ +void print_results(unsigned int *v1, + unsigned int *v2, + unsigned int *v3, + unsigned int size) +{ + + unsigned int i; + + printf("\tV1\t+\tV2\t=\tV3\n"); + printf("\t----------------------------------\n"); + + for (i = 0; i < size; i++) + { + printf("\t%d\t \t%d\t \t%d\n", + v1[i], v2[i], v3[i]); + } +} + +/** + * \brief Allocate, compute V3 = V1 + V2, print results and time spent + * \param vector_size vector size of all vectors + * \param repeat repeat operation "repeat" times to get meaningful duration + */ +void compute(unsigned int vector_size, unsigned int repeat) +{ + unsigned int *V1, *V2, *V3; + unsigned int i; + TIMER_INIT + + V1 = allocate_vector(vector_size); + V2 = allocate_vector(vector_size); + V3 = allocate_vector(vector_size); + + // Initialize each vecto + init_vector(V1, vector_size, 1); + init_vector(V2, vector_size, 2); + init_vector(V3, vector_size, 0); + + // V3 = V1 + V2 + TIMER_START + for (i = 0; i < repeat; i++) + { + add_vectors(V3, V1, V2, vector_size); + } + TIMER_END + + print_results(V1, V2, V3, vector_size); + TIMER_PRINT + + free_vector(&V1); + free_vector(&V2); + free_vector(&V3); +} diff --git a/TDs/TD1/CODE/1-VECTOR/compute.h b/TDs/TD1/CODE/1-VECTOR/compute.h new file mode 100644 index 0000000000000000000000000000000000000000..b0d73b99d86a9feeed8dd4c43eac15ff824f0633 --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/compute.h @@ -0,0 +1,12 @@ +#ifndef __COMPUTE__H +#define __COMPUTE__H + +void print_results(unsigned int *v1, + unsigned int *v2, + unsigned int *v3, + unsigned int size); + +void compute(unsigned int vector_size, + unsigned int repeat); + +#endif diff --git a/TDs/TD1/CODE/1-VECTOR/compute.o b/TDs/TD1/CODE/1-VECTOR/compute.o new file mode 100644 index 0000000000000000000000000000000000000000..e80411053ecb2bf92fbd53d98ef82105e5864c94 Binary files /dev/null and b/TDs/TD1/CODE/1-VECTOR/compute.o differ diff --git a/TDs/TD1/CODE/1-VECTOR/libvector.so b/TDs/TD1/CODE/1-VECTOR/libvector.so new file mode 100644 index 0000000000000000000000000000000000000000..8a539e32afb8bcf1386b6c7d1758cd60ea6a7787 Binary files /dev/null and b/TDs/TD1/CODE/1-VECTOR/libvector.so differ diff --git a/TDs/TD1/CODE/1-VECTOR/main b/TDs/TD1/CODE/1-VECTOR/main new file mode 100644 index 0000000000000000000000000000000000000000..d31b04ee2d4c3b6a0062cf4831c81e88a0ba5c02 Binary files /dev/null and b/TDs/TD1/CODE/1-VECTOR/main differ diff --git a/TDs/TD1/CODE/1-VECTOR/main.c b/TDs/TD1/CODE/1-VECTOR/main.c new file mode 100644 index 0000000000000000000000000000000000000000..22e06578d7026f51471933deeeb6a8c1917f7af3 --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/main.c @@ -0,0 +1,33 @@ +/** + * \file main.c + * \brief main TD1 - part1 GCC + */ + +#include <stdlib.h> +#include <stdio.h> +#include "compute.h" + +#define VECTOR_SIZE 32 +#define REPEAT (unsigned int)3E7 + +/** + * \brief Print header and info + */ +void print_info() +{ + printf("******************************************************\n"); + printf(" HPC/BigData - module CA - TD1: part1 GCC \n"); + printf(" Add two vectors and store values in a third one \n"); + printf(" Vectors size: %d\n", VECTOR_SIZE); + printf(" Repeat %u times\n", REPEAT); + printf("******************************************************\n"); +} + +int main(int argc, char **argv) +{ + print_info(); + + compute(VECTOR_SIZE, REPEAT); + + // float useless = 0; +} diff --git a/TDs/TD1/CODE/1-VECTOR/timer.h b/TDs/TD1/CODE/1-VECTOR/timer.h new file mode 100644 index 0000000000000000000000000000000000000000..b7e88faf775127e1f8612a565db260ad098b0934 --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/timer.h @@ -0,0 +1,20 @@ +#ifndef __TIMER__H +#define __TIMER__H + +#include <sys/time.h> + +#define TIMER_INIT long t_start, t_end; +#define TIMER_START t_start = usecs(); +#define TIMER_END t_end = usecs(); +#define TIMER_RESULT_IN_SECONDS (double)(t_end - t_start) / 1E6 +#define TIMER_PRINT printf("ELAPSED TIME: %.2g s\n", TIMER_RESULT_IN_SECONDS); + +static inline long usecs(void) +{ + struct timeval t; + gettimeofday(&t, NULL); + + return t.tv_sec * 1000000 + t.tv_usec; +} + +#endif diff --git a/TDs/TD1/CODE/1-VECTOR/vector.c b/TDs/TD1/CODE/1-VECTOR/vector.c new file mode 100644 index 0000000000000000000000000000000000000000..c8ef3c3d28b9453fb02b8fc9c33f11b0ca2ad27c --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/vector.c @@ -0,0 +1,68 @@ +/** + * \file vector.c + * \brief Vector operations + */ +#include "vector.h" +#include "malloc.h" + +/** + * \brief Allocate a vector with the specified size + * \param size size of the vector to allocate + * \return ptr to the allocated vector + */ +unsigned int *allocate_vector(unsigned int size) +{ + unsigned int *vector; + vector = (unsigned int *)malloc(sizeof(unsigned int) * size); + + return vector; +} + +/** + * \brief Free an allocated vector and set its pointer to NULL + * \param vector ptr of ptr to the vector + */ +void free_vector(unsigned int **vector) +{ + free(*vector); + *vector = NULL; +} + +/** + * \brief Initialize a vector with one value + * \param vector vector to initialize + * \param size size of the vector + * \param value value to set + */ +void init_vector(unsigned int *vector, + unsigned int size, + unsigned int value) +{ + + unsigned int i; + + for (i = 0; i < size; i++) + { + vector[i] = value; + } +} + +/** + * \brief Add two vectors and store result in a third one + * \param dest vector where results are stored + * \param src1 vector 1 + * \param src2 vector 2 + * \param size size of all vectors + */ +void add_vectors(unsigned int *dest, + unsigned int *src1, + unsigned int *src2, + unsigned int size) +{ + unsigned int i; + + for (i = 0; i < size; i++) + { + dest[i] = src1[i] + src2[i]; + } +} diff --git a/TDs/TD1/CODE/1-VECTOR/vector.h b/TDs/TD1/CODE/1-VECTOR/vector.h new file mode 100644 index 0000000000000000000000000000000000000000..80e33d57aa1d92397a1430c08f49bffd5e71e9dc --- /dev/null +++ b/TDs/TD1/CODE/1-VECTOR/vector.h @@ -0,0 +1,16 @@ +#ifndef __VECTOR__H +#define __VECTOR__H + +unsigned int *allocate_vector(unsigned int size); + +void init_vector(unsigned int *vector, + unsigned int size, + unsigned int value); + +void free_vector(unsigned int **vector); + +void add_vectors(unsigned int *dest, + unsigned int *src1, + unsigned int *src2, + unsigned int size); +#endif diff --git a/TDs/TD1/CODE/1-VECTOR/vector.o b/TDs/TD1/CODE/1-VECTOR/vector.o new file mode 100644 index 0000000000000000000000000000000000000000..f9b2e140387db3bb1beab6e629124ff43ecc2273 Binary files /dev/null and b/TDs/TD1/CODE/1-VECTOR/vector.o differ diff --git a/TDs/TD1/CODE/3-BUGS/main b/TDs/TD1/CODE/3-BUGS/main new file mode 100644 index 0000000000000000000000000000000000000000..4eb5a1b5a6f2b3fd587ab09a686e26f7712cacff Binary files /dev/null and b/TDs/TD1/CODE/3-BUGS/main differ diff --git a/TDs/TD1/CODE/3-BUGS/main.c b/TDs/TD1/CODE/3-BUGS/main.c new file mode 100644 index 0000000000000000000000000000000000000000..7d805fdce3094a810cb8b005d26522ca8b2302c7 --- /dev/null +++ b/TDs/TD1/CODE/3-BUGS/main.c @@ -0,0 +1,114 @@ +/** + * \file main.c + * \brief main TD1 - part1 GCC + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +typedef struct fibo_s +{ + unsigned int result; + unsigned int n_minus_1; + unsigned int n_minus_2; + unsigned int max; +} Fibo; + +/** + * \brief Print header and info + */ +void print_info() +{ + printf("******************************************************\n"); + printf(" ENSIIE - module CA - TD1: part3 GDB \n"); + printf(" mean floored - factorial - fibonacci \n"); + printf("******************************************************\n"); +} + +unsigned int factorial(unsigned int val) +{ + if (val == 0) + { + return 1; + } + else + { + return factorial(val - 1) * val; + } +} + +void fibonacci(Fibo *fibo_values, unsigned int n) +{ + switch (n) + { + case 0: + fibo_values->result = fibo_values->n_minus_2; + break; + case 1: + fibo_values->result = fibo_values->n_minus_1; + break; + default: + fibonacci(fibo_values, n - 1); + fibo_values->result = fibo_values->n_minus_1 + fibo_values->n_minus_2; + fibo_values->n_minus_2 = fibo_values->n_minus_1; + fibo_values->n_minus_1 = fibo_values->result; + break; + } +} + +void launch_fibonacci(Fibo *fibo_values, unsigned int max) +{ + fibo_values->max = max; + fibo_values->n_minus_1 = 1; + fibo_values->n_minus_2 = 0; + fibonacci(fibo_values, max); +} + +unsigned int floor_mean(unsigned int *list, unsigned int nb) +{ + unsigned int result = 0; + unsigned int i; + + for (i = 0; i < nb; i++) + { + result += list[i]; + } + + // memset(&nb, 0, sizeof(unsigned int)); + result /= nb; + + return result; +} + +int main(int argc, char **argv) +{ + unsigned int i, value; + print_info(); + + // Exercice 1: mean (florred) of 100 values + unsigned int *list = malloc(sizeof(unsigned int) * 100); + for (i = 0; i < 100; i++) + { + list[i] = 3 * i + 1; + } + value = floor_mean(list, 100); + free(list); + printf("1) mean value = %d\n", value); + + // Exercice 2: factorial + value = factorial(4); + printf("2) factorial value = %d\n", value); + + // Exercice 3: another factorial + value = factorial(1); + printf("3) Another factorial value = %d\n", value); + + // Exercice 4 & 5: fibonacci + Fibo *fibo_values = malloc(sizeof(Fibo)); + int n = 6; + launch_fibonacci(fibo_values, n); + printf("4) fibonacci value F%d = %d\n", n, fibo_values->result); + + return 0; +} diff --git a/TDs/TD1/CODE/4-SAXPY/main b/TDs/TD1/CODE/4-SAXPY/main new file mode 100644 index 0000000000000000000000000000000000000000..ed44b1b8c8a62dac57ed5f65eda0d5c22798241e Binary files /dev/null and b/TDs/TD1/CODE/4-SAXPY/main differ diff --git a/TDs/TD1/CODE/4-SAXPY/main.c b/TDs/TD1/CODE/4-SAXPY/main.c new file mode 100644 index 0000000000000000000000000000000000000000..682c7e087f40e0257e646b26f83fb056466f3e2d --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> + +void saxpy(int *res, int *x, int *y, int a, int size) +{ + int i; + for (i = 0; i < size; i++) + { + res[i] = a * x[i] + y[i]; + } +} + +int main(int argc, char *argv[]) +{ + int i; + int size = 100; + int *res, *x, *y; + int a = 2; + + res = malloc(sizeof(int) * size); + x = malloc(sizeof(int) * size); + y = malloc(sizeof(int) * size); + + for (i = 0; i < size; i++) + { + x[i] = 50 + i; + y[i] = i; + } + + saxpy(res, x, y, a, size); + + for (i = 0; i < 100; i++) + { + printf("res[%d] = %d ; ", i, res[i]); + if ((i + 1) % 10 == 0) + printf("\n"); + } + + return 1; +} diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.005t.original b/TDs/TD1/CODE/4-SAXPY/main.c.005t.original new file mode 100644 index 0000000000000000000000000000000000000000..4e37b8ba35e37a15351f2261dbf7ef569244ff0e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.005t.original @@ -0,0 +1,301 @@ + +;; Function vprintf (null) +;; enabled by -tree-original + + +{ + return vfprintf (stdout, (const char *) __fmt, __arg); +} + + +;; Function getchar (null) +;; enabled by -tree-original + + +{ + return getc (stdin); +} + + +;; Function fgetc_unlocked (null) +;; enabled by -tree-original + + +{ + return __builtin_expect (__fp->_IO_read_ptr >= __fp->_IO_read_end, 0) != 0 ? __uflow (__fp) : (int) *(unsigned char *) __fp->_IO_read_ptr++ ; +} + + +;; Function getc_unlocked (null) +;; enabled by -tree-original + + +{ + return __builtin_expect (__fp->_IO_read_ptr >= __fp->_IO_read_end, 0) != 0 ? __uflow (__fp) : (int) *(unsigned char *) __fp->_IO_read_ptr++ ; +} + + +;; Function getchar_unlocked (null) +;; enabled by -tree-original + + +{ + return __builtin_expect (stdin->_IO_read_ptr >= stdin->_IO_read_end, 0) != 0 ? __uflow (stdin) : (int) *(unsigned char *) stdin->_IO_read_ptr++ ; +} + + +;; Function putchar (null) +;; enabled by -tree-original + + +{ + return putc (__c, stdout); +} + + +;; Function fputc_unlocked (null) +;; enabled by -tree-original + + +{ + return __builtin_expect (__stream->_IO_write_ptr >= __stream->_IO_write_end, 0) != 0 ? __overflow (__stream, (int) (unsigned char) __c) : (int) (unsigned char) (*__stream->_IO_write_ptr++ = (char) __c); +} + + +;; Function putc_unlocked (null) +;; enabled by -tree-original + + +{ + return __builtin_expect (__stream->_IO_write_ptr >= __stream->_IO_write_end, 0) != 0 ? __overflow (__stream, (int) (unsigned char) __c) : (int) (unsigned char) (*__stream->_IO_write_ptr++ = (char) __c); +} + + +;; Function putchar_unlocked (null) +;; enabled by -tree-original + + +{ + return __builtin_expect (stdout->_IO_write_ptr >= stdout->_IO_write_end, 0) != 0 ? __overflow (stdout, (int) (unsigned char) __c) : (int) (unsigned char) (*stdout->_IO_write_ptr++ = (char) __c); +} + + +;; Function feof_unlocked (null) +;; enabled by -tree-original + + +{ + return (__stream->_flags & 16) != 0; +} + + +;; Function ferror_unlocked (null) +;; enabled by -tree-original + + +{ + return (__stream->_flags & 32) != 0; +} + + +;; Function atoi (null) +;; enabled by -tree-original + + +{ + return (int) strtol (__nptr, 0B, 10); +} + + +;; Function atol (null) +;; enabled by -tree-original + + +{ + return strtol (__nptr, 0B, 10); +} + + +;; Function atoll (null) +;; enabled by -tree-original + + +{ + return strtoll (__nptr, 0B, 10); +} + + +;; Function __bswap_16 (null) +;; enabled by -tree-original + + +{ + return (__uint16_t) __builtin_bswap16 ((int) __bsx); +} + + +;; Function __bswap_32 (null) +;; enabled by -tree-original + + +{ + return (__uint32_t) __builtin_bswap32 (__bsx); +} + + +;; Function __bswap_64 (null) +;; enabled by -tree-original + + +{ + return (__uint64_t) __builtin_bswap64 (__bsx); +} + + +;; Function __uint16_identity (null) +;; enabled by -tree-original + + +{ + return __x; +} + + +;; Function __uint32_identity (null) +;; enabled by -tree-original + + +{ + return __x; +} + + +;; Function __uint64_identity (null) +;; enabled by -tree-original + + +{ + return __x; +} + + +;; Function bsearch (null) +;; enabled by -tree-original + + +{ + size_t __l; + size_t __u; + size_t __idx; + const void * __p; + int __comparison; + + size_t __l; + size_t __u; + size_t __idx; + const void * __p; + int __comparison; + __l = 0; + __u = __nmemb; + goto <D.2854>; + <D.2855>:; + __idx = (__l + __u) / 2; + __p = __base + (sizetype) (__idx * __size); + __comparison = __compar (__key, __p); + if (__comparison < 0) + { + __u = __idx; + } + else + { + if (__comparison > 0) + { + __l = __idx + 1; + } + else + { + return (void *) __p; + } + } + <D.2854>:; + if (__l < __u) goto <D.2855>; else goto <D.2853>; + <D.2853>:; + return 0B; +} + + +;; Function atof (null) +;; enabled by -tree-original + + +{ + return strtod (__nptr, 0B); +} + + +;; Function saxpy (null) +;; enabled by -tree-original + + +{ + int i; + + int i; + i = 0; + goto <D.2973>; + <D.2972>:; + *(res + (sizetype) ((long unsigned int) i * 4)) = *(x + (sizetype) ((long unsigned int) i * 4)) * a + *(y + (sizetype) ((long unsigned int) i * 4)); + i++ ; + <D.2973>:; + if (i < size) goto <D.2972>; else goto <D.2970>; + <D.2970>:; +} + + +;; Function main (null) +;; enabled by -tree-original + + +{ + int i; + int size = 100; + int * res; + int * x; + int * y; + int a = 2; + + int i; + int size = 100; + int * res; + int * x; + int * y; + int a = 2; + res = (int *) malloc ((long unsigned int) size * 4); + x = (int *) malloc ((long unsigned int) size * 4); + y = (int *) malloc ((long unsigned int) size * 4); + i = 0; + goto <D.2987>; + <D.2986>:; + *(x + (sizetype) ((long unsigned int) i * 4)) = i + 50; + *(y + (sizetype) ((long unsigned int) i * 4)) = i; + i++ ; + <D.2987>:; + if (i < size) goto <D.2986>; else goto <D.2984>; + <D.2984>:; + saxpy (res, x, y, a, size); + i = 0; + goto <D.2991>; + <D.2990>:; + printf ((const char * restrict) "res[%d] = %d ; ", i, *(res + (sizetype) ((long unsigned int) i * 4))); + if ((i + 1) % 10 == 0) + { + printf ((const char * restrict) "\n"); + } + i++ ; + <D.2991>:; + if (i <= 99) goto <D.2990>; else goto <D.2988>; + <D.2988>:; + return 1; +} +return 0; + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.006t.gimple b/TDs/TD1/CODE/4-SAXPY/main.c.006t.gimple new file mode 100644 index 0000000000000000000000000000000000000000..ebc6f722520688e2d5611d9384ef6c6da030f7c4 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.006t.gimple @@ -0,0 +1,95 @@ +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + i = 0; + goto <D.2973>; + <D.2972>: + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + <D.2973>: + if (i < size) goto <D.2972>; else goto <D.2970>; + <D.2970>: +} + + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int D.2995; + + { + int i; + int size; + int * res; + int * x; + int * y; + int a; + + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <D.2987>; + <D.2986>: + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + <D.2987>: + if (i < size) goto <D.2986>; else goto <D.2984>; + <D.2984>: + saxpy (res, x, y, a, size); + i = 0; + goto <D.2991>; + <D.2990>: + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) goto <D.2993>; else goto <D.2994>; + <D.2993>: + printf ("\n"); + <D.2994>: + i = i + 1; + <D.2991>: + if (i <= 99) goto <D.2990>; else goto <D.2988>; + <D.2988>: + D.2995 = 1; + return D.2995; + } + D.2995 = 0; + return D.2995; +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.009t.omplower b/TDs/TD1/CODE/4-SAXPY/main.c.009t.omplower new file mode 100644 index 0000000000000000000000000000000000000000..d6b02d42400bd413a62b24bb6996852cc111f770 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.009t.omplower @@ -0,0 +1,101 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + i = 0; + goto <D.2973>; + <D.2972>: + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + <D.2973>: + if (i < size) goto <D.2972>; else goto <D.2970>; + <D.2970>: +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int D.2995; + + { + int i; + int size; + int * res; + int * x; + int * y; + int a; + + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <D.2987>; + <D.2986>: + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + <D.2987>: + if (i < size) goto <D.2986>; else goto <D.2984>; + <D.2984>: + saxpy (res, x, y, a, size); + i = 0; + goto <D.2991>; + <D.2990>: + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) goto <D.2993>; else goto <D.2994>; + <D.2993>: + printf ("\n"); + <D.2994>: + i = i + 1; + <D.2991>: + if (i <= 99) goto <D.2990>; else goto <D.2988>; + <D.2988>: + D.2995 = 1; + return D.2995; + } + D.2995 = 0; + return D.2995; +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.010t.lower b/TDs/TD1/CODE/4-SAXPY/main.c.010t.lower new file mode 100644 index 0000000000000000000000000000000000000000..0fb3eaba6df80336584786c868446c96371c455b --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.010t.lower @@ -0,0 +1,101 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + i = 0; + goto <D.2973>; + <D.2972>: + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + <D.2973>: + if (i < size) goto <D.2972>; else goto <D.2970>; + <D.2970>: + return; +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + int D.2995; + + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <D.2987>; + <D.2986>: + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + <D.2987>: + if (i < size) goto <D.2986>; else goto <D.2984>; + <D.2984>: + saxpy (res, x, y, a, size); + i = 0; + goto <D.2991>; + <D.2990>: + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) goto <D.2993>; else goto <D.2994>; + <D.2993>: + __builtin_putchar (10); + <D.2994>: + i = i + 1; + <D.2991>: + if (i <= 99) goto <D.2990>; else goto <D.2988>; + <D.2988>: + D.2995 = 1; + goto <D.2996>; + D.2995 = 0; + goto <D.2996>; + <D.2996>: + return D.2995; +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.013t.eh b/TDs/TD1/CODE/4-SAXPY/main.c.013t.eh new file mode 100644 index 0000000000000000000000000000000000000000..0fb3eaba6df80336584786c868446c96371c455b --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.013t.eh @@ -0,0 +1,101 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + i = 0; + goto <D.2973>; + <D.2972>: + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + <D.2973>: + if (i < size) goto <D.2972>; else goto <D.2970>; + <D.2970>: + return; +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + int D.2995; + + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <D.2987>; + <D.2986>: + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + <D.2987>: + if (i < size) goto <D.2986>; else goto <D.2984>; + <D.2984>: + saxpy (res, x, y, a, size); + i = 0; + goto <D.2991>; + <D.2990>: + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) goto <D.2993>; else goto <D.2994>; + <D.2993>: + __builtin_putchar (10); + <D.2994>: + i = i + 1; + <D.2991>: + if (i <= 99) goto <D.2990>; else goto <D.2988>; + <D.2988>: + D.2995 = 1; + goto <D.2996>; + D.2995 = 0; + goto <D.2996>; + <D.2996>: + return D.2995; +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.015t.cfg b/TDs/TD1/CODE/4-SAXPY/main.c.015t.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6be5c80fe22ce9efd74f2633599600343f5d512f --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.015t.cfg @@ -0,0 +1,166 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + <bb 2> : + i = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + + <bb 4> : + if (i < size) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +Removing basic block 11 +Merging blocks 10 and 12 +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 8 9 10 +;; +;; Loop 2 +;; header 9, latch 8 +;; depth 1, outer 0 +;; nodes: 9 8 6 7 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 9 } +;; 6 succs { 7 8 } +;; 7 succs { 8 } +;; 8 succs { 9 } +;; 9 succs { 6 10 } +;; 10 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + int D.2995; + + <bb 2> : + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + + <bb 4> : + if (i < size) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res, x, y, a, size); + i = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i = i + 1; + + <bb 9> : + if (i <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + D.2995 = 1; + return D.2995; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.017t.ompexp b/TDs/TD1/CODE/4-SAXPY/main.c.017t.ompexp new file mode 100644 index 0000000000000000000000000000000000000000..7ea604cd4690cb4174f90b2dd32d1749047931f1 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.017t.ompexp @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + <bb 2> : + i = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + + <bb 4> : + if (i < size) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + int D.2995; + + <bb 2> : + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + + <bb 4> : + if (i < size) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res, x, y, a, size); + i = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i = i + 1; + + <bb 9> : + if (i <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + D.2995 = 1; + return D.2995; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.020t.fixup_cfg1 b/TDs/TD1/CODE/4-SAXPY/main.c.020t.fixup_cfg1 new file mode 100644 index 0000000000000000000000000000000000000000..7ea604cd4690cb4174f90b2dd32d1749047931f1 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.020t.fixup_cfg1 @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + + <bb 2> : + i = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i; + _2 = _1 * 4; + _3 = x + _2; + _4 = *_3; + _5 = a * _4; + _6 = (long unsigned int) i; + _7 = _6 * 4; + _8 = y + _7; + _9 = *_8; + _10 = (long unsigned int) i; + _11 = _10 * 4; + _12 = res + _11; + _13 = _5 + _9; + *_12 = _13; + i = i + 1; + + <bb 4> : + if (i < size) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + int D.2995; + + <bb 2> : + size = 100; + a = 2; + _1 = (long unsigned int) size; + _2 = _1 * 4; + res = malloc (_2); + _3 = (long unsigned int) size; + _4 = _3 * 4; + x = malloc (_4); + _5 = (long unsigned int) size; + _6 = _5 * 4; + y = malloc (_6); + i = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i; + _8 = _7 * 4; + _9 = x + _8; + _10 = i + 50; + *_9 = _10; + _11 = (long unsigned int) i; + _12 = _11 * 4; + _13 = y + _12; + *_13 = i; + i = i + 1; + + <bb 4> : + if (i < size) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res, x, y, a, size); + i = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i; + _15 = _14 * 4; + _16 = res + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i, _17); + _18 = i + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i = i + 1; + + <bb 9> : + if (i <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + D.2995 = 1; + return D.2995; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.021t.ssa b/TDs/TD1/CODE/4-SAXPY/main.c.021t.ssa new file mode 100644 index 0000000000000000000000000000000000000000..7b81b245e321e36824c5fc81b7e921ce87ba95fb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.021t.ssa @@ -0,0 +1,159 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.022t.walloca1 b/TDs/TD1/CODE/4-SAXPY/main.c.022t.walloca1 new file mode 100644 index 0000000000000000000000000000000000000000..7b81b245e321e36824c5fc81b7e921ce87ba95fb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.022t.walloca1 @@ -0,0 +1,159 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.025t.waccess1 b/TDs/TD1/CODE/4-SAXPY/main.c.025t.waccess1 new file mode 100644 index 0000000000000000000000000000000000000000..a03cf74d3dd6cc0ff4a8648f53cb077c29405689 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.025t.waccess1 @@ -0,0 +1,177 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +pointer_query counters: + index cache size: 0 + index entries: 0 + access cache size: 0 + access entries: 0 + hits: 0 + misses: 4 + failures: 0 + max_depth: 1 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +pointer_query counters: + index cache size: 0 + index entries: 0 + access cache size: 0 + access entries: 0 + hits: 0 + misses: 10 + failures: 0 + max_depth: 1 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.027t.nothrow b/TDs/TD1/CODE/4-SAXPY/main.c.027t.nothrow new file mode 100644 index 0000000000000000000000000000000000000000..d28ed8b427626eb64ac69fbf58f0971b1be14cf7 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.027t.nothrow @@ -0,0 +1,161 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Function found to be nothrow: saxpy +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +Function found to be nothrow: main +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.029t.fixup_cfg2 b/TDs/TD1/CODE/4-SAXPY/main.c.029t.fixup_cfg2 new file mode 100644 index 0000000000000000000000000000000000000000..7b81b245e321e36824c5fc81b7e921ce87ba95fb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.029t.fixup_cfg2 @@ -0,0 +1,159 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.030t.local-fnsummary1 b/TDs/TD1/CODE/4-SAXPY/main.c.030t.local-fnsummary1 new file mode 100644 index 0000000000000000000000000000000000000000..0cfd705d0d109d9b6c4903b6b5400f75ccda6e87 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.030t.local-fnsummary1 @@ -0,0 +1,201 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + + +Analyzing function body size: saxpy/22 + +IPA function summary for saxpy/22 inlinable + global time: 16.000000 + self size: 17 + global size: 0 + min size: 0 + self stack: 0 + global stack: 0 + size:14.000000, time:14.000000 + size:3.000000, time:2.000000, executed if:(not inlined) + calls: + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + + +Analyzing function body size: main/23 + +IPA function summary for main/23 inlinable + global time: 97.000000 + self size: 44 + global size: 0 + min size: 0 + self stack: 0 + global stack: 0 + size:20.000000, time:20.000000 + size:3.000000, time:2.000000, executed if:(not inlined) + calls: + __builtin_putchar/26 function body not available + freq:1.00 loop depth: 1 size: 2 time: 11 + op0 is compile time invariant + printf/25 function body not available + freq:1.00 loop depth: 1 size: 4 time: 13 + op0 is compile time invariant + saxpy/22 function not considered for inlining + freq:1.00 loop depth: 0 size: 6 time: 15 callee size: 7 stack: 0 + malloc/24 function body not available + freq:1.00 loop depth: 0 size: 3 time: 12 + malloc/24 function body not available + freq:1.00 loop depth: 0 size: 3 time: 12 + malloc/24 function body not available + freq:1.00 loop depth: 0 size: 3 time: 12 + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.031t.einline b/TDs/TD1/CODE/4-SAXPY/main.c.031t.einline new file mode 100644 index 0000000000000000000000000000000000000000..dc21452df879b26828610b97f0e2b186c1c0e579 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.031t.einline @@ -0,0 +1,161 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Iterations: 0 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +Iterations: 0 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.032t.early_optimizations b/TDs/TD1/CODE/4-SAXPY/main.c.032t.early_optimizations new file mode 100644 index 0000000000000000000000000000000000000000..7b81b245e321e36824c5fc81b7e921ce87ba95fb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.032t.early_optimizations @@ -0,0 +1,159 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.033t.early_objsz b/TDs/TD1/CODE/4-SAXPY/main.c.033t.early_objsz new file mode 100644 index 0000000000000000000000000000000000000000..7b81b245e321e36824c5fc81b7e921ce87ba95fb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.033t.early_objsz @@ -0,0 +1,159 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + i_16 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <i_16(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _1; + long unsigned int _2; + long unsigned int _3; + long unsigned int _4; + long unsigned int _5; + long unsigned int _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + int _37; + + <bb 2> : + size_25 = 100; + a_26 = 2; + _1 = (long unsigned int) size_25; + _2 = _1 * 4; + res_29 = malloc (_2); + _3 = (long unsigned int) size_25; + _4 = _3 * 4; + x_31 = malloc (_4); + _5 = (long unsigned int) size_25; + _6 = _5 * 4; + y_33 = malloc (_6); + i_34 = 0; + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <i_34(2), i_43(3)> + if (i_20 < size_25) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, a_26, size_25); + i_36 = 0; + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <i_36(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + _37 = 1; + return _37; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.034t.ccp1 b/TDs/TD1/CODE/4-SAXPY/main.c.034t.ccp1 new file mode 100644 index 0000000000000000000000000000000000000000..7bcf70b309743e27c197bf199a4a7cb8e186bbb2 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.034t.ccp1 @@ -0,0 +1,140 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = a_20(D) * _4; + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <0(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.035t.forwprop1 b/TDs/TD1/CODE/4-SAXPY/main.c.035t.forwprop1 new file mode 100644 index 0000000000000000000000000000000000000000..9d5ed9dd81f31c25fb704c09ffd1b20cdd6d88c0 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.035t.forwprop1 @@ -0,0 +1,140 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <0(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.036t.ethread b/TDs/TD1/CODE/4-SAXPY/main.c.036t.ethread new file mode 100644 index 0000000000000000000000000000000000000000..e8fe3ac7723db6ce20f218e8e2f07c410b25f5c5 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.036t.ethread @@ -0,0 +1,180 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 8 9 10 +;; +;; Loop 2 +;; header 9, latch 8 +;; depth 1, outer 0 +;; nodes: 9 8 6 7 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 9 } +;; 6 succs { 7 8 } +;; 7 succs { 8 } +;; 8 succs { 9 } +;; 9 succs { 6 10 } +;; 10 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <0(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.037t.esra b/TDs/TD1/CODE/4-SAXPY/main.c.037t.esra new file mode 100644 index 0000000000000000000000000000000000000000..9d5ed9dd81f31c25fb704c09ffd1b20cdd6d88c0 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.037t.esra @@ -0,0 +1,140 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <0(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.038t.ealias b/TDs/TD1/CODE/4-SAXPY/main.c.038t.ealias new file mode 100644 index 0000000000000000000000000000000000000000..b029ec71857b787f8bc4cb3b800f1f8715244508 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.038t.ealias @@ -0,0 +1,472 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Points-to analysis + +Constraints: + +ANYTHING = &ANYTHING +ESCAPED = *ESCAPED +ESCAPED = ESCAPED + UNKNOWN +*ESCAPED = NONLOCAL +NONLOCAL = &NONLOCAL +NONLOCAL = &ESCAPED +INTEGER = &ANYTHING +res = &NONLOCAL +x = &NONLOCAL +y = &NONLOCAL +a = &NONLOCAL +size = &NONLOCAL +_1 = i_14 +_2 = _1 +_2 = &NONLOCAL +_3 = x +_4 = *_3 +_5 = _4 +_5 = a +_6 = i_14 +_7 = _6 +_7 = &NONLOCAL +_8 = y +_9 = *_8 +_10 = i_14 +_11 = _10 +_11 = &NONLOCAL +_12 = res +_13 = _5 +_13 = _9 +*_12 = _13 +i_24 = i_14 +i_24 = &NONLOCAL +i_14 = &NULL +i_14 = i_24 + +Collapsing static cycles and doing variable substitution +Building predecessor graph +Detecting pointer and location equivalences +Rewriting constraints and unifying variables +Uniting pointer but not location equivalent variables +Finding indirect cycles +Solving graph + +Points-to sets + +ANYTHING = { ANYTHING } +ESCAPED = { ESCAPED NONLOCAL } +NONLOCAL = { ESCAPED NONLOCAL } same as _4 +STOREDANYTHING = { } +INTEGER = { ANYTHING } +res = { NONLOCAL } +x = { NONLOCAL } same as res +y = { NONLOCAL } same as res +a = { NONLOCAL } same as res +size = { NONLOCAL } same as res +_1 = { NULL NONLOCAL } +i_14 = { NULL NONLOCAL } same as _1 +_2 = { NULL NONLOCAL } same as _1 +_3 = { NONLOCAL } same as res +_4 = { ESCAPED NONLOCAL } +_5 = { ESCAPED NONLOCAL } same as _4 +_6 = { NULL NONLOCAL } same as _1 +_7 = { NULL NONLOCAL } same as _1 +_8 = { NONLOCAL } same as res +_9 = { ESCAPED NONLOCAL } same as _4 +_10 = { NULL NONLOCAL } same as _1 +_11 = { NULL NONLOCAL } same as _1 +_12 = { NONLOCAL } same as res +_13 = { ESCAPED NONLOCAL } same as _4 +i_24 = { NULL NONLOCAL } same as _1 + + +Alias information for saxpy + +Aliased symbols + + +Call clobber information + +ESCAPED, points-to non-local, points-to vars: { } + +Flow-insensitive points-to information + +_3, points-to non-local, points-to NULL, points-to vars: { } +_8, points-to non-local, points-to NULL, points-to vars: { } +_12, points-to non-local, points-to NULL, points-to vars: { } +x_19(D), points-to non-local, points-to NULL, points-to vars: { } +y_21(D), points-to non-local, points-to NULL, points-to vars: { } +res_22(D), points-to non-local, points-to NULL, points-to vars: { } + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + long unsigned int _6; + long unsigned int _7; + int * _8; + int _9; + long unsigned int _10; + long unsigned int _11; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _6 = (long unsigned int) i_14; + _7 = _6 * 4; + _8 = y_21(D) + _7; + _9 = *_8; + _10 = (long unsigned int) i_14; + _11 = _10 * 4; + _12 = res_22(D) + _11; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +Points-to analysis + +Constraints: + +ANYTHING = &ANYTHING +ESCAPED = *ESCAPED +ESCAPED = ESCAPED + UNKNOWN +*ESCAPED = NONLOCAL +NONLOCAL = &NONLOCAL +NONLOCAL = &ESCAPED +INTEGER = &ANYTHING +argc = &NONLOCAL +argv = &NONLOCAL +callescape(11) = &NONLOCAL +CALLUSED(12) = callescape(11) +callarg(14) = &NONLOCAL +callarg(14) = callarg(14) + UNKNOWN +callarg(14) = *callarg(14) + UNKNOWN +CALLUSED(12) = callarg(14) +*callarg(14) = callescape(11) +CALLCLOBBERED(13) = callarg(14) +callescape(11) = callarg(14) +res_29 = &HEAP(16) +callescape(17) = &NONLOCAL +CALLUSED(18) = callescape(17) +callarg(20) = &NONLOCAL +callarg(20) = callarg(20) + UNKNOWN +callarg(20) = *callarg(20) + UNKNOWN +CALLUSED(18) = callarg(20) +*callarg(20) = callescape(17) +CALLCLOBBERED(19) = callarg(20) +callescape(17) = callarg(20) +x_31 = &HEAP(22) +callescape(23) = &NONLOCAL +CALLUSED(24) = callescape(23) +callarg(26) = &NONLOCAL +callarg(26) = callarg(26) + UNKNOWN +callarg(26) = *callarg(26) + UNKNOWN +CALLUSED(24) = callarg(26) +*callarg(26) = callescape(23) +CALLCLOBBERED(25) = callarg(26) +callescape(23) = callarg(26) +y_33 = &HEAP(28) +_7 = i_20 +_8 = _7 +_8 = &NONLOCAL +_9 = x_31 +_10 = i_20 +_10 = &NONLOCAL +*_9 = _10 +_11 = i_20 +_12 = _11 +_12 = &NONLOCAL +_13 = y_33 +*_13 = i_20 +i_43 = i_20 +i_43 = &NONLOCAL +i_20 = &NULL +i_20 = i_43 +callescape(39) = &NONLOCAL +CALLUSED(40) = callescape(39) +callarg(42) = res_29 +callarg(42) = callarg(42) + UNKNOWN +*callarg(42) = callescape(39) +CALLCLOBBERED(41) = callarg(42) +callarg(43) = x_31 +callarg(43) = callarg(43) + UNKNOWN +indircallarg(44) = *callarg(43) + UNKNOWN +indircallarg(44) = indircallarg(44) + UNKNOWN +indircallarg(44) = *indircallarg(44) + UNKNOWN +CALLUSED(40) = callarg(43) +CALLUSED(40) = indircallarg(44) +*indircallarg(44) = callescape(39) +CALLCLOBBERED(41) = indircallarg(44) +callescape(39) = indircallarg(44) +callarg(45) = y_33 +callarg(45) = callarg(45) + UNKNOWN +indircallarg(46) = *callarg(45) + UNKNOWN +indircallarg(46) = indircallarg(46) + UNKNOWN +indircallarg(46) = *indircallarg(46) + UNKNOWN +CALLUSED(40) = callarg(45) +CALLUSED(40) = indircallarg(46) +*indircallarg(46) = callescape(39) +CALLCLOBBERED(41) = indircallarg(46) +callescape(39) = indircallarg(46) +callarg(47) = &NONLOCAL +callarg(47) = callarg(47) + UNKNOWN +callarg(47) = *callarg(47) + UNKNOWN +CALLUSED(40) = callarg(47) +*callarg(47) = callescape(39) +CALLCLOBBERED(41) = callarg(47) +callescape(39) = callarg(47) +_14 = i_21 +_15 = _14 +_15 = &NONLOCAL +_16 = res_29 +_17 = *_16 +callescape(54) = NONLOCAL +CALLUSED(55) = callescape(54) +callarg(57) = &STRING +callarg(57) = callarg(57) + UNKNOWN +callarg(57) = *callarg(57) + UNKNOWN +CALLUSED(55) = callarg(57) +*callarg(57) = callescape(54) +CALLCLOBBERED(56) = callarg(57) +callescape(54) = callarg(57) +ESCAPED = &STRING +callarg(58) = i_21 +callarg(58) = callarg(58) + UNKNOWN +callarg(58) = *callarg(58) + UNKNOWN +CALLUSED(55) = callarg(58) +*callarg(58) = callescape(54) +CALLCLOBBERED(56) = callarg(58) +callescape(54) = callarg(58) +ESCAPED = i_21 +callarg(59) = _17 +callarg(59) = callarg(59) + UNKNOWN +callarg(59) = *callarg(59) + UNKNOWN +CALLUSED(55) = callarg(59) +*callarg(59) = callescape(54) +CALLCLOBBERED(56) = callarg(59) +callescape(54) = callarg(59) +ESCAPED = _17 +_18 = i_21 +_18 = &NONLOCAL +_19 = _18 +callescape(63) = NONLOCAL +CALLUSED(64) = callescape(63) +callarg(66) = &NONLOCAL +callarg(66) = callarg(66) + UNKNOWN +callarg(66) = *callarg(66) + UNKNOWN +CALLUSED(64) = callarg(66) +*callarg(66) = callescape(63) +CALLCLOBBERED(65) = callarg(66) +callescape(63) = callarg(66) +ESCAPED = &NONLOCAL +i_40 = i_21 +i_40 = &NONLOCAL +i_21 = &NULL +i_21 = i_40 + +Collapsing static cycles and doing variable substitution +Building predecessor graph +Detecting pointer and location equivalences +Rewriting constraints and unifying variables +Uniting pointer but not location equivalent variables +Finding indirect cycles +Solving graph + +Points-to sets + +ANYTHING = { ANYTHING } +ESCAPED = { NULL STRING ESCAPED NONLOCAL } +NONLOCAL = { ESCAPED NONLOCAL } +STOREDANYTHING = { } +INTEGER = { ANYTHING } +HEAP(16) = { NULL ESCAPED NONLOCAL } +HEAP(22) = { NULL NONLOCAL } +HEAP(28) = { NULL NONLOCAL } +argc = { NONLOCAL } +argv = { NONLOCAL } same as argc +malloc = { } +callescape(11) = { ESCAPED NONLOCAL } +CALLUSED(12) = { ESCAPED NONLOCAL } same as callescape(11) +CALLCLOBBERED(13) = { ESCAPED NONLOCAL } same as callescape(11) +callarg(14) = { ESCAPED NONLOCAL } same as callescape(11) +res_29 = { HEAP(16) } +callescape(17) = { ESCAPED NONLOCAL } +CALLUSED(18) = { ESCAPED NONLOCAL } same as callescape(17) +CALLCLOBBERED(19) = { ESCAPED NONLOCAL } same as callescape(17) +callarg(20) = { ESCAPED NONLOCAL } same as callescape(17) +x_31 = { HEAP(22) } +callescape(23) = { ESCAPED NONLOCAL } +CALLUSED(24) = { ESCAPED NONLOCAL } same as callescape(23) +CALLCLOBBERED(25) = { ESCAPED NONLOCAL } same as callescape(23) +callarg(26) = { ESCAPED NONLOCAL } same as callescape(23) +y_33 = { HEAP(28) } +_7 = { NULL NONLOCAL } +i_20 = { NULL NONLOCAL } same as _7 +_8 = { NULL NONLOCAL } same as _7 +_9 = { HEAP(22) } same as x_31 +_10 = { NULL NONLOCAL } same as _7 +_11 = { NULL NONLOCAL } same as _7 +_12 = { NULL NONLOCAL } same as _7 +_13 = { HEAP(28) } same as y_33 +i_43 = { NULL NONLOCAL } same as _7 +saxpy = { } +callescape(39) = { NULL ESCAPED NONLOCAL } +CALLUSED(40) = { NULL ESCAPED NONLOCAL HEAP(22) HEAP(28) } +CALLCLOBBERED(41) = { NULL ESCAPED NONLOCAL HEAP(16) } +callarg(42) = { HEAP(16) } +callarg(43) = { HEAP(22) } +indircallarg(44) = { NULL ESCAPED NONLOCAL } +callarg(45) = { HEAP(28) } +indircallarg(46) = { NULL ESCAPED NONLOCAL } +callarg(47) = { ESCAPED NONLOCAL } +_14 = { NULL NONLOCAL } same as _7 +i_21 = { NULL NONLOCAL } same as _7 +_15 = { NULL NONLOCAL } same as _7 +_16 = { HEAP(16) } same as res_29 +_17 = { NULL ESCAPED NONLOCAL } +printf = { } +callescape(54) = { NULL STRING ESCAPED NONLOCAL } +CALLUSED(55) = { NULL STRING ESCAPED NONLOCAL } same as callescape(54) +CALLCLOBBERED(56) = { NULL STRING ESCAPED NONLOCAL } +callarg(57) = { STRING } +callarg(58) = { NULL ESCAPED NONLOCAL } +callarg(59) = { NULL ESCAPED NONLOCAL } +_18 = { NULL NONLOCAL } same as _7 +_19 = { NULL NONLOCAL } same as _7 +putchar = { } +callescape(63) = { ESCAPED NONLOCAL } +CALLUSED(64) = { ESCAPED NONLOCAL } same as callescape(63) +CALLCLOBBERED(65) = { ESCAPED NONLOCAL } same as callarg(66) +callarg(66) = { ESCAPED NONLOCAL } +i_40 = { NULL NONLOCAL } same as _7 +main = { } + + +Alias information for main + +Aliased symbols + + +Call clobber information + +ESCAPED, points-to non-local, points-to NULL, points-to vars: { } + +Flow-insensitive points-to information + +_9, points-to NULL, points-to vars: { D.3001 } +_13, points-to NULL, points-to vars: { D.3002 } +_16, points-to NULL, points-to vars: { D.3000 } +res_29, points-to NULL, points-to vars: { D.3000 } +x_31, points-to NULL, points-to vars: { D.3001 } +y_33, points-to NULL, points-to vars: { D.3002 } + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + long unsigned int _11; + long unsigned int _12; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _11 = (long unsigned int) i_20; + _12 = _11 * 4; + _13 = y_33 + _12; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + i_40 = i_21 + 1; + + <bb 9> : + # i_21 = PHI <0(5), i_40(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.039t.fre1 b/TDs/TD1/CODE/4-SAXPY/main.c.039t.fre1 new file mode 100644 index 0000000000000000000000000000000000000000..8517a01ddefe5c62d8917ca4a0070c58c7ff8072 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.039t.fre1 @@ -0,0 +1,127 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 8>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 8> : + + <bb 9> : + # i_21 = PHI <0(5), _18(8)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.041t.mergephi1 b/TDs/TD1/CODE/4-SAXPY/main.c.041t.mergephi1 new file mode 100644 index 0000000000000000000000000000000000000000..022475d75984d16777c8a016f6eed65c699e3a38 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.041t.mergephi1 @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +Removing basic block 8 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 9>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 9> : + # i_21 = PHI <0(5), _18(7), _18(6)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.042t.dse1 b/TDs/TD1/CODE/4-SAXPY/main.c.042t.dse1 new file mode 100644 index 0000000000000000000000000000000000000000..c8c94b30fff45d35e8d31c6b50dcee9db0a2b9df --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.042t.dse1 @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 9>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 9> : + # i_21 = PHI <0(5), _18(7), _18(6)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.043t.cddce1 b/TDs/TD1/CODE/4-SAXPY/main.c.043t.cddce1 new file mode 100644 index 0000000000000000000000000000000000000000..c8c94b30fff45d35e8d31c6b50dcee9db0a2b9df --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.043t.cddce1 @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 9>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 9> : + # i_21 = PHI <0(5), _18(7), _18(6)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.044t.phiopt1 b/TDs/TD1/CODE/4-SAXPY/main.c.044t.phiopt1 new file mode 100644 index 0000000000000000000000000000000000000000..c8c94b30fff45d35e8d31c6b50dcee9db0a2b9df --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.044t.phiopt1 @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 9>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 9> : + # i_21 = PHI <0(5), _18(7), _18(6)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.046t.iftoswitch b/TDs/TD1/CODE/4-SAXPY/main.c.046t.iftoswitch new file mode 100644 index 0000000000000000000000000000000000000000..c8c94b30fff45d35e8d31c6b50dcee9db0a2b9df --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.046t.iftoswitch @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> : + goto <bb 4>; [INV] + + <bb 3> : + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> : + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> : + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [INV] + + <bb 3> : + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> : + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [INV] + else + goto <bb 5>; [INV] + + <bb 5> : + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 9>; [INV] + + <bb 6> : + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [INV] + else + goto <bb 9>; [INV] + + <bb 7> : + __builtin_putchar (10); + + <bb 9> : + # i_21 = PHI <0(5), _18(7), _18(6)> + if (i_21 <= 99) + goto <bb 6>; [INV] + else + goto <bb 10>; [INV] + + <bb 10> : + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.049t.profile_estimate b/TDs/TD1/CODE/4-SAXPY/main.c.049t.profile_estimate new file mode 100644 index 0000000000000000000000000000000000000000..4bf717b74ed0c062698b1038311c249e202fbd7c --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.049t.profile_estimate @@ -0,0 +1,208 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 1 } +Predictions for bb 2 +1 edges in bb 2 predicted to even probabilities +Predictions for bb 3 +1 edges in bb 3 predicted to even probabilities +Predictions for bb 4 + first match heuristics: 89.00% + combined heuristics: 89.00% + loop exit heuristics of edge 4->5: 11.00% +Predictions for bb 5 +1 edges in bb 5 predicted to even probabilities +cyclic probability of bb 4 is 0.890000; turning freq 1.000000 to 9.090909 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> [local count: 1073741824]: + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) + +Disambiguating loop 2 with multiple latches +Merged latch edges of loop 2 +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 9 11 10 +;; +;; Loop 2 +;; header 11, latch 9 +;; depth 1, outer 0 +;; nodes: 11 9 6 7 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 11 } +;; 6 succs { 7 9 } +;; 7 succs { 9 } +;; 9 succs { 11 } +;; 11 succs { 6 10 } +;; 10 succs { 1 } +Predictions for bb 2 +1 edges in bb 2 predicted to even probabilities +Predictions for bb 3 +1 edges in bb 3 predicted to even probabilities +Predictions for bb 4 + first match heuristics: 99.00% + combined heuristics: 99.00% + loop iterations heuristics of edge 4->5: 1.00% +Predictions for bb 5 +1 edges in bb 5 predicted to even probabilities +Predictions for bb 6 + DS theory heuristics: 33.00% + combined heuristics: 33.00% + call heuristics of edge 6->7: 33.00% +Predictions for bb 7 +1 edges in bb 7 predicted to even probabilities +Predictions for bb 9 +1 edges in bb 9 predicted to even probabilities +Predictions for bb 11 + first match heuristics: 99.00% + combined heuristics: 99.00% + call heuristics of edge 11->6 (ignored): 33.00% + loop iterations heuristics of edge 11->10: 1.00% +Predictions for bb 10 +1 edges in bb 10 predicted to even probabilities +cyclic probability of bb 4 is 0.990000; turning freq 1.000000 to 100.000021 +cyclic probability of bb 11 is 0.990000; turning freq 1.000000 to 100.000021 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> [local count: 10737416]: + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> [local count: 1073741824]: + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_23 = PHI <_18(6), _18(7)> + + <bb 11> [local count: 1073741824]: + # i_21 = PHI <i_23(9), 0(5)> + if (i_21 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.050t.local-pure-const1 b/TDs/TD1/CODE/4-SAXPY/main.c.050t.local-pure-const1 new file mode 100644 index 0000000000000000000000000000000000000000..ce60b1bd1fb9faa21068f1abbf63f574bf73e3ed --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.050t.local-pure-const1 @@ -0,0 +1,179 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + + + + local analysis of saxpy/22 + scanning: _1 = (long unsigned int) i_14; + scanning: _2 = _1 * 4; + scanning: _3 = x_19(D) + _2; + scanning: _4 = *_3; + Indirect ref read is not const + scanning: _5 = _4 * a_20(D); + scanning: _8 = y_21(D) + _2; + scanning: _9 = *_8; + Indirect ref read is not const + scanning: _12 = res_22(D) + _2; + scanning: _13 = _5 + _9; + scanning: *_12 = _13; + Indirect ref write is not const/pure + scanning: i_24 = i_14 + 1; + scanning: if (i_14 < size_18(D)) + scanning: return; +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> [local count: 1073741824]: + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + + + + local analysis of main/23 + scanning: res_29 = malloc (400); + scanning: x_31 = malloc (400); + scanning: y_33 = malloc (400); + scanning: _7 = (long unsigned int) i_20; + scanning: _8 = _7 * 4; + scanning: _9 = x_31 + _8; + scanning: _10 = i_20 + 50; + scanning: *_9 = _10; + Indirect ref to local or readonly memory is OK + scanning: _13 = y_33 + _8; + scanning: *_13 = i_20; + Indirect ref to local or readonly memory is OK + scanning: i_43 = i_20 + 1; + scanning: if (i_20 <= 99) + scanning: saxpy (res_29, x_31, y_33, 2, 100); + scanning: _14 = (long unsigned int) i_21; + scanning: _15 = _14 * 4; + scanning: _16 = res_29 + _15; + scanning: _17 = *_16; + Indirect ref to local or readonly memory is OK + scanning: printf ("res[%d] = %d ; ", i_21, _17); + scanning: _18 = i_21 + 1; + scanning: _19 = _18 % 10; + scanning: if (_19 == 0) + scanning: __builtin_putchar (10); + scanning: if (i_21 <= 99) + scanning: return 1; +Function is locally looping. +Function can locally free. +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> [local count: 10737416]: + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> [local count: 1073741824]: + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_23 = PHI <_18(6), _18(7)> + + <bb 11> [local count: 1073741824]: + # i_21 = PHI <i_23(9), 0(5)> + if (i_21 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.051t.modref1 b/TDs/TD1/CODE/4-SAXPY/main.c.051t.modref1 new file mode 100644 index 0000000000000000000000000000000000000000..4c566001255464f3f7d9281920b16c54d447df3d --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.051t.modref1 @@ -0,0 +1,251 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + + + +modref analyzing 'saxpy/22' (ipa=0) +Analyzing flags of ssa name: res_22(D) + Analyzing stmt: _12 = res_22(D) + _2; + Analyzing flags of ssa name: _12 + Analyzing stmt: *_12 = _13; + current flags of _12 no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + flags of ssa name _12 no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + current flags of res_22(D) no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read +flags of ssa name res_22(D) no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read +Analyzing flags of ssa name: x_19(D) + Analyzing stmt: _3 = x_19(D) + _2; + Analyzing flags of ssa name: _3 + Analyzing stmt: _4 = *_3; + Analyzing flags of ssa name: _4 + Analyzing stmt: _5 = _4 * a_20(D); + Analyzing flags of ssa name: _5 + Analyzing stmt: _13 = _5 + _9; + Analyzing flags of ssa name: _13 + Analyzing stmt: *_12 = _13; + ssa name saved to memory + current flags of _13 + flags of ssa name _13 + current flags of _5 + flags of ssa name _5 + current flags of _4 + flags of ssa name _4 + current flags of _3 no_direct_clobber no_direct_escape not_returned_directly + flags of ssa name _3 no_direct_clobber no_direct_escape not_returned_directly + current flags of x_19(D) no_direct_clobber no_direct_escape not_returned_directly +flags of ssa name x_19(D) no_direct_clobber no_direct_escape not_returned_directly +Analyzing flags of ssa name: y_21(D) + Analyzing stmt: _8 = y_21(D) + _2; + Analyzing flags of ssa name: _8 + Analyzing stmt: _9 = *_8; + Analyzing flags of ssa name: _9 + Analyzing stmt: _13 = _5 + _9; + current flags of _9 + flags of ssa name _9 + current flags of _8 no_direct_clobber no_direct_escape not_returned_directly + flags of ssa name _8 no_direct_clobber no_direct_escape not_returned_directly + current flags of y_21(D) no_direct_clobber no_direct_escape not_returned_directly +flags of ssa name y_21(D) no_direct_clobber no_direct_escape not_returned_directly +Analyzing flags of ssa name: a_20(D) + Analyzing stmt: _5 = _4 * a_20(D); + current flags of a_20(D) +flags of ssa name a_20(D) +Analyzing flags of ssa name: size_18(D) + Analyzing stmt: if (i_14 < size_18(D)) + current flags of size_18(D) no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read +flags of ssa name size_18(D) no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + - Analyzing load: *_3 + - Recording base_set=0 ref_set=0 Parm 1 + - Analyzing load: *_8 + - Recording base_set=0 ref_set=0 Parm 2 + - Analyzing store: *_12 + - Recording base_set=0 ref_set=0 Parm 0 +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 1 } + - modref done with result: tracked. + loads: + Base 0: alias set 0 + Ref 0: alias set 0 + access: Parm 1 + access: Parm 2 + stores: + Base 0: alias set 0 + Ref 0: alias set 0 + access: Parm 0 + parm 0 flags: no_indirect_clobber no_direct_escape no_indirect_escape no_direct_read no_indirect_read + parm 1 flags: no_direct_clobber no_direct_escape + parm 2 flags: no_direct_clobber no_direct_escape + parm 4 flags: no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape no_direct_read no_indirect_read +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _8; + int _9; + int * _12; + int _13; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_14; + _2 = _1 * 4; + _3 = x_19(D) + _2; + _4 = *_3; + _5 = _4 * a_20(D); + _8 = y_21(D) + _2; + _9 = *_8; + _12 = res_22(D) + _2; + _13 = _5 + _9; + *_12 = _13; + i_24 = i_14 + 1; + + <bb 4> [local count: 1073741824]: + # i_14 = PHI <0(2), i_24(3)> + if (i_14 < size_18(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + + + +modref analyzing 'main/23' (ipa=0) + - Analyzing call:res_29 = malloc (400); + - Function availability <= AVAIL_INTERPOSABLE. + - Analyzing call:x_31 = malloc (400); + - Function availability <= AVAIL_INTERPOSABLE. + - Analyzing call:y_33 = malloc (400); + - Function availability <= AVAIL_INTERPOSABLE. + - Analyzing store: *_9 + - Read-only or local, ignoring. + - Analyzing store: *_13 + - Read-only or local, ignoring. + - Analyzing call:saxpy (res_29, x_31, y_33, 2, 100); + - Merging side effects of saxpy/22 + Parm map: -5 -5 -5 -1 -1 + - Analyzing load: *_16 + - Read-only or local, ignoring. + - Analyzing call:printf ("res[%d] = %d ; ", i_21, _17); + - Function availability <= AVAIL_INTERPOSABLE. + Builtin with no fnspec: printf + - Analyzing call:__builtin_putchar (10); + - Function availability <= AVAIL_INTERPOSABLE. + Builtin with no fnspec: __builtin_putchar + - modref done with result: tracked. + loads: + Every base + stores: + Every base + Writes errno + Side effects + Nondeterministic + Global memory read + Global memory written + parm 0 flags: unused + parm 1 flags: unused +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int a; + int * y; + int * x; + int * res; + int size; + int i; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int * _13; + long unsigned int _14; + long unsigned int _15; + int * _16; + int _17; + int _18; + int _19; + + <bb 2> [local count: 10737416]: + res_29 = malloc (400); + x_31 = malloc (400); + y_33 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _7 = (long unsigned int) i_20; + _8 = _7 * 4; + _9 = x_31 + _8; + _10 = i_20 + 50; + *_9 = _10; + _13 = y_33 + _8; + *_13 = i_20; + i_43 = i_20 + 1; + + <bb 4> [local count: 1073741824]: + # i_20 = PHI <0(2), i_43(3)> + if (i_20 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_29, x_31, y_33, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _14 = (long unsigned int) i_21; + _15 = _14 * 4; + _16 = res_29 + _15; + _17 = *_16; + printf ("res[%d] = %d ; ", i_21, _17); + _18 = i_21 + 1; + _19 = _18 % 10; + if (_19 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_23 = PHI <_18(6), _18(7)> + + <bb 11> [local count: 1073741824]: + # i_21 = PHI <i_23(9), 0(5)> + if (i_21 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.053t.release_ssa b/TDs/TD1/CODE/4-SAXPY/main.c.053t.release_ssa new file mode 100644 index 0000000000000000000000000000000000000000..cfba55f877292384772c8ead8348836cd2d2a478 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.053t.release_ssa @@ -0,0 +1,128 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Released 5 names, 25.00%, removed 5 holes +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Released 13 names, 41.94%, removed 13 holes +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.054t.local-fnsummary2 b/TDs/TD1/CODE/4-SAXPY/main.c.054t.local-fnsummary2 new file mode 100644 index 0000000000000000000000000000000000000000..4875f75782b7bc8aa108f1415c6c4bdcb9a2e722 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.054t.local-fnsummary2 @@ -0,0 +1,176 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + + +Analyzing function body size: saxpy/22 + +IPA function summary for saxpy/22 inlinable + global time: 101.090910 + self size: 15 + global size: 17 + min size: 0 + self stack: 0 + global stack: 0 + size:12.000000, time:99.090910 + size:3.000000, time:2.000000, executed if:(not inlined) + calls: + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + + +Analyzing function body size: main/23 + +IPA function summary for main/23 inlinable + global time: 3485.370743 + self size: 42 + global size: 44 + min size: 0 + self stack: 0 + global stack: 0 + size:18.000000, time:1786.000378 + size:3.000000, time:2.000000, executed if:(not inlined) + calls: + __builtin_putchar/26 function body not available + freq:32.67 loop depth: 1 size: 2 time: 11 + op0 is compile time invariant + printf/25 function body not available + freq:99.00 loop depth: 1 size: 4 time: 13 + op0 is compile time invariant + saxpy/22 function not considered for inlining + freq:1.00 loop depth: 0 size: 6 time: 15 callee size: 7 stack: 0 + op0 points to local or readonly memory + op1 points to local or readonly memory + op2 points to local or readonly memory + op3 is compile time invariant + op4 is compile time invariant + malloc/24 function body not available + freq:1.00 loop depth: 0 size: 3 time: 12 + op0 is compile time invariant + malloc/24 function body not available + freq:1.00 loop depth: 0 size: 3 time: 12 + op0 is compile time invariant + malloc/24 function body not available + freq:1.00 loop depth: 0 size: 3 time: 12 + op0 is compile time invariant + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.094t.fixup_cfg3 b/TDs/TD1/CODE/4-SAXPY/main.c.094t.fixup_cfg3 new file mode 100644 index 0000000000000000000000000000000000000000..51661136b120c72adcfc66cda56fe191688d9164 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.094t.fixup_cfg3 @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.101t.adjust_alignment b/TDs/TD1/CODE/4-SAXPY/main.c.101t.adjust_alignment new file mode 100644 index 0000000000000000000000000000000000000000..51661136b120c72adcfc66cda56fe191688d9164 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.101t.adjust_alignment @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.102t.ccp2 b/TDs/TD1/CODE/4-SAXPY/main.c.102t.ccp2 new file mode 100644 index 0000000000000000000000000000000000000000..51661136b120c72adcfc66cda56fe191688d9164 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.102t.ccp2 @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.103t.objsz1 b/TDs/TD1/CODE/4-SAXPY/main.c.103t.objsz1 new file mode 100644 index 0000000000000000000000000000000000000000..51661136b120c72adcfc66cda56fe191688d9164 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.103t.objsz1 @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.105t.waccess2 b/TDs/TD1/CODE/4-SAXPY/main.c.105t.waccess2 new file mode 100644 index 0000000000000000000000000000000000000000..39e4d66e9e7eafc4a6bc33647ddf792981517d64 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.105t.waccess2 @@ -0,0 +1,144 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +pointer_query counters: + index cache size: 0 + index entries: 0 + access cache size: 0 + access entries: 0 + hits: 0 + misses: 2 + failures: 0 + max_depth: 1 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +pointer_query counters: + index cache size: 0 + index entries: 0 + access cache size: 0 + access entries: 0 + hits: 0 + misses: 4 + failures: 0 + max_depth: 1 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.107t.backprop b/TDs/TD1/CODE/4-SAXPY/main.c.107t.backprop new file mode 100644 index 0000000000000000000000000000000000000000..51661136b120c72adcfc66cda56fe191688d9164 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.107t.backprop @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.108t.phiprop b/TDs/TD1/CODE/4-SAXPY/main.c.108t.phiprop new file mode 100644 index 0000000000000000000000000000000000000000..51661136b120c72adcfc66cda56fe191688d9164 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.108t.phiprop @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + # i_16 = PHI <_11(6), _11(7)> + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <i_16(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.109t.forwprop2 b/TDs/TD1/CODE/4-SAXPY/main.c.109t.forwprop2 new file mode 100644 index 0000000000000000000000000000000000000000..0470e4958a11fd480fadea809ebfaa4c262a3a7b --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.109t.forwprop2 @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.110t.alias b/TDs/TD1/CODE/4-SAXPY/main.c.110t.alias new file mode 100644 index 0000000000000000000000000000000000000000..270fbeaf618e8348525bee4e59e11f6b6a6d9bcf --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.110t.alias @@ -0,0 +1,439 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Points-to analysis + +Constraints: + +ANYTHING = &ANYTHING +ESCAPED = *ESCAPED +ESCAPED = ESCAPED + UNKNOWN +*ESCAPED = NONLOCAL +NONLOCAL = &NONLOCAL +NONLOCAL = &ESCAPED +INTEGER = &ANYTHING +res = &NONLOCAL +x = &NONLOCAL +y = &NONLOCAL +a = &NONLOCAL +size = &NONLOCAL +_1 = i_10 +_2 = _1 +_2 = &NONLOCAL +_3 = x +_4 = *_3 +_5 = _4 +_5 = a +_6 = y +_7 = *_6 +_8 = res +_9 = _5 +_9 = _7 +*_8 = _9 +i_19 = i_10 +i_19 = &NONLOCAL +i_10 = &NULL +i_10 = i_19 + +Collapsing static cycles and doing variable substitution +Building predecessor graph +Detecting pointer and location equivalences +Rewriting constraints and unifying variables +Uniting pointer but not location equivalent variables +Finding indirect cycles +Solving graph + +Points-to sets + +ANYTHING = { ANYTHING } +ESCAPED = { ESCAPED NONLOCAL } +NONLOCAL = { ESCAPED NONLOCAL } same as _4 +STOREDANYTHING = { } +INTEGER = { ANYTHING } +res = { NONLOCAL } +x = { NONLOCAL } same as res +y = { NONLOCAL } same as res +a = { NONLOCAL } same as res +size = { NONLOCAL } same as res +_1 = { NULL NONLOCAL } +i_10 = { NULL NONLOCAL } same as _1 +_2 = { NULL NONLOCAL } same as _1 +_3 = { NONLOCAL } same as res +_4 = { ESCAPED NONLOCAL } +_5 = { ESCAPED NONLOCAL } same as _4 +_6 = { NONLOCAL } same as res +_7 = { ESCAPED NONLOCAL } same as _4 +_8 = { NONLOCAL } same as res +_9 = { ESCAPED NONLOCAL } same as _4 +i_19 = { NULL NONLOCAL } same as _1 + + +Alias information for saxpy + +Aliased symbols + + +Call clobber information + +ESCAPED, points-to non-local, points-to vars: { } + +Flow-insensitive points-to information + +_3, points-to non-local, points-to NULL, points-to vars: { } +_6, points-to non-local, points-to NULL, points-to vars: { } +_8, points-to non-local, points-to NULL, points-to vars: { } +x_14(D), points-to non-local, points-to NULL, points-to vars: { } +y_16(D), points-to non-local, points-to NULL, points-to vars: { } +res_17(D), points-to non-local, points-to NULL, points-to vars: { } + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Points-to analysis + +Constraints: + +ANYTHING = &ANYTHING +ESCAPED = *ESCAPED +ESCAPED = ESCAPED + UNKNOWN +*ESCAPED = NONLOCAL +NONLOCAL = &NONLOCAL +NONLOCAL = &ESCAPED +INTEGER = &ANYTHING +argc = &NONLOCAL +argv = &NONLOCAL +callescape(11) = &NONLOCAL +CALLUSED(12) = callescape(11) +callarg(14) = &NONLOCAL +callarg(14) = callarg(14) + UNKNOWN +callarg(14) = *callarg(14) + UNKNOWN +CALLUSED(12) = callarg(14) +*callarg(14) = callescape(11) +CALLCLOBBERED(13) = callarg(14) +callescape(11) = callarg(14) +res_20 = &HEAP(16) +callescape(17) = &NONLOCAL +CALLUSED(18) = callescape(17) +callarg(20) = &NONLOCAL +callarg(20) = callarg(20) + UNKNOWN +callarg(20) = *callarg(20) + UNKNOWN +CALLUSED(18) = callarg(20) +*callarg(20) = callescape(17) +CALLCLOBBERED(19) = callarg(20) +callescape(17) = callarg(20) +x_22 = &HEAP(22) +callescape(23) = &NONLOCAL +CALLUSED(24) = callescape(23) +callarg(26) = &NONLOCAL +callarg(26) = callarg(26) + UNKNOWN +callarg(26) = *callarg(26) + UNKNOWN +CALLUSED(24) = callarg(26) +*callarg(26) = callescape(23) +CALLCLOBBERED(25) = callarg(26) +callescape(23) = callarg(26) +y_24 = &HEAP(28) +_1 = i_13 +_2 = _1 +_2 = &NONLOCAL +_3 = x_22 +_4 = i_13 +_4 = &NONLOCAL +*_3 = _4 +_6 = y_24 +*_6 = i_13 +i_30 = i_13 +i_30 = &NONLOCAL +i_13 = &NULL +i_13 = i_30 +callescape(37) = &NONLOCAL +CALLUSED(38) = callescape(37) +callarg(40) = res_20 +callarg(40) = callarg(40) + UNKNOWN +*callarg(40) = callescape(37) +CALLCLOBBERED(39) = callarg(40) +callarg(41) = x_22 +callarg(41) = callarg(41) + UNKNOWN +indircallarg(42) = *callarg(41) + UNKNOWN +indircallarg(42) = indircallarg(42) + UNKNOWN +indircallarg(42) = *indircallarg(42) + UNKNOWN +CALLUSED(38) = callarg(41) +CALLUSED(38) = indircallarg(42) +*indircallarg(42) = callescape(37) +CALLCLOBBERED(39) = indircallarg(42) +callescape(37) = indircallarg(42) +callarg(43) = y_24 +callarg(43) = callarg(43) + UNKNOWN +indircallarg(44) = *callarg(43) + UNKNOWN +indircallarg(44) = indircallarg(44) + UNKNOWN +indircallarg(44) = *indircallarg(44) + UNKNOWN +CALLUSED(38) = callarg(43) +CALLUSED(38) = indircallarg(44) +*indircallarg(44) = callescape(37) +CALLCLOBBERED(39) = indircallarg(44) +callescape(37) = indircallarg(44) +callarg(45) = &NONLOCAL +callarg(45) = callarg(45) + UNKNOWN +callarg(45) = *callarg(45) + UNKNOWN +CALLUSED(38) = callarg(45) +*callarg(45) = callescape(37) +CALLCLOBBERED(39) = callarg(45) +callescape(37) = callarg(45) +_7 = i_14 +_8 = _7 +_8 = &NONLOCAL +_9 = res_20 +_10 = *_9 +callescape(52) = NONLOCAL +CALLUSED(53) = callescape(52) +callarg(55) = &STRING +callarg(55) = callarg(55) + UNKNOWN +callarg(55) = *callarg(55) + UNKNOWN +CALLUSED(53) = callarg(55) +*callarg(55) = callescape(52) +CALLCLOBBERED(54) = callarg(55) +callescape(52) = callarg(55) +ESCAPED = &STRING +callarg(56) = i_14 +callarg(56) = callarg(56) + UNKNOWN +callarg(56) = *callarg(56) + UNKNOWN +CALLUSED(53) = callarg(56) +*callarg(56) = callescape(52) +CALLCLOBBERED(54) = callarg(56) +callescape(52) = callarg(56) +ESCAPED = i_14 +callarg(57) = _10 +callarg(57) = callarg(57) + UNKNOWN +callarg(57) = *callarg(57) + UNKNOWN +CALLUSED(53) = callarg(57) +*callarg(57) = callescape(52) +CALLCLOBBERED(54) = callarg(57) +callescape(52) = callarg(57) +ESCAPED = _10 +_11 = i_14 +_11 = &NONLOCAL +_12 = _11 +callescape(61) = NONLOCAL +CALLUSED(62) = callescape(61) +callarg(64) = &NONLOCAL +callarg(64) = callarg(64) + UNKNOWN +callarg(64) = *callarg(64) + UNKNOWN +CALLUSED(62) = callarg(64) +*callarg(64) = callescape(61) +CALLCLOBBERED(63) = callarg(64) +callescape(61) = callarg(64) +ESCAPED = &NONLOCAL +i_14 = _11 +i_14 = &NULL + +Collapsing static cycles and doing variable substitution +Building predecessor graph +Detecting pointer and location equivalences +Rewriting constraints and unifying variables +Uniting pointer but not location equivalent variables +Finding indirect cycles +Solving graph + +Points-to sets + +ANYTHING = { ANYTHING } +ESCAPED = { NULL STRING ESCAPED NONLOCAL } +NONLOCAL = { ESCAPED NONLOCAL } +STOREDANYTHING = { } +INTEGER = { ANYTHING } +HEAP(16) = { NULL ESCAPED NONLOCAL } +HEAP(22) = { NULL NONLOCAL } +HEAP(28) = { NULL NONLOCAL } +argc = { NONLOCAL } +argv = { NONLOCAL } same as argc +malloc = { } +callescape(11) = { ESCAPED NONLOCAL } +CALLUSED(12) = { ESCAPED NONLOCAL } same as callescape(11) +CALLCLOBBERED(13) = { ESCAPED NONLOCAL } same as callescape(11) +callarg(14) = { ESCAPED NONLOCAL } same as callescape(11) +res_20 = { HEAP(16) } +callescape(17) = { ESCAPED NONLOCAL } +CALLUSED(18) = { ESCAPED NONLOCAL } same as callescape(17) +CALLCLOBBERED(19) = { ESCAPED NONLOCAL } same as callescape(17) +callarg(20) = { ESCAPED NONLOCAL } same as callescape(17) +x_22 = { HEAP(22) } +callescape(23) = { ESCAPED NONLOCAL } +CALLUSED(24) = { ESCAPED NONLOCAL } same as callescape(23) +CALLCLOBBERED(25) = { ESCAPED NONLOCAL } same as callescape(23) +callarg(26) = { ESCAPED NONLOCAL } same as callescape(23) +y_24 = { HEAP(28) } +_1 = { NULL NONLOCAL } +i_13 = { NULL NONLOCAL } same as _1 +_2 = { NULL NONLOCAL } same as _1 +_3 = { HEAP(22) } same as x_22 +_4 = { NULL NONLOCAL } same as _1 +_6 = { HEAP(28) } same as y_24 +i_30 = { NULL NONLOCAL } same as _1 +saxpy = { } +callescape(37) = { NULL ESCAPED NONLOCAL } +CALLUSED(38) = { NULL ESCAPED NONLOCAL HEAP(22) HEAP(28) } +CALLCLOBBERED(39) = { NULL ESCAPED NONLOCAL HEAP(16) } +callarg(40) = { HEAP(16) } +callarg(41) = { HEAP(22) } +indircallarg(42) = { NULL ESCAPED NONLOCAL } +callarg(43) = { HEAP(28) } +indircallarg(44) = { NULL ESCAPED NONLOCAL } +callarg(45) = { ESCAPED NONLOCAL } +_7 = { NULL NONLOCAL } same as _1 +i_14 = { NULL NONLOCAL } same as _1 +_8 = { NULL NONLOCAL } same as _1 +_9 = { HEAP(16) } same as res_20 +_10 = { NULL ESCAPED NONLOCAL } +printf = { } +callescape(52) = { NULL STRING ESCAPED NONLOCAL } +CALLUSED(53) = { NULL STRING ESCAPED NONLOCAL } same as callescape(52) +CALLCLOBBERED(54) = { NULL STRING ESCAPED NONLOCAL } +callarg(55) = { STRING } +callarg(56) = { NULL ESCAPED NONLOCAL } +callarg(57) = { NULL ESCAPED NONLOCAL } +_11 = { NULL NONLOCAL } same as _1 +_12 = { NULL NONLOCAL } same as _1 +putchar = { } +callescape(61) = { ESCAPED NONLOCAL } +CALLUSED(62) = { ESCAPED NONLOCAL } same as callescape(61) +CALLCLOBBERED(63) = { ESCAPED NONLOCAL } same as callarg(64) +callarg(64) = { ESCAPED NONLOCAL } +main = { } + + +Alias information for main + +Aliased symbols + + +Call clobber information + +ESCAPED, points-to non-local, points-to NULL, points-to vars: { } + +Flow-insensitive points-to information + +_3, points-to NULL, points-to vars: { D.3016 } +_6, points-to NULL, points-to vars: { D.3017 } +_9, points-to NULL, points-to vars: { D.3015 } +res_20, points-to NULL, points-to vars: { D.3015 } +x_22, points-to NULL, points-to vars: { D.3016 } +y_24, points-to NULL, points-to vars: { D.3017 } + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.111t.retslot b/TDs/TD1/CODE/4-SAXPY/main.c.111t.retslot new file mode 100644 index 0000000000000000000000000000000000000000..0470e4958a11fd480fadea809ebfaa4c262a3a7b --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.111t.retslot @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.112t.fre3 b/TDs/TD1/CODE/4-SAXPY/main.c.112t.fre3 new file mode 100644 index 0000000000000000000000000000000000000000..0470e4958a11fd480fadea809ebfaa4c262a3a7b --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.112t.fre3 @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1063004409]: + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(9), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.113t.mergephi2 b/TDs/TD1/CODE/4-SAXPY/main.c.113t.mergephi2 new file mode 100644 index 0000000000000000000000000000000000000000..ea2597e4503a084d12f64274b05745142d502b8a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.113t.mergephi2 @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Removing basic block 9 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(7), 0(5), _11(6)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.116t.dse2 b/TDs/TD1/CODE/4-SAXPY/main.c.116t.dse2 new file mode 100644 index 0000000000000000000000000000000000000000..a9b93480e8b5548d94c5a492a66cb56c0dde861a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.116t.dse2 @@ -0,0 +1,123 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(7), 0(5), _11(6)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.117t.dce2 b/TDs/TD1/CODE/4-SAXPY/main.c.117t.dce2 new file mode 100644 index 0000000000000000000000000000000000000000..a9b93480e8b5548d94c5a492a66cb56c0dde861a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.117t.dce2 @@ -0,0 +1,123 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(7), 0(5), _11(6)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.118t.stdarg b/TDs/TD1/CODE/4-SAXPY/main.c.118t.stdarg new file mode 100644 index 0000000000000000000000000000000000000000..a9b93480e8b5548d94c5a492a66cb56c0dde861a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.118t.stdarg @@ -0,0 +1,123 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(7), 0(5), _11(6)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.119t.cdce b/TDs/TD1/CODE/4-SAXPY/main.c.119t.cdce new file mode 100644 index 0000000000000000000000000000000000000000..a9b93480e8b5548d94c5a492a66cb56c0dde861a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.119t.cdce @@ -0,0 +1,123 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 11>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 11> [local count: 1073741824]: + # i_14 = PHI <_11(7), 0(5), _11(6)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.120t.cselim b/TDs/TD1/CODE/4-SAXPY/main.c.120t.cselim new file mode 100644 index 0000000000000000000000000000000000000000..4f4c6922b1d65cbbf8a99f1223e8e38756021a2d --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.120t.cselim @@ -0,0 +1,168 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Disambiguating loop 2 with multiple latches +Merged latch edges of loop 2 +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 11 12 10 +;; +;; Loop 2 +;; header 12, latch 11 +;; depth 1, outer 0 +;; nodes: 12 11 7 6 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 12 } +;; 6 succs { 7 11 } +;; 7 succs { 11 } +;; 11 succs { 12 } +;; 12 succs { 6 10 } +;; 10 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 12>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 11> [local count: 1063004409]: + # i_5 = PHI <_11(7), _11(6)> + + <bb 12> [local count: 1073741824]: + # i_14 = PHI <i_5(11), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.121t.copyprop1 b/TDs/TD1/CODE/4-SAXPY/main.c.121t.copyprop1 new file mode 100644 index 0000000000000000000000000000000000000000..884342b71e081c6c770f54aec863a12beecbcc56 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.121t.copyprop1 @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 9>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 8>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 8> [local count: 1063004409]: + + <bb 9> [local count: 1073741824]: + # i_14 = PHI <_11(8), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.122t.ifcombine b/TDs/TD1/CODE/4-SAXPY/main.c.122t.ifcombine new file mode 100644 index 0000000000000000000000000000000000000000..884342b71e081c6c770f54aec863a12beecbcc56 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.122t.ifcombine @@ -0,0 +1,125 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 9>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 8>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 8> [local count: 1063004409]: + + <bb 9> [local count: 1073741824]: + # i_14 = PHI <_11(8), 0(5)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.123t.mergephi3 b/TDs/TD1/CODE/4-SAXPY/main.c.123t.mergephi3 new file mode 100644 index 0000000000000000000000000000000000000000..d724355ad606a3d34d0c569fb05b9f920f418262 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.123t.mergephi3 @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Removing basic block 8 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 9>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1073741824]: + # i_14 = PHI <_11(6), 0(5), _11(7)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.124t.phiopt2 b/TDs/TD1/CODE/4-SAXPY/main.c.124t.phiopt2 new file mode 100644 index 0000000000000000000000000000000000000000..76bba8f71b2f27cd88efde6d81b0c14234d3adbb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.124t.phiopt2 @@ -0,0 +1,123 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + goto <bb 4>; [100.00%] + + <bb 3> [local count: 955630225]: + _1 = (long unsigned int) i_10; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_10 + 1; + + <bb 4> [local count: 1073741824]: + # i_10 = PHI <0(2), i_19(3)> + if (i_10 < size_13(D)) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + goto <bb 4>; [100.00%] + + <bb 3> [local count: 1063004409]: + _1 = (long unsigned int) i_13; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_13 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_13; + i_30 = i_13 + 1; + + <bb 4> [local count: 1073741824]: + # i_13 = PHI <0(2), i_30(3)> + if (i_13 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 5>; [1.00%] + + <bb 5> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + goto <bb 9>; [100.00%] + + <bb 6> [local count: 1063004409]: + _7 = (long unsigned int) i_14; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_14, _10); + _11 = i_14 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 7>; [33.00%] + else + goto <bb 9>; [67.00%] + + <bb 7> [local count: 350791453]: + __builtin_putchar (10); + + <bb 9> [local count: 1073741824]: + # i_14 = PHI <_11(6), 0(5), _11(7)> + if (i_14 <= 99) + goto <bb 6>; [99.00%] + else + goto <bb 10>; [1.00%] + + <bb 10> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.126t.ch2 b/TDs/TD1/CODE/4-SAXPY/main.c.126t.ch2 new file mode 100644 index 0000000000000000000000000000000000000000..a8c4453e4cbd008d35931c75ceeada0731bf296e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.126t.ch2 @@ -0,0 +1,208 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 1 } + +SSA replacement table +N_i -> { O_1 ... O_j } means that N_i replaces O_1, ..., O_j + +i_20 -> { i_10 } +.MEM_21 -> { .MEM_11 } +i_22 -> { i_10 } +.MEM_23 -> { .MEM_11 } +.MEM_24 -> { .MEM_11 } +Incremental SSA update started at block: 6 +Number of blocks in CFG: 9 +Number of blocks to update: 6 ( 67%) + + +Merging blocks 2 and 6 +Merging blocks 3 and 4 +Removing basic block 7 +Removing basic block 8 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Disambiguating loop 2 with multiple latches +Merged latch edges of loop 2 +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 9 11 10 +;; +;; Loop 2 +;; header 11, latch 9 +;; depth 1, outer 0 +;; nodes: 11 9 6 7 +;; +;; Loop 1 +;; header 4, latch 3 +;; depth 1, outer 0 +;; nodes: 4 3 +;; 2 succs { 4 } +;; 3 succs { 4 } +;; 4 succs { 3 5 } +;; 5 succs { 11 } +;; 6 succs { 7 9 } +;; 7 succs { 9 } +;; 9 succs { 11 } +;; 11 succs { 6 10 } +;; 10 succs { 1 } + +SSA replacement table +N_i -> { O_1 ... O_j } means that N_i replaces O_1, ..., O_j + +i_31 -> { i_14 } +.MEM_32 -> { .MEM_17 } +i_33 -> { i_13 } +.MEM_34 -> { .MEM_15 } +i_35 -> { i_13 } +i_36 -> { i_14 } +.MEM_37 -> { .MEM_15 } +.MEM_38 -> { .MEM_15 } +.MEM_39 -> { .MEM_17 } +.MEM_40 -> { .MEM_17 } +Incremental SSA update started at block: 15 +Number of blocks in CFG: 18 +Number of blocks to update: 12 ( 67%) + + +Merging blocks 2 and 15 +Merging blocks 3 and 4 +Merging blocks 5 and 12 +Merging blocks 9 and 11 +Removing basic block 13 +Removing basic block 14 +Removing basic block 16 +Removing basic block 17 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <i_16(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + # i_16 = PHI <_11(5), _11(6)> + if (i_16 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.127t.cplxlower1 b/TDs/TD1/CODE/4-SAXPY/main.c.127t.cplxlower1 new file mode 100644 index 0000000000000000000000000000000000000000..2c53369558caa3599f1af7b88b17864e1d4f3339 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.127t.cplxlower1 @@ -0,0 +1,121 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <i_16(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + # i_16 = PHI <_11(5), _11(6)> + if (i_16 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.128t.sra b/TDs/TD1/CODE/4-SAXPY/main.c.128t.sra new file mode 100644 index 0000000000000000000000000000000000000000..2c53369558caa3599f1af7b88b17864e1d4f3339 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.128t.sra @@ -0,0 +1,121 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <i_16(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + # i_16 = PHI <_11(5), _11(6)> + if (i_16 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.130t.dom2 b/TDs/TD1/CODE/4-SAXPY/main.c.130t.dom2 new file mode 100644 index 0000000000000000000000000000000000000000..948f55182701511f1cc74ea1e72aa02151c09560 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.130t.dom2 @@ -0,0 +1,167 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Created preheader block for loop 1 +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 5 3 6 4 +;; +;; Loop 1 +;; header 3, latch 6 +;; depth 1, outer 0 +;; nodes: 3 6 +;; 2 succs { 5 4 } +;; 5 succs { 3 } +;; 3 succs { 6 4 } +;; 6 succs { 3 } +;; 4 succs { 1 } +Removing basic block 5 +Removing basic block 6 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +Removing basic block 9 +Removing basic block 10 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + # i_16 = PHI <_11(5), _11(6)> + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.131t.copyprop2 b/TDs/TD1/CODE/4-SAXPY/main.c.131t.copyprop2 new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.131t.copyprop2 @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.133t.reassoc1 b/TDs/TD1/CODE/4-SAXPY/main.c.133t.reassoc1 new file mode 100644 index 0000000000000000000000000000000000000000..8759b57db1edee43df8f0cceb5c58f3afff85dd3 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.133t.reassoc1 @@ -0,0 +1,157 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 +;; +;; Loop 1 +;; header 3, latch 3 +;; depth 1, outer 0 +;; nodes: 3 +;; 2 succs { 3 4 } +;; 3 succs { 3 4 } +;; 4 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 8 +;; +;; Loop 2 +;; header 5, latch 7 +;; depth 1, outer 0 +;; nodes: 5 7 6 +;; +;; Loop 1 +;; header 3, latch 3 +;; depth 1, outer 0 +;; nodes: 3 +;; 2 succs { 3 } +;; 3 succs { 3 4 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 5 8 } +;; 8 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.134t.dce3 b/TDs/TD1/CODE/4-SAXPY/main.c.134t.dce3 new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.134t.dce3 @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.135t.forwprop3 b/TDs/TD1/CODE/4-SAXPY/main.c.135t.forwprop3 new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.135t.forwprop3 @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.136t.phiopt3 b/TDs/TD1/CODE/4-SAXPY/main.c.136t.phiopt3 new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.136t.phiopt3 @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.137t.ccp3 b/TDs/TD1/CODE/4-SAXPY/main.c.137t.ccp3 new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.137t.ccp3 @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.138t.sincos b/TDs/TD1/CODE/4-SAXPY/main.c.138t.sincos new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.138t.sincos @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.140t.laddress b/TDs/TD1/CODE/4-SAXPY/main.c.140t.laddress new file mode 100644 index 0000000000000000000000000000000000000000..a1a482da7b13ead736f02c1c2a49460d0ed1e57e --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.140t.laddress @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(3), 0(2)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 3>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(3), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.141t.lim2 b/TDs/TD1/CODE/4-SAXPY/main.c.141t.lim2 new file mode 100644 index 0000000000000000000000000000000000000000..72db2b902729fe9d654303268389cb40a9abe3c0 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.141t.lim2 @@ -0,0 +1,173 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Created preheader block for loop 1 +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 5 3 6 4 +;; +;; Loop 1 +;; header 3, latch 6 +;; depth 1, outer 0 +;; nodes: 3 6 +;; 2 succs { 5 4 } +;; 5 succs { 3 } +;; 3 succs { 6 4 } +;; 6 succs { 3 } +;; 4 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.142t.walloca2 b/TDs/TD1/CODE/4-SAXPY/main.c.142t.walloca2 new file mode 100644 index 0000000000000000000000000000000000000000..f06776607c01672b227ca19dcf4118afe3bcff15 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.142t.walloca2 @@ -0,0 +1,131 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 4>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.144t.sink1 b/TDs/TD1/CODE/4-SAXPY/main.c.144t.sink1 new file mode 100644 index 0000000000000000000000000000000000000000..7dbdc6a3fe320c4151db2fa0b574cc8ba1697beb --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.144t.sink1 @@ -0,0 +1,180 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 5 3 6 4 +;; +;; Loop 1 +;; header 3, latch 6 +;; depth 1, outer 0 +;; nodes: 3 6 +;; 2 succs { 5 4 } +;; 5 succs { 3 } +;; 3 succs { 6 4 } +;; 6 succs { 3 } +;; 4 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.148t.dse3 b/TDs/TD1/CODE/4-SAXPY/main.c.148t.dse3 new file mode 100644 index 0000000000000000000000000000000000000000..b7edc181fdca7edeb717cb41e74d0b15f092f951 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.148t.dse3 @@ -0,0 +1,139 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.149t.dce4 b/TDs/TD1/CODE/4-SAXPY/main.c.149t.dce4 new file mode 100644 index 0000000000000000000000000000000000000000..b7edc181fdca7edeb717cb41e74d0b15f092f951 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.149t.dce4 @@ -0,0 +1,139 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.150t.fix_loops b/TDs/TD1/CODE/4-SAXPY/main.c.150t.fix_loops new file mode 100644 index 0000000000000000000000000000000000000000..b7edc181fdca7edeb717cb41e74d0b15f092f951 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.150t.fix_loops @@ -0,0 +1,139 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.151t.loop b/TDs/TD1/CODE/4-SAXPY/main.c.151t.loop new file mode 100644 index 0000000000000000000000000000000000000000..b7edc181fdca7edeb717cb41e74d0b15f092f951 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.151t.loop @@ -0,0 +1,139 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.152t.loopinit b/TDs/TD1/CODE/4-SAXPY/main.c.152t.loopinit new file mode 100644 index 0000000000000000000000000000000000000000..999ccd349369f3058f14bd10b55dfd61ded315aa --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.152t.loopinit @@ -0,0 +1,183 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 5 3 8 6 7 4 +;; +;; Loop 1 +;; header 3, latch 6 +;; depth 1, outer 0 +;; nodes: 3 6 +;; 2 succs { 5 7 } +;; 5 succs { 3 } +;; 3 succs { 6 8 } +;; 8 succs { 4 } +;; 6 succs { 3 } +;; 7 succs { 4 } +;; 4 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 11 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 11 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 11 } +;; 11 succs { 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.154t.sccp b/TDs/TD1/CODE/4-SAXPY/main.c.154t.sccp new file mode 100644 index 0000000000000000000000000000000000000000..b7edc181fdca7edeb717cb41e74d0b15f092f951 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.154t.sccp @@ -0,0 +1,139 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.158t.cddce2 b/TDs/TD1/CODE/4-SAXPY/main.c.158t.cddce2 new file mode 100644 index 0000000000000000000000000000000000000000..b7edc181fdca7edeb717cb41e74d0b15f092f951 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.158t.cddce2 @@ -0,0 +1,139 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + if (i_30 <= 99) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + if (_11 <= 99) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.159t.ivcanon b/TDs/TD1/CODE/4-SAXPY/main.c.159t.ivcanon new file mode 100644 index 0000000000000000000000000000000000000000..f6398ab4d39d24391335e20e023ca8639d7ef8a2 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.159t.ivcanon @@ -0,0 +1,147 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + unsigned int ivtmp_16; + unsigned int ivtmp_17; + unsigned int ivtmp_38; + unsigned int ivtmp_40; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + # ivtmp_38 = PHI <ivtmp_17(10), 100(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + ivtmp_17 = ivtmp_38 - 1; + if (ivtmp_17 != 0) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp_16 = PHI <ivtmp_40(9), 100(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp_40 = ivtmp_16 - 1; + if (ivtmp_40 != 0) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.162t.copyprop3 b/TDs/TD1/CODE/4-SAXPY/main.c.162t.copyprop3 new file mode 100644 index 0000000000000000000000000000000000000000..f6398ab4d39d24391335e20e023ca8639d7ef8a2 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.162t.copyprop3 @@ -0,0 +1,147 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + unsigned int ivtmp_16; + unsigned int ivtmp_17; + unsigned int ivtmp_38; + unsigned int ivtmp_40; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + # ivtmp_38 = PHI <ivtmp_17(10), 100(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + ivtmp_17 = ivtmp_38 - 1; + if (ivtmp_17 != 0) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp_16 = PHI <ivtmp_40(9), 100(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp_40 = ivtmp_16 - 1; + if (ivtmp_40 != 0) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.175t.cunroll b/TDs/TD1/CODE/4-SAXPY/main.c.175t.cunroll new file mode 100644 index 0000000000000000000000000000000000000000..f6398ab4d39d24391335e20e023ca8639d7ef8a2 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.175t.cunroll @@ -0,0 +1,147 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int _5; + int * _6; + int _7; + int * _8; + int _9; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + + <bb 3> [local count: 955630225]: + # i_22 = PHI <i_19(6), 0(5)> + _1 = (long unsigned int) i_22; + _2 = _1 * 4; + _3 = x_14(D) + _2; + _4 = *_3; + _5 = _4 * a_15(D); + _6 = y_16(D) + _2; + _7 = *_6; + _8 = res_17(D) + _2; + _9 = _5 + _7; + *_8 = _9; + i_19 = i_22 + 1; + if (size_13(D) > i_19) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + int * y; + int * x; + int * res; + int i; + long unsigned int _1; + long unsigned int _2; + int * _3; + int _4; + int * _6; + long unsigned int _7; + long unsigned int _8; + int * _9; + int _10; + int _11; + int _12; + unsigned int ivtmp_16; + unsigned int ivtmp_17; + unsigned int ivtmp_38; + unsigned int ivtmp_40; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # i_35 = PHI <i_30(10), 0(2)> + # ivtmp_38 = PHI <ivtmp_17(10), 100(2)> + _1 = (long unsigned int) i_35; + _2 = _1 * 4; + _3 = x_22 + _2; + _4 = i_35 + 50; + *_3 = _4; + _6 = y_24 + _2; + *_6 = i_35; + i_30 = i_35 + 1; + ivtmp_17 = ivtmp_38 - 1; + if (ivtmp_17 != 0) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp_16 = PHI <ivtmp_40(9), 100(4)> + _7 = (long unsigned int) i_36; + _8 = _7 * 4; + _9 = res_20 + _8; + _10 = *_9; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp_40 = ivtmp_16 - 1; + if (ivtmp_40 != 0) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.180t.ivopts b/TDs/TD1/CODE/4-SAXPY/main.c.180t.ivopts new file mode 100644 index 0000000000000000000000000000000000000000..048028842ca20aa5aef08086b93a249143f3a830 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.180t.ivopts @@ -0,0 +1,134 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 3> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(5)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.181t.lim4 b/TDs/TD1/CODE/4-SAXPY/main.c.181t.lim4 new file mode 100644 index 0000000000000000000000000000000000000000..048028842ca20aa5aef08086b93a249143f3a830 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.181t.lim4 @@ -0,0 +1,134 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 5>; [89.00%] + else + goto <bb 7>; [11.00%] + + <bb 5> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 3> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(5)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 8> [local count: 105119324]: + goto <bb 4>; [100.00%] + + <bb 6> [local count: 850510901]: + goto <bb 3>; [100.00%] + + <bb 7> [local count: 12992276]: + + <bb 4> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 11>; [67.00%] + + <bb 11> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.182t.loopdone b/TDs/TD1/CODE/4-SAXPY/main.c.182t.loopdone new file mode 100644 index 0000000000000000000000000000000000000000..6f866117f5ec5a48114a284a17296be2554c2fb5 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.182t.loopdone @@ -0,0 +1,123 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Removing basic block 6 +Removing basic block 7 +Removing basic block 8 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Removing basic block 9 +Removing basic block 10 +Removing basic block 11 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.186t.veclower21 b/TDs/TD1/CODE/4-SAXPY/main.c.186t.veclower21 new file mode 100644 index 0000000000000000000000000000000000000000..2f157cde8ad2dfb1154ff0d0db10cbdcd062c13a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.186t.veclower21 @@ -0,0 +1,117 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.187t.switchlower1 b/TDs/TD1/CODE/4-SAXPY/main.c.187t.switchlower1 new file mode 100644 index 0000000000000000000000000000000000000000..2f157cde8ad2dfb1154ff0d0db10cbdcd062c13a --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.187t.switchlower1 @@ -0,0 +1,117 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.189t.reassoc2 b/TDs/TD1/CODE/4-SAXPY/main.c.189t.reassoc2 new file mode 100644 index 0000000000000000000000000000000000000000..0ffb62b0eee714da596e546ecfebd546f27dfcc1 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.189t.reassoc2 @@ -0,0 +1,155 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 4 +;; depth 1, outer 0 +;; nodes: 4 +;; 2 succs { 3 5 } +;; 3 succs { 4 } +;; 4 succs { 4 5 } +;; 5 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 8 +;; +;; Loop 2 +;; header 5, latch 7 +;; depth 1, outer 0 +;; nodes: 5 7 6 +;; +;; Loop 1 +;; header 3, latch 3 +;; depth 1, outer 0 +;; nodes: 3 +;; 2 succs { 3 } +;; 3 succs { 3 4 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 5 8 } +;; 8 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.190t.slsr b/TDs/TD1/CODE/4-SAXPY/main.c.190t.slsr new file mode 100644 index 0000000000000000000000000000000000000000..0ffb62b0eee714da596e546ecfebd546f27dfcc1 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.190t.slsr @@ -0,0 +1,155 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 +;; +;; Loop 1 +;; header 4, latch 4 +;; depth 1, outer 0 +;; nodes: 4 +;; 2 succs { 3 5 } +;; 3 succs { 4 } +;; 4 succs { 4 5 } +;; 5 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 5 6 7 8 +;; +;; Loop 2 +;; header 5, latch 7 +;; depth 1, outer 0 +;; nodes: 5 7 6 +;; +;; Loop 1 +;; header 3, latch 3 +;; depth 1, outer 0 +;; nodes: 3 +;; 2 succs { 3 } +;; 3 succs { 3 4 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 5 8 } +;; 8 succs { 1 } +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = (unsigned int) ivtmp.25_34; + _41 = _31 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.195t.dom3 b/TDs/TD1/CODE/4-SAXPY/main.c.195t.dom3 new file mode 100644 index 0000000000000000000000000000000000000000..26f9c98673602b373ced6aa808dafa5ac4aea176 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.195t.dom3 @@ -0,0 +1,161 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 6 5 +;; +;; Loop 1 +;; header 4, latch 6 +;; depth 1, outer 0 +;; nodes: 4 6 +;; 2 succs { 3 5 } +;; 3 succs { 4 } +;; 4 succs { 6 5 } +;; 6 succs { 4 } +;; 5 succs { 1 } +Removing basic block 6 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +Removing basic block 9 +Removing basic block 10 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = _42; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.196t.strlen1 b/TDs/TD1/CODE/4-SAXPY/main.c.196t.strlen1 new file mode 100644 index 0000000000000000000000000000000000000000..4400260d4e690e4b57edd44caeaa2f23624d6aa9 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.196t.strlen1 @@ -0,0 +1,180 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 6 5 +;; +;; Loop 1 +;; header 4, latch 6 +;; depth 1, outer 0 +;; nodes: 4 6 +;; 2 succs { 3 5 } +;; 3 succs { 4 } +;; 4 succs { 6 5 } +;; 6 succs { 4 } +;; 5 succs { 1 } +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +main.c:34: printf: objsize = 9223372036854775807, fmtstr = "res[%d] = %d ; " + Directive 1 at offset 0: "res[", length = 4 + Result: 4, 4, 4, 4 (4, 4, 4, 4) + Directive 2 at offset 4: "%d" + Result: 1, 2, 2, 2 (5, 6, 6, 6) + Directive 3 at offset 6: "] = ", length = 4 + Result: 4, 4, 4, 4 (9, 10, 10, 10) + Directive 4 at offset 10: "%d" + Result: 1, 1, 11, 11 (10, 11, 21, 21) + Directive 5 at offset 12: " ; ", length = 3 + Result: 3, 3, 3, 3 (13, 14, 24, 24) + Directive 6 at offset 15: "", length = 1 + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = _42; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.199t.ccp4 b/TDs/TD1/CODE/4-SAXPY/main.c.199t.ccp4 new file mode 100644 index 0000000000000000000000000000000000000000..86aa12310a90387cd592f1a434c1392640ab9879 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.199t.ccp4 @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = _42; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.200t.wrestrict b/TDs/TD1/CODE/4-SAXPY/main.c.200t.wrestrict new file mode 100644 index 0000000000000000000000000000000000000000..86aa12310a90387cd592f1a434c1392640ab9879 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.200t.wrestrict @@ -0,0 +1,126 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _31; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _31 = _42; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.201t.dse5 b/TDs/TD1/CODE/4-SAXPY/main.c.201t.dse5 new file mode 100644 index 0000000000000000000000000000000000000000..40f2e8948614d482718e961273f9568ae30dea42 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.201t.dse5 @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.202t.cddce3 b/TDs/TD1/CODE/4-SAXPY/main.c.202t.cddce3 new file mode 100644 index 0000000000000000000000000000000000000000..40f2e8948614d482718e961273f9568ae30dea42 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.202t.cddce3 @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) _42; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.203t.forwprop4 b/TDs/TD1/CODE/4-SAXPY/main.c.203t.forwprop4 new file mode 100644 index 0000000000000000000000000000000000000000..3078b14cb64bcdc4946d22345050106fc9a0a739 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.203t.forwprop4 @@ -0,0 +1,124 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(6), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 6>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 6> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(10), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 10>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 10> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(9), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(9), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.204t.sink2 b/TDs/TD1/CODE/4-SAXPY/main.c.204t.sink2 new file mode 100644 index 0000000000000000000000000000000000000000..1cc285a21be03122b47c3900e5362b913be3d639 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.204t.sink2 @@ -0,0 +1,162 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 4 6 5 +;; +;; Loop 1 +;; header 4, latch 6 +;; depth 1, outer 0 +;; nodes: 4 6 +;; 2 succs { 3 5 } +;; 3 succs { 4 } +;; 4 succs { 6 5 } +;; 6 succs { 4 } +;; 5 succs { 1 } +Removing basic block 6 +Removing basic block 7 +Removing basic block 8 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +;; 3 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 3 10 4 5 6 7 9 8 +;; +;; Loop 2 +;; header 5, latch 9 +;; depth 1, outer 0 +;; nodes: 5 9 7 6 +;; +;; Loop 1 +;; header 3, latch 10 +;; depth 1, outer 0 +;; nodes: 3 10 +;; 2 succs { 3 } +;; 3 succs { 10 4 } +;; 10 succs { 3 } +;; 4 succs { 5 } +;; 5 succs { 6 7 } +;; 6 succs { 7 } +;; 7 succs { 9 8 } +;; 9 succs { 5 } +;; 8 succs { 1 } +Removing basic block 9 +Removing basic block 10 +Removing basic block 11 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.205t.phiopt4 b/TDs/TD1/CODE/4-SAXPY/main.c.205t.phiopt4 new file mode 100644 index 0000000000000000000000000000000000000000..4d8ad4972785db7cbbd60d77b27ea4c0bb968dbf --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.205t.phiopt4 @@ -0,0 +1,115 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.206t.fab1 b/TDs/TD1/CODE/4-SAXPY/main.c.206t.fab1 new file mode 100644 index 0000000000000000000000000000000000000000..4d8ad4972785db7cbbd60d77b27ea4c0bb968dbf --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.206t.fab1 @@ -0,0 +1,115 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.210t.dce7 b/TDs/TD1/CODE/4-SAXPY/main.c.210t.dce7 new file mode 100644 index 0000000000000000000000000000000000000000..4d8ad4972785db7cbbd60d77b27ea4c0bb968dbf --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.210t.dce7 @@ -0,0 +1,115 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.211t.crited1 b/TDs/TD1/CODE/4-SAXPY/main.c.211t.crited1 new file mode 100644 index 0000000000000000000000000000000000000000..b0363ca1304ae10026f01008141319023168ce38 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.211t.crited1 @@ -0,0 +1,132 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.213t.local-pure-const2 b/TDs/TD1/CODE/4-SAXPY/main.c.213t.local-pure-const2 new file mode 100644 index 0000000000000000000000000000000000000000..24b4a5540ae8aab732dbf83eaea240b1f3fdc982 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.213t.local-pure-const2 @@ -0,0 +1,180 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + + + + local analysis of saxpy/22 + scanning: if (size_13(D) > 0) + scanning: _21 = (sizetype) size_13(D); + scanning: _20 = _21 * 4; + scanning: _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + Indirect ref read is not const + scanning: _5 = _4 * a_15(D); + scanning: _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + Indirect ref read is not const + scanning: _9 = _5 + _7; + scanning: MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + Indirect ref write is not const/pure + scanning: ivtmp.11_10 = ivtmp.11_11 + 4; + scanning: if (ivtmp.11_10 != _20) + scanning: return; +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + + + + local analysis of main/23 + scanning: res_20 = malloc (400); + scanning: x_22 = malloc (400); + scanning: y_24 = malloc (400); + scanning: _42 = (unsigned int) ivtmp.25_34; + scanning: i_35 = (int) ivtmp.25_34; + scanning: _41 = _42 + 50; + scanning: _4 = (int) _41; + scanning: MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + Indirect ref to local or readonly memory is OK + scanning: MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + Indirect ref to local or readonly memory is OK + scanning: ivtmp.25_33 = ivtmp.25_34 + 1; + scanning: if (ivtmp.25_33 != 100) + scanning: saxpy (res_20, x_22, y_24, 2, 100); + scanning: ivtmp.23_15 = (unsigned long) res_20; + scanning: _13 = (void *) ivtmp.23_14; + scanning: _10 = MEM[(int *)_13]; + Indirect ref to local or readonly memory is OK + scanning: printf ("res[%d] = %d ; ", i_36, _10); + scanning: _11 = i_36 + 1; + scanning: _12 = _11 % 10; + scanning: if (_12 == 0) + scanning: __builtin_putchar (10); + scanning: ivtmp.23_32 = ivtmp.23_14 + 4; + scanning: if (_11 != 100) + scanning: return 1; +Function is locally looping. +Function can locally free. +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.214t.modref2 b/TDs/TD1/CODE/4-SAXPY/main.c.214t.modref2 new file mode 100644 index 0000000000000000000000000000000000000000..6b96b2ecd43c72598105ea000538fc7a2ad9c4a6 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.214t.modref2 @@ -0,0 +1,282 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + + + +modref analyzing 'saxpy/22' (ipa=0) +Past summary: + loads: + Base 0: alias set 0 + Ref 0: alias set 0 + access: Parm 1 + access: Parm 2 + stores: + Base 0: alias set 0 + Ref 0: alias set 0 + access: Parm 0 + parm 0 flags: no_indirect_clobber no_direct_escape no_indirect_escape no_direct_read no_indirect_read + parm 1 flags: no_direct_clobber no_direct_escape + parm 2 flags: no_direct_clobber no_direct_escape + parm 4 flags: no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape no_direct_read no_indirect_read +Analyzing flags of ssa name: res_17(D) + Analyzing stmt: MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + current flags of res_17(D) no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read +flags of ssa name res_17(D) no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read +Analyzing flags of ssa name: x_14(D) + Analyzing stmt: _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + Analyzing flags of ssa name: _4 + Analyzing stmt: _5 = _4 * a_15(D); + Analyzing flags of ssa name: _5 + Analyzing stmt: _9 = _5 + _7; + Analyzing flags of ssa name: _9 + Analyzing stmt: MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ssa name saved to memory + current flags of _9 + flags of ssa name _9 + current flags of _5 + flags of ssa name _5 + current flags of _4 + flags of ssa name _4 + current flags of x_14(D) no_direct_clobber no_direct_escape not_returned_directly +flags of ssa name x_14(D) no_direct_clobber no_direct_escape not_returned_directly +Analyzing flags of ssa name: y_16(D) + Analyzing stmt: _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + Analyzing flags of ssa name: _7 + Analyzing stmt: _9 = _5 + _7; + current flags of _7 + flags of ssa name _7 + current flags of y_16(D) no_direct_clobber no_direct_escape not_returned_directly +flags of ssa name y_16(D) no_direct_clobber no_direct_escape not_returned_directly +Analyzing flags of ssa name: a_15(D) + Analyzing stmt: _5 = _4 * a_15(D); + current flags of a_15(D) +flags of ssa name a_15(D) +Analyzing flags of ssa name: size_13(D) + Analyzing stmt: _21 = (sizetype) size_13(D); + Analyzing flags of ssa name: _21 + Analyzing stmt: _20 = _21 * 4; + Analyzing flags of ssa name: _20 + Analyzing stmt: if (ivtmp.11_10 != _20) + current flags of _20 no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + flags of ssa name _20 no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + current flags of _21 no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + flags of ssa name _21 no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + current flags of size_13(D) no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + Analyzing stmt: if (size_13(D) > 0) + current flags of size_13(D) no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read +flags of ssa name size_13(D) no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_direct_read no_indirect_read + - Analyzing load: MEM[(int *)x_14(D) + ivtmp.11_11 * 1] + - Recording base_set=0 ref_set=0 Parm 1 + - Analyzing load: MEM[(int *)y_16(D) + ivtmp.11_11 * 1] + - Recording base_set=0 ref_set=0 Parm 2 + - Analyzing store: MEM[(int *)res_17(D) + ivtmp.11_11 * 1] + - Recording base_set=0 ref_set=0 Parm 0 +;; 2 loops found +;; +;; Loop 0 +;; header 0, latch 1 +;; depth 0, outer -1 +;; nodes: 0 1 2 6 3 4 7 8 5 +;; +;; Loop 1 +;; header 4, latch 7 +;; depth 1, outer 0 +;; nodes: 4 7 +;; 2 succs { 3 6 } +;; 6 succs { 5 } +;; 3 succs { 4 } +;; 4 succs { 7 8 } +;; 7 succs { 4 } +;; 8 succs { 5 } +;; 5 succs { 1 } + - modref done with result: tracked. + loads: + Base 0: alias set 0 + Ref 0: alias set 0 + access: Parm 1 + access: Parm 2 + stores: + Base 0: alias set 0 + Ref 0: alias set 0 + access: Parm 0 + parm 0 flags: no_indirect_clobber no_direct_escape no_indirect_escape no_direct_read no_indirect_read + parm 1 flags: no_direct_clobber no_direct_escape + parm 2 flags: no_direct_clobber no_direct_escape + parm 4 flags: no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape no_direct_read no_indirect_read +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + + + +modref analyzing 'main/23' (ipa=0) +Past summary: + loads: + Every base + stores: + Every base + Writes errno + Side effects + Nondeterministic + Global memory read + Global memory written + parm 0 flags: unused + parm 1 flags: unused + - Analyzing call:res_20 = malloc (400); + - Function availability <= AVAIL_INTERPOSABLE. + - Analyzing call:x_22 = malloc (400); + - Function availability <= AVAIL_INTERPOSABLE. + - Analyzing call:y_24 = malloc (400); + - Function availability <= AVAIL_INTERPOSABLE. + - Analyzing store: MEM[(int *)x_22 + ivtmp.25_34 * 4] + - Read-only or local, ignoring. + - Analyzing store: MEM[(int *)y_24 + ivtmp.25_34 * 4] + - Read-only or local, ignoring. + - Analyzing call:saxpy (res_20, x_22, y_24, 2, 100); + - Merging side effects of saxpy/22 + Parm map: -5 -5 -5 -1 -1 + - Analyzing load: MEM[(int *)_13] + - Read-only or local, ignoring. + - Analyzing call:printf ("res[%d] = %d ; ", i_36, _10); + - Function availability <= AVAIL_INTERPOSABLE. + Builtin with no fnspec: printf + - Analyzing call:__builtin_putchar (10); + - Function availability <= AVAIL_INTERPOSABLE. + Builtin with no fnspec: __builtin_putchar + - modref done with result: tracked. + loads: + Every base + stores: + Every base + Writes errno + Side effects + Nondeterministic + Global memory read + Global memory written + parm 0 flags: unused + parm 1 flags: unused +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.215t.uncprop1 b/TDs/TD1/CODE/4-SAXPY/main.c.215t.uncprop1 new file mode 100644 index 0000000000000000000000000000000000000000..b0363ca1304ae10026f01008141319023168ce38 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.215t.uncprop1 @@ -0,0 +1,132 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.247t.nrv b/TDs/TD1/CODE/4-SAXPY/main.c.247t.nrv new file mode 100644 index 0000000000000000000000000000000000000000..b0363ca1304ae10026f01008141319023168ce38 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.247t.nrv @@ -0,0 +1,132 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.248t.isel b/TDs/TD1/CODE/4-SAXPY/main.c.248t.isel new file mode 100644 index 0000000000000000000000000000000000000000..b0363ca1304ae10026f01008141319023168ce38 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.248t.isel @@ -0,0 +1,132 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.251t.waccess3 b/TDs/TD1/CODE/4-SAXPY/main.c.251t.waccess3 new file mode 100644 index 0000000000000000000000000000000000000000..33cb159b5401da7b7a16dc27a7d3b606d9a62f4d --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.251t.waccess3 @@ -0,0 +1,150 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +pointer_query counters: + index cache size: 0 + index entries: 0 + access cache size: 0 + access entries: 0 + hits: 0 + misses: 0 + failures: 0 + max_depth: 0 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int i; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 6>; [11.00%] + + <bb 6> [local count: 12992276]: + goto <bb 5>; [100.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(7), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 7>; [89.00%] + else + goto <bb 8>; [11.00%] + + <bb 7> [local count: 850510901]: + goto <bb 4>; [100.00%] + + <bb 8> [local count: 105119324]: + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +pointer_query counters: + index cache size: 0 + index entries: 0 + access cache size: 0 + access entries: 0 + hits: 0 + misses: 0 + failures: 0 + max_depth: 0 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(9), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 9>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 9> [local count: 1052374367]: + goto <bb 3>; [100.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(11), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(11), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 10>; [67.00%] + + <bb 10> [local count: 712212956]: + goto <bb 7>; [100.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 11>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 11> [local count: 1052374367]: + goto <bb 5>; [100.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.252t.optimized b/TDs/TD1/CODE/4-SAXPY/main.c.252t.optimized new file mode 100644 index 0000000000000000000000000000000000000000..2fca9808889e6952b87993c083735cb3b8325eda --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.252t.optimized @@ -0,0 +1,120 @@ + +;; Function saxpy (saxpy, funcdef_no=22, decl_uid=2967, cgraph_uid=23, symbol_order=22) + +Removing basic block 6 +Removing basic block 7 +Removing basic block 8 +void saxpy (int * res, int * x, int * y, int a, int size) +{ + sizetype ivtmp.11; + int _4; + int _5; + int _7; + int _9; + sizetype _20; + sizetype _21; + + <bb 2> [local count: 118111600]: + if (size_13(D) > 0) + goto <bb 3>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 3> [local count: 105119324]: + _21 = (sizetype) size_13(D); + _20 = _21 * 4; + + <bb 4> [local count: 955630225]: + # ivtmp.11_11 = PHI <ivtmp.11_10(4), 0(3)> + _4 = MEM[(int *)x_14(D) + ivtmp.11_11 * 1]; + _5 = _4 * a_15(D); + _7 = MEM[(int *)y_16(D) + ivtmp.11_11 * 1]; + _9 = _5 + _7; + MEM[(int *)res_17(D) + ivtmp.11_11 * 1] = _9; + ivtmp.11_10 = ivtmp.11_11 + 4; + if (ivtmp.11_10 != _20) + goto <bb 4>; [89.00%] + else + goto <bb 5>; [11.00%] + + <bb 5> [local count: 118111600]: + return; + +} + + + +;; Function main (main, funcdef_no=23, decl_uid=2976, cgraph_uid=24, symbol_order=23) (executed once) + +Removing basic block 9 +Removing basic block 10 +Removing basic block 11 +__attribute__((access ("^1[ ]", ))) +int main (int argc, char * * argv) +{ + unsigned long ivtmp.25; + unsigned long ivtmp.23; + int * y; + int * x; + int * res; + int i; + int _4; + int _10; + int _11; + int _12; + void * _13; + unsigned int _41; + unsigned int _42; + + <bb 2> [local count: 10737416]: + res_20 = malloc (400); + x_22 = malloc (400); + y_24 = malloc (400); + + <bb 3> [local count: 1063004409]: + # ivtmp.25_34 = PHI <ivtmp.25_33(3), 0(2)> + _42 = (unsigned int) ivtmp.25_34; + i_35 = (int) ivtmp.25_34; + _41 = _42 + 50; + _4 = (int) _41; + MEM[(int *)x_22 + ivtmp.25_34 * 4] = _4; + MEM[(int *)y_24 + ivtmp.25_34 * 4] = i_35; + ivtmp.25_33 = ivtmp.25_34 + 1; + if (ivtmp.25_33 != 100) + goto <bb 3>; [99.00%] + else + goto <bb 4>; [1.00%] + + <bb 4> [local count: 10737416]: + saxpy (res_20, x_22, y_24, 2, 100); + ivtmp.23_15 = (unsigned long) res_20; + + <bb 5> [local count: 1063004409]: + # i_36 = PHI <_11(7), 0(4)> + # ivtmp.23_14 = PHI <ivtmp.23_32(7), ivtmp.23_15(4)> + _13 = (void *) ivtmp.23_14; + _10 = MEM[(int *)_13]; + printf ("res[%d] = %d ; ", i_36, _10); + _11 = i_36 + 1; + _12 = _11 % 10; + if (_12 == 0) + goto <bb 6>; [33.00%] + else + goto <bb 7>; [67.00%] + + <bb 6> [local count: 350791453]: + __builtin_putchar (10); + + <bb 7> [local count: 1063004409]: + ivtmp.23_32 = ivtmp.23_14 + 4; + if (_11 != 100) + goto <bb 5>; [99.00%] + else + goto <bb 8>; [1.00%] + + <bb 8> [local count: 10737416]: + return 1; + +} + + diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.339t.statistics b/TDs/TD1/CODE/4-SAXPY/main.c.339t.statistics new file mode 100644 index 0000000000000000000000000000000000000000..c3967ce6a75237b2ae34cf65b940a00b61e90c51 --- /dev/null +++ b/TDs/TD1/CODE/4-SAXPY/main.c.339t.statistics @@ -0,0 +1,71 @@ +39 ccp "Statements deleted" "saxpy" 1 +44 fre "RPO blocks" "saxpy" 4 +44 fre "RPO iterations == 10" "saxpy" 1 +44 fre "RPO blocks visited" "saxpy" 4 +44 fre "RPO num lattice == 22" "saxpy" 1 +44 fre "RPO blocks executable" "saxpy" 4 +44 fre "RPO block visited times == 1" "saxpy" 4 +44 fre "RPO num values == 22" "saxpy" 1 +44 fre "RPO num avail == 11" "saxpy" 1 +44 fre "Eliminated" "saxpy" 4 +58 release_ssa "SSA names released" "saxpy" 5 +58 release_ssa "SSA name holes removed" "saxpy" 5 +39 ccp "Constants propagated" "main" 7 +39 ccp "Statements deleted" "main" 11 +44 fre "RPO blocks" "main" 9 +44 fre "RPO num avail == 17" "main" 1 +44 fre "RPO iterations == 10" "main" 1 +44 fre "RPO blocks visited" "main" 9 +44 fre "RPO num lattice == 31" "main" 1 +44 fre "RPO blocks executable" "main" 9 +44 fre "RPO block visited times == 1" "main" 9 +44 fre "Eliminated" "main" 3 +44 fre "RPO num values == 31" "main" 1 +58 release_ssa "unused VAR_DECLs removed" "main" 2 +58 release_ssa "SSA names released" "main" 13 +58 release_ssa "SSA name holes removed" "main" 13 +117 fre "RPO blocks" "saxpy" 4 +117 fre "RPO iterations == 10" "saxpy" 1 +117 fre "RPO blocks visited" "saxpy" 4 +117 fre "RPO num lattice == 18" "saxpy" 1 +117 fre "RPO num values == 18" "saxpy" 1 +117 fre "RPO blocks executable" "saxpy" 4 +117 fre "RPO block visited times == 1" "saxpy" 4 +117 fre "RPO num avail == 11" "saxpy" 1 +131 ch "RPO blocks" "saxpy" 2 +131 ch "RPO iterations == 10" "saxpy" 1 +131 ch "Incremental SSA update" "saxpy" 1 +131 ch "RPO blocks visited" "saxpy" 2 +131 ch "RPO blocks executable" "saxpy" 2 +131 ch "RPO block visited times == 1" "saxpy" 2 +131 ch "RPO num avail == 0" "saxpy" 1 +131 ch "RPO num values == 3" "saxpy" 1 +131 ch "RPO num lattice == 3" "saxpy" 1 +131 ch "Eliminated" "saxpy" 1 +290 combine "two-insn combine" "saxpy" 1 +117 fre "RPO blocks" "main" 9 +117 fre "RPO num avail == 17" "main" 1 +117 fre "RPO iterations == 10" "main" 1 +117 fre "RPO blocks visited" "main" 9 +117 fre "RPO blocks executable" "main" 9 +117 fre "RPO block visited times == 1" "main" 9 +117 fre "RPO num values == 28" "main" 1 +117 fre "RPO num lattice == 28" "main" 1 +126 copyprop "Copies propagated" "main" 1 +126 copyprop "Statements deleted" "main" 1 +131 ch "RPO num values == 2" "main" 2 +131 ch "RPO blocks" "main" 4 +131 ch "RPO iterations == 10" "main" 2 +131 ch "RPO num lattice == 2" "main" 2 +131 ch "Incremental SSA update" "main" 1 +131 ch "RPO blocks visited" "main" 4 +131 ch "RPO blocks executable" "main" 4 +131 ch "RPO block visited times == 1" "main" 4 +131 ch "RPO num avail == 0" "main" 2 +131 ch "Eliminated" "main" 2 +135 dom "Copies propagated" "main" 1 +136 copyprop "Statements deleted" "main" 1 +200 dom "Copies propagated" "main" 1 +200 dom "Redundant expressions eliminated" "main" 1 +257 optimized "unused VAR_DECLs removed" "main" 1 +290 combine "two-insn combine" "main" 3 diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.340t.earlydebug b/TDs/TD1/CODE/4-SAXPY/main.c.340t.earlydebug new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TDs/TD1/CODE/4-SAXPY/main.c.341t.debug b/TDs/TD1/CODE/4-SAXPY/main.c.341t.debug new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TDs/TD1/td1.pdf b/TDs/TD1/td1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a83867c628ab1eb7f75dfbda50b9b217dbbce32e Binary files /dev/null and b/TDs/TD1/td1.pdf differ diff --git a/TDs/TD2/CODE/Makefile b/TDs/TD2/CODE/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8dd4bca5c2533f75183b8e54e64f60c27850ee30 --- /dev/null +++ b/TDs/TD2/CODE/Makefile @@ -0,0 +1,32 @@ +EXE= TP2_1 \ + TP2_2 \ + TP2_3 \ + TP2_5 \ + TP2_6 \ + TP2_7 \ + TP2_7_bis \ + TP2_8 + +all: $(EXE) + +CXX=g++_1220 +CC=gcc_1220 + +MPICC=mpicc + +PLUGIN_FLAGS=-I`$(CC) -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC + +CFLAGS=-g -O3 + + +libplugin_%.so: plugin_%.cpp + $(CXX) $(PLUGIN_FLAGS) $(GMP_CFLAGS) -o $@ $< + +% : libplugin_%.so test.c + $(MPICC) test.c $(CFLAGS) -o $@ -fplugin=./$< + +clean: + rm -rf $(EXE) + +clean_all: clean + rm -rf libplugin*.so *.dot diff --git a/TDs/TD2/CODE/QX/Makefile b/TDs/TD2/CODE/QX/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ae14f46e8e287ad1809ae48d51331eec234f0596 --- /dev/null +++ b/TDs/TD2/CODE/QX/Makefile @@ -0,0 +1,5 @@ +all: libplugin.so + gcc test.c -c -fplugin=./libplugin.so + +libplugin.so: + g++ -I`gcc -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC -o libplugin.so plugin.cpp \ No newline at end of file diff --git a/TDs/TD2/CODE/QX/libplugin.so b/TDs/TD2/CODE/QX/libplugin.so new file mode 100644 index 0000000000000000000000000000000000000000..f2365c8615537f976a6cc06542c779337d24aee9 Binary files /dev/null and b/TDs/TD2/CODE/QX/libplugin.so differ diff --git a/TDs/TD2/CODE/QX/plugin.cpp b/TDs/TD2/CODE/QX/plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e01d2914b7df81ea400d77dfbf0dcd084033bda2 --- /dev/null +++ b/TDs/TD2/CODE/QX/plugin.cpp @@ -0,0 +1,77 @@ +#include <gcc-plugin.h> +#include <tree.h> +#include <context.h> +#include <gimple.h> +#include <gimple-iterator.h> +#include <tree-pass.h> +#include "basic-block.h" + +#include <stdio.h> + +int plugin_is_GPL_compatible; + +const pass_data my_pass_data = { + GIMPLE_PASS, /* type */ + "MY_PASS", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +class my_pass : public gimple_opt_pass +{ +public: + my_pass(gcc::context *ctxt) + : gimple_opt_pass(my_pass_data, ctxt) + { + } + my_pass *clone() { return new my_pass(g); } + bool gate(function *fun) + { + printf("Gating my_pass with function %s %s %s\n", + fndecl_name(cfun->decl), + function_name(fun), + current_function_name()); + return true; + } + unsigned int execute(function *fun) + { + printf("Executing my_pass with function %s %s %s\n", + fndecl_name(cfun->decl), + function_name(fun), + current_function_name()); + basic_block bb; + FOR_EACH_BB_FN(bb, cfun) + { + printf("Basic block %d\n", bb->index); + for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + printf("Statement at line %d\n", gimple_lineno(gsi_stmt(gsi))); + } + } + return 0; + } +}; + +int plugin_init( + struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + struct register_pass_info pass_info; + my_pass p(g); + pass_info.pass = &p; + pass_info.reference_pass_name = + "cfg"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_INSERT_AFTER; + register_callback( + plugin_info->base_name, + PLUGIN_PASS_MANAGER_SETUP, + NULL, + &pass_info); + return 0; +} diff --git a/TDs/TD2/CODE/QX/test.c b/TDs/TD2/CODE/QX/test.c new file mode 100644 index 0000000000000000000000000000000000000000..a8636208b72c256d1688de447089085c062fece3 --- /dev/null +++ b/TDs/TD2/CODE/QX/test.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +void f() +{ + printf("In f\n"); +} + +void g() +{ + printf("In g\n"); +} \ No newline at end of file diff --git a/TDs/TD2/CODE/QX/test.o b/TDs/TD2/CODE/QX/test.o new file mode 100644 index 0000000000000000000000000000000000000000..b0b66cf1fcb093f05bd9740701e6d8bd3b3e16ff Binary files /dev/null and b/TDs/TD2/CODE/QX/test.o differ diff --git a/TDs/TD2/CODE/QY/Makefile b/TDs/TD2/CODE/QY/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8dd4bca5c2533f75183b8e54e64f60c27850ee30 --- /dev/null +++ b/TDs/TD2/CODE/QY/Makefile @@ -0,0 +1,32 @@ +EXE= TP2_1 \ + TP2_2 \ + TP2_3 \ + TP2_5 \ + TP2_6 \ + TP2_7 \ + TP2_7_bis \ + TP2_8 + +all: $(EXE) + +CXX=g++_1220 +CC=gcc_1220 + +MPICC=mpicc + +PLUGIN_FLAGS=-I`$(CC) -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC + +CFLAGS=-g -O3 + + +libplugin_%.so: plugin_%.cpp + $(CXX) $(PLUGIN_FLAGS) $(GMP_CFLAGS) -o $@ $< + +% : libplugin_%.so test.c + $(MPICC) test.c $(CFLAGS) -o $@ -fplugin=./$< + +clean: + rm -rf $(EXE) + +clean_all: clean + rm -rf libplugin*.so *.dot diff --git a/TDs/TD2/CODE/QY/libplugin.so b/TDs/TD2/CODE/QY/libplugin.so new file mode 100644 index 0000000000000000000000000000000000000000..73d5ce2e5ac3367a1edd82d3a87605ad736707fd Binary files /dev/null and b/TDs/TD2/CODE/QY/libplugin.so differ diff --git a/TDs/TD2/CODE/QY/main_test.c_21_graph.dot b/TDs/TD2/CODE/QY/main_test.c_21_graph.dot new file mode 100644 index 0000000000000000000000000000000000000000..5281198a7ee96d16a01c0feb0e6912ea53257ebf --- /dev/null +++ b/TDs/TD2/CODE/QY/main_test.c_21_graph.dot @@ -0,0 +1,31 @@ +Digraph G{ +N0[label = " Node 0:\n" shape = box] +N2[label = " Node 2:\n[test.c:22:2] MPI_Init ([test.c:22:2] &argc, [test.c:22:2] &argv); +\l[test.c:25:6] a = 2; +\l[test.c:26:6] b = 3; +\l[test.c:27:6] c = 0; +\l[test.c:29:9] i = 0; +\l" shape = box] +N3[label = " Node 3:\n[test.c:32:3] mpi_call (c); +\l[test.c:33:11] _1 = a + b; +\l[test.c:33:5] c = c + _1; +\l[test.c:29:23] i = i + 1; +\l" shape = box] +N4[label = " Node 4:\n[test.c:29:16] if (i <= 9) +\l" shape = box] +N5[label = " Node 5:\n[test.c:36:2] printf ([test.c:36:9] "c=%d\n", c); +\l[test.c:38:2] MPI_Finalize (); +\l[test.c:39:9] D.19859 = 1; +\l" shape = box] +N6[label = " Node 6:\n<L3>: +\lreturn D.19859; +\l" shape = box] +N1[label = " Node 1:\n" shape = box] +N0 -> N2 +N2 -> N4 +N3 -> N4 +N4 -> N3 +N4 -> N5 +N5 -> N6 +N6 -> N1 +} diff --git a/TDs/TD2/CODE/QY/mpi_call_test.c_7_graph.dot b/TDs/TD2/CODE/QY/mpi_call_test.c_7_graph.dot new file mode 100644 index 0000000000000000000000000000000000000000..0b41c1f1eba7aea84da81689f5bbd196ad386d1e --- /dev/null +++ b/TDs/TD2/CODE/QY/mpi_call_test.c_7_graph.dot @@ -0,0 +1,19 @@ +Digraph G{ +N0[label = " Node 0:\n" shape = box] +N2[label = " Node 2:\n[test.c:8:2] MPI_Barrier (1140850688); +\l[test.c:10:5] if (c <= 9) +\l" shape = box] +N3[label = " Node 3:\n[test.c:12:3] printf ([test.c:12:10] je suis dans le if (c=%d)\n, c); +\l" shape = box] +N4[label = " Node 4:\n[test.c:16:3] printf ([test.c:16:10] je suis dans le else (c=%d)\n, c); +\l" shape = box] +N5[label = " Node 5:\n[test.c:18:1] return; +\l" shape = box] +N1[label = " Node 1:\n" shape = box] +N0 -> N2 +N2 -> N3 +N2 -> N4 +N3 -> N5 +N4 -> N5 +N5 -> N1 +} diff --git a/TDs/TD2/CODE/QY/plugin.cpp b/TDs/TD2/CODE/QY/plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b1b53b9ecaf6695de550c0718a9cafae0e69e8cf --- /dev/null +++ b/TDs/TD2/CODE/QY/plugin.cpp @@ -0,0 +1,135 @@ +#include <gcc-plugin.h> +#include <plugin-version.h> +#include <tree.h> +#include <basic-block.h> +#include <gimple.h> +#include <tree-pass.h> +#include <context.h> +#include <function.h> +#include <gimple-iterator.h> +#include <gimple-pretty-print.h> + +/******************************/ +/**** TD2 - QUESTION 7 ****/ +/******************************/ + +/* Build a filename (as a string) based on function name */ +static char * +cfgviz_generate_filename(function *fun, const char *suffix) +{ + char *target_filename; + + target_filename = (char *)xmalloc(2048 * sizeof(char)); + + snprintf(target_filename, 1024, "%s_%s_%d_%s.dot", + current_function_name(), + LOCATION_FILE(fun->function_start_locus), + LOCATION_LINE(fun->function_start_locus), + suffix); + + return target_filename; +} + +/* Dump the graphviz representation of function 'fun' in file 'out' */ +static void +cfgviz_internal_dump(function *fun, FILE *out) +{ + // Print the header line and open the main graph + fprintf(out, "Digraph G{\n"); + + basic_block bb; + FOR_ALL_BB_FN(bb, cfun) + { + fprintf(out, "N%d[label = \" Node %d:\\n", bb->index, bb->index); + gimple_stmt_iterator gsi; + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + print_gimple_stmt(out, gsi_stmt(gsi), 0, TDF_LINENO); + } + fprintf(out, "\" shape = box]\n"); + } + + FOR_ALL_BB_FN(bb, cfun) + { + edge e; + edge_iterator ei; + FOR_EACH_EDGE(e, ei, bb->succs) + { + fprintf(out, "N%d -> N%d\n", bb->index, e->dest->index); + } + } + + // Close the main graph + fprintf(out, "}\n"); +} + +void cfgviz_dump(function *fun, const char *suffix) +{ + char *target_filename; + FILE *out; + + target_filename = cfgviz_generate_filename(fun, suffix); + + printf("[GRAPHVIZ] Generating CFG of function %s in file <%s>\n", + current_function_name(), target_filename); + + out = fopen(target_filename, "w"); + + cfgviz_internal_dump(fun, out); + + fclose(out); + free(target_filename); +} + +/******************************/ +/** TD2 - FIN QUESTION 7 **/ +/******************************/ + +int plugin_is_GPL_compatible; + +const pass_data my_pass_data = { + GIMPLE_PASS, /* type */ + "MY_PASS", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +class my_pass : public gimple_opt_pass +{ +public: + my_pass(gcc::context *ctxt) + : gimple_opt_pass(my_pass_data, ctxt) + { + } + my_pass *clone() { return new my_pass(g); } + bool gate(function *fun) { return true; } + unsigned int execute(function *fun) + { + cfgviz_dump(fun, "graph"); + return 0; + } +}; + +int plugin_init( + struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + struct register_pass_info pass_info; + my_pass p(g); + pass_info.pass = &p; + pass_info.reference_pass_name = + "cfg"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_INSERT_AFTER; + register_callback( + plugin_info->base_name, + PLUGIN_PASS_MANAGER_SETUP, + NULL, + &pass_info); + return 0; +} \ No newline at end of file diff --git a/TDs/TD2/CODE/QY/test.c b/TDs/TD2/CODE/QY/test.c new file mode 100644 index 0000000000000000000000000000000000000000..5ba32c3a62c340503d6afb2504527a1fde641c72 --- /dev/null +++ b/TDs/TD2/CODE/QY/test.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +void mpi_call(int c) +{ + MPI_Barrier(MPI_COMM_WORLD); + + if (c < 10) + { + printf("je suis dans le if (c=%d)\n", c); + } + else + { + printf("je suis dans le else (c=%d)\n", c); + } +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + for (i = 0; i < 10; i++) + { + + mpi_call(c); + c += (a + b); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD2/CODE/QY/test.o b/TDs/TD2/CODE/QY/test.o new file mode 100644 index 0000000000000000000000000000000000000000..c3c954b6d0f7c1da10f9a7eea6e4a5b10f44f813 Binary files /dev/null and b/TDs/TD2/CODE/QY/test.o differ diff --git a/TDs/TD2/CODE/QY/test_2.c b/TDs/TD2/CODE/QY/test_2.c new file mode 100644 index 0000000000000000000000000000000000000000..a8636208b72c256d1688de447089085c062fece3 --- /dev/null +++ b/TDs/TD2/CODE/QY/test_2.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +void f() +{ + printf("In f\n"); +} + +void g() +{ + printf("In g\n"); +} \ No newline at end of file diff --git a/TDs/TD2/CODE/QZ/Makefile b/TDs/TD2/CODE/QZ/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ae14f46e8e287ad1809ae48d51331eec234f0596 --- /dev/null +++ b/TDs/TD2/CODE/QZ/Makefile @@ -0,0 +1,5 @@ +all: libplugin.so + gcc test.c -c -fplugin=./libplugin.so + +libplugin.so: + g++ -I`gcc -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC -o libplugin.so plugin.cpp \ No newline at end of file diff --git a/TDs/TD2/CODE/QZ/libplugin.so b/TDs/TD2/CODE/QZ/libplugin.so new file mode 100644 index 0000000000000000000000000000000000000000..6e8b2233e0e21ae8651805ed6b9fcafd09aa1f9b Binary files /dev/null and b/TDs/TD2/CODE/QZ/libplugin.so differ diff --git a/TDs/TD2/CODE/QZ/plugin.cpp b/TDs/TD2/CODE/QZ/plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a3288d4057fa13694e54493febac092bfa623252 --- /dev/null +++ b/TDs/TD2/CODE/QZ/plugin.cpp @@ -0,0 +1,82 @@ +#include <gcc-plugin.h> +#include <tree.h> +#include <context.h> +#include <gimple.h> +#include <gimple-iterator.h> +#include <tree-pass.h> +#include "basic-block.h" + +#include <stdio.h> + +int plugin_is_GPL_compatible; + +const pass_data my_pass_data = { + GIMPLE_PASS, /* type */ + "MY_PASS", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +class my_pass : public gimple_opt_pass +{ +public: + my_pass(gcc::context *ctxt) + : gimple_opt_pass(my_pass_data, ctxt) + { + } + my_pass *clone() { return new my_pass(g); } + bool gate(function *fun) + { + printf("Gating my_pass with function %s\n", + current_function_name()); + return true; + } + unsigned int execute(function *fun) + { + printf("----------\nExecuting my_pass with function %s\n", + current_function_name()); + basic_block bb; + FOR_EACH_BB_FN(bb, cfun) + { + printf(" Basic block %d\n", bb->index); + for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + if (is_gimple_call(gsi_stmt(gsi))) + { + tree decl = gimple_call_fndecl(gsi_stmt(gsi)); + if (decl && TREE_CODE(decl) == FUNCTION_DECL) + { + const char *name = IDENTIFIER_POINTER(DECL_NAME(decl)); + printf(" Function call: %s\n", name); + } + } + } + } + printf("----------\n"); + return 0; + } +}; + +int plugin_init( + struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + struct register_pass_info pass_info; + my_pass p(g); + pass_info.pass = &p; + pass_info.reference_pass_name = + "cfg"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_INSERT_AFTER; + register_callback( + plugin_info->base_name, + PLUGIN_PASS_MANAGER_SETUP, + NULL, + &pass_info); + return 0; +} diff --git a/TDs/TD2/CODE/QZ/test.c b/TDs/TD2/CODE/QZ/test.c new file mode 100644 index 0000000000000000000000000000000000000000..c2205554ba3ffd808f89a7b898340c6a4be266ca --- /dev/null +++ b/TDs/TD2/CODE/QZ/test.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +void z(){}; + +void f() +{ + printf("In f\n"); + z(); +} + +void g() +{ + printf("In g\n"); + z(); +} \ No newline at end of file diff --git a/TDs/TD2/CODE/QZ/test.o b/TDs/TD2/CODE/QZ/test.o new file mode 100644 index 0000000000000000000000000000000000000000..8610ce7628274fde5a771e661cb8a0c4d398cccc Binary files /dev/null and b/TDs/TD2/CODE/QZ/test.o differ diff --git a/TDs/TD2/CODE/QZ/test_2.c b/TDs/TD2/CODE/QZ/test_2.c new file mode 100644 index 0000000000000000000000000000000000000000..5ba32c3a62c340503d6afb2504527a1fde641c72 --- /dev/null +++ b/TDs/TD2/CODE/QZ/test_2.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +void mpi_call(int c) +{ + MPI_Barrier(MPI_COMM_WORLD); + + if (c < 10) + { + printf("je suis dans le if (c=%d)\n", c); + } + else + { + printf("je suis dans le else (c=%d)\n", c); + } +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + for (i = 0; i < 10; i++) + { + + mpi_call(c); + c += (a + b); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD2/CODE/QZ/test_2.o b/TDs/TD2/CODE/QZ/test_2.o new file mode 100644 index 0000000000000000000000000000000000000000..a3658e4e34533e7f555c5c702ed300518d8dba5b Binary files /dev/null and b/TDs/TD2/CODE/QZ/test_2.o differ diff --git a/TDs/TD2/CODE/plugin_TP2_7.cpp b/TDs/TD2/CODE/plugin_TP2_7.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ebee19d6374076a37ed3c379de648e18a0d0847b --- /dev/null +++ b/TDs/TD2/CODE/plugin_TP2_7.cpp @@ -0,0 +1,68 @@ +#include <gcc-plugin.h> +#include <plugin-version.h> +#include <tree.h> +#include <basic-block.h> +#include <gimple.h> +#include <tree-pass.h> +#include <context.h> +#include <function.h> +#include <gimple-iterator.h> + +/******************************/ +/**** TD2 - QUESTION 7 ****/ +/******************************/ + +/* Build a filename (as a string) based on function name */ +static char * +cfgviz_generate_filename(function *fun, const char *suffix) +{ + char *target_filename; + + target_filename = (char *)xmalloc(2048 * sizeof(char)); + + snprintf(target_filename, 1024, "%s_%s_%d_%s.dot", + current_function_name(), + LOCATION_FILE(fun->function_start_locus), + LOCATION_LINE(fun->function_start_locus), + suffix); + + return target_filename; +} + +/* Dump the graphviz representation of function 'fun' in file 'out' */ +static void +cfgviz_internal_dump(function *fun, FILE *out) +{ + + // Print the header line and open the main graph + fprintf(out, "Digraph G{\n"); + + /*****************************/ + /***** COMPLETE HERE ********/ + /*****************************/ + + // Close the main graph + fprintf(out, "}\n"); +} + +void cfgviz_dump(function *fun, const char *suffix) +{ + char *target_filename; + FILE *out; + + target_filename = cfgviz_generate_filename(fun, suffix); + + printf("[GRAPHVIZ] Generating CFG of function %s in file <%s>\n", + current_function_name(), target_filename); + + out = fopen(target_filename, "w"); + + cfgviz_internal_dump(fun, out); + + fclose(out); + free(target_filename); +} + +/******************************/ +/** TD2 - FIN QUESTION 7 **/ +/******************************/ diff --git a/TDs/TD2/CODE/test.c b/TDs/TD2/CODE/test.c new file mode 100644 index 0000000000000000000000000000000000000000..5ba32c3a62c340503d6afb2504527a1fde641c72 --- /dev/null +++ b/TDs/TD2/CODE/test.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +void mpi_call(int c) +{ + MPI_Barrier(MPI_COMM_WORLD); + + if (c < 10) + { + printf("je suis dans le if (c=%d)\n", c); + } + else + { + printf("je suis dans le else (c=%d)\n", c); + } +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + for (i = 0; i < 10; i++) + { + + mpi_call(c); + c += (a + b); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD2/td2.pdf b/TDs/TD2/td2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f1a0363d38a3bcabb976b61705a46befc036368f Binary files /dev/null and b/TDs/TD2/td2.pdf differ diff --git a/TDs/TD3/CODE/MPI_collectives.def b/TDs/TD3/CODE/MPI_collectives.def new file mode 100644 index 0000000000000000000000000000000000000000..af1fcb1cf36e79be843d6d8c9b51511bc000299b --- /dev/null +++ b/TDs/TD3/CODE/MPI_collectives.def @@ -0,0 +1,6 @@ + +DEFMPICOLLECTIVES(MPI_INIT, "MPI_Init") +DEFMPICOLLECTIVES(MPI_FINALIZE, "MPI_Finalize") +DEFMPICOLLECTIVES(MPI_REDUCE, "MPI_Reduce") +DEFMPICOLLECTIVES(MPI_ALL_REDUCE, "MPI_AllReduce") +DEFMPICOLLECTIVES(MPI_BARRIER, "MPI_Barrier") diff --git a/TDs/TD3/CODE/Makefile b/TDs/TD3/CODE/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..88d3bf87a84b649f7b8f14eb6485d6fa52284e2a --- /dev/null +++ b/TDs/TD3/CODE/Makefile @@ -0,0 +1,33 @@ +EXE= TP3_1 \ + TP3_2 \ + TP3_3 \ + TP3_4 \ + TP3_5 \ + TP3_6 \ + TP3_6_bis \ + TP3_7 \ + TP3_8 + +all: $(EXE) + +CXX=g++_1220 +CC=gcc_1220 + +MPICC=mpicc + +PLUGIN_FLAGS=-I`$(CC) -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC + +CFLAGS=-g -O3 + + +libplugin_%.so: plugin_%.cpp + $(CXX) $(PLUGIN_FLAGS) -o $@ $< + +% : libplugin_%.so test2.c + $(MPICC) test2.c $(CFLAGS) -o $@ -fplugin=./$< + +clean: + rm -rf $(EXE) + +clean_all: clean + rm -rf libplugin*.so *.dot diff --git a/TDs/TD3/CODE/libplugin.so b/TDs/TD3/CODE/libplugin.so new file mode 100644 index 0000000000000000000000000000000000000000..6ab4cf4b90d6547f5f432f08e27100496d7cccef Binary files /dev/null and b/TDs/TD3/CODE/libplugin.so differ diff --git a/TDs/TD3/CODE/plugin_TP3_1.cpp b/TDs/TD3/CODE/plugin_TP3_1.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8bd1c22647365d4f6151ffa225eace0536e3752d --- /dev/null +++ b/TDs/TD3/CODE/plugin_TP3_1.cpp @@ -0,0 +1,490 @@ +#include <gcc-plugin.h> +#include <plugin-version.h> +#include <tree.h> +#include <basic-block.h> +#include <gimple.h> +#include <tree-pass.h> +#include <context.h> +#include <function.h> +#include <gimple-iterator.h> + +#include <string.h> + +/* Global variable required for plugin to execute */ +int plugin_is_GPL_compatible; + +/* Global object (const) to represent my pass */ +const pass_data my_pass_data = + { + GIMPLE_PASS, /* type */ + "NEW_PASS", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +/* Enum to represent the collective operations */ +enum mpi_collective_code +{ +#define DEFMPICOLLECTIVES(CODE, NAME) CODE, +#include "MPI_collectives.def" + LAST_AND_UNUSED_MPI_COLLECTIVE_CODE +#undef DEFMPICOLLECTIVES +}; + +/* Name of each MPI collective operations */ +#define DEFMPICOLLECTIVES(CODE, NAME) NAME, +const char *const mpi_collective_name[] = { +#include "MPI_collectives.def" +}; +#undef DEFMPICOLLECTIVES + +void td_isol_print(int td) +{ + printf("\n\n\n"); + printf("/****************************************************************************************************/\n"); + printf("/****************************************************************************************************/\n"); + printf("/************************* TD%d *************************/\n", td); + printf("/****************************************************************************************************/\n"); + printf("/****************************************************************************************************/\n"); + printf("\n\n\n"); +} + +void function_isol_print(function *fun) +{ + printf("\n\n\n"); + printf("/************************************************************************************************************************/\n"); + printf("/************************************************************************************************************************/\n"); + printf("/*********************************** %s ***********************************/\n", function_name(fun)); + printf("/************************************************************************************************************************/\n"); + printf("/************************************************************************************************************************/\n"); + printf("\n\n\n"); +} + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* TD3 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +enum mpi_collective_code print_if_mpi_function(gimple *stmt) +{ + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + /* + if (strncmp(callee_name, "MPI_", 4) == 0) + { + printf(" |||++||| - gimple statement is a MPI function: function called is \" %s \" \n", callee_name); + } + */ + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + printf(" |||++||| - gimple statement is a MPI collective in enum: function called is \" %s \" \n", callee_name); + return mpi_collective_code(i); + } + } + } + + return LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; +} + +void clear_all_bb_aux(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + printf("aux value before reset : %p\n", bb->aux); + bb->aux = NULL; + } +} + +int check_if_bb_contains_multiple_mpi_calls(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + int nb_mpi_calls = 0; + for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + nb_mpi_calls++; + if (nb_mpi_calls > 1) + { + return 1; + } + } + } + } + } + } + + return 0; +} + +void split_block_with_multiple_mpi_calls(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + gimple *old_stmt = NULL; + + for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + if (old_stmt != NULL) + { + printf("Split !"); + split_block(bb, old_stmt); + } + old_stmt = stmt; + } + } + } + } + } +} + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* TD2 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/******************************/ +/**** TD2 - QUESTION 3 & 4 ****/ +/******************************/ + +const char * +td2_q3_q4_print_func_name(function *fun) +{ + const char *fname = function_name(fun); + printf("\t ... in function %s\n", fname); + + return fname; +} + +/******************************/ +/** TD2 - FIN QUESTION 3 & 4 **/ +/******************************/ + +/******************************/ +/**** TD2 - QUESTION 8 ****/ +/******************************/ + +void td2_q8_print_called_functions(basic_block bb) +{ + gimple_stmt_iterator gsi; + + /* Iterate on gimple statements in the current basic block */ + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + enum mpi_collective_code code = print_if_mpi_function(stmt); + printf("Code : %d\n", code); + + bb->aux = (void *)code; + } +} + +/******************************/ +/** TD2 - FIN QUESTION 8 **/ +/******************************/ + +/******************************/ +/**** TD2 - QUESTION 5 & 6 ****/ +/******************************/ + +void td2_q5_q6_print_blocks(function *fun) +{ + basic_block bb; + gimple_stmt_iterator gsi; + gimple *stmt; + + if (check_if_bb_contains_multiple_mpi_calls(fun) == 1) + { + printf(" |||++||| - Function contains multiple MPI calls in a basic block\n"); + } + else + { + printf(" |||++||| - Function does not contain multiple MPI calls in a basic block\n"); + } + + FOR_EACH_BB_FN(bb, fun) + { + gsi = gsi_start_bb(bb); + stmt = gsi_stmt(gsi); + printf(" |||++||| BLOCK INDEX %d : LINE %d\n", bb->index, gimple_lineno(stmt)); + + td2_q8_print_called_functions(bb); + } + + clear_all_bb_aux(fun); +} + +/******************************/ +/** TD2 - FIN QUESTION 5 & 6 **/ +/******************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN TD2 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* PLUGIN GRAPHVIZ *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/* Build a filename (as a string) based on function name */ +static char *cfgviz_generate_filename(function *fun, const char *suffix) +{ + char *target_filename; + + target_filename = (char *)xmalloc(1024 * sizeof(char)); + + snprintf(target_filename, 1024, "%s_%s_%d_%s.dot", + current_function_name(), + LOCATION_FILE(fun->function_start_locus), + LOCATION_LINE(fun->function_start_locus), + suffix); + + return target_filename; +} + +/* Dump the graphviz representation of function 'fun' in file 'out' */ +static void cfgviz_internal_dump(function *fun, FILE *out, int td) +{ + basic_block bb; + + split_block_with_multiple_mpi_calls(fun); + + // Print the header line and open the main graph + fprintf(out, "Digraph G{\n"); + + /******************************/ + /**** TD2 - QUESTION 7 ****/ + /******************************/ + + FOR_ALL_BB_FN(bb, cfun) + { + + // + // Print the basic block BB, with the MPI call if necessary + // + + fprintf(out, + "%d [label=\"BB %d\\n", + bb->index, + bb->index); + + gimple_stmt_iterator gsi; + + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + fprintf(out, "%s\\n", callee_name); + } + } + } + } + fprintf(out, "\" shape=ellipse]"); + + // + // Process output edges + // + edge_iterator eit; + edge e; + + FOR_EACH_EDGE(e, eit, bb->succs) + { + const char *label = ""; + if (e->flags == EDGE_TRUE_VALUE) + label = "true"; + else if (e->flags == EDGE_FALSE_VALUE) + label = "false"; + + fprintf(out, "%d -> %d [color=red label=\"%s\"]\n", + bb->index, e->dest->index, label); + } + } + /******************************/ + /** TD2 - FIN QUESTION 7 **/ + /******************************/ + + // Close the main graph + fprintf(out, "}\n"); +} + +void cfgviz_dump(function *fun, const char *suffix, int td) +{ + char *target_filename; + FILE *out; + + target_filename = cfgviz_generate_filename(fun, suffix); + + printf("[GRAPHVIZ] Generating CFG of function %s in file <%s>\n", + current_function_name(), target_filename); + + out = fopen(target_filename, "w"); + + cfgviz_internal_dump(fun, out, td); + + fclose(out); + free(target_filename); +} + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN PLUGIN GRAPHVIZ *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +void td2_through_the_cfg(function *fun) +{ + td2_q3_q4_print_func_name(fun); + td2_q5_q6_print_blocks(fun); +} + +/* My new pass inheriting from regular gimple pass */ +class my_pass : public gimple_opt_pass +{ +public: + my_pass(gcc::context *ctxt) + : gimple_opt_pass(my_pass_data, ctxt) + { + } + + /* opt_pass methods: */ + + my_pass *clone() + { + return new my_pass(g); + } + + /* Gate function (shall we apply this pass?) */ + bool gate(function *fun) + { + function_isol_print(fun); + printf("plugin: gate... \n"); + td2_q3_q4_print_func_name(fun); + return true; + } + + /* Execute function */ + unsigned int execute(function *fun) + { + printf("plugin: execute...\n"); + + td_isol_print(/*TD*/ 2); + + /******************************/ + /**** TD2 - QUESTION 3 à 8 ****/ + /******************************/ + + td2_through_the_cfg(fun); + + /******************************/ + /** TD2 - FIN QUESTION 3 à 8 **/ + /******************************/ + + /******************************/ + /**** TD2 - QUESTION 7 ****/ + /******************************/ + + /* Skip system header functions */ + if (!in_system_header_at(fun->function_start_locus)) + cfgviz_dump(fun, "0_ini", /*TD*/ 2); + + /******************************/ + /** TD2 - FIN QUESTION 7 **/ + /******************************/ + + return 0; + } +}; + +/* Main entry point for plugin */ +int plugin_init(struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + struct register_pass_info my_pass_info; + + printf("plugin_init: Entering...\n"); + + /* First check that the current version of GCC is the right one */ + + if (!plugin_default_version_check(version, &gcc_version)) + return 1; + + printf("plugin_init: Check ok...\n"); + + /* Declare and build my new pass */ + my_pass p(g); + + /* Fill info on my pass + (insertion after the pass building the CFG) */ + my_pass_info.pass = &p; + my_pass_info.reference_pass_name = "cfg"; + my_pass_info.ref_pass_instance_number = 0; + my_pass_info.pos_op = PASS_POS_INSERT_AFTER; + + /* Add my pass to the pass manager */ + register_callback(plugin_info->base_name, + PLUGIN_PASS_MANAGER_SETUP, + NULL, + &my_pass_info); + + printf("plugin_init: Pass added...\n"); + + return 0; +} diff --git a/TDs/TD3/CODE/test2.c b/TDs/TD3/CODE/test2.c new file mode 100644 index 0000000000000000000000000000000000000000..51841548b732b7958a99fc934546af9342945cfc --- /dev/null +++ b/TDs/TD3/CODE/test2.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +void mpi_call(int c) +{ + MPI_Barrier(MPI_COMM_WORLD); + + if (c < 10) + { + printf("je suis dans le if (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + } + else + { + printf("je suis dans le else (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + } +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + for (i = 0; i < 10; i++) + { + + mpi_call(c); + c += (a + b); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD3/CODE/test2.o b/TDs/TD3/CODE/test2.o new file mode 100644 index 0000000000000000000000000000000000000000..d8b8226982ae6276964cc97386b0371dfb492b06 Binary files /dev/null and b/TDs/TD3/CODE/test2.o differ diff --git a/TDs/TD3/td3.pdf b/TDs/TD3/td3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3cbc30cf100bbc2500da3203c6d820faa1e7670c Binary files /dev/null and b/TDs/TD3/td3.pdf differ diff --git a/TDs/TD4/CODE/MPI_collectives.def b/TDs/TD4/CODE/MPI_collectives.def new file mode 100644 index 0000000000000000000000000000000000000000..af1fcb1cf36e79be843d6d8c9b51511bc000299b --- /dev/null +++ b/TDs/TD4/CODE/MPI_collectives.def @@ -0,0 +1,6 @@ + +DEFMPICOLLECTIVES(MPI_INIT, "MPI_Init") +DEFMPICOLLECTIVES(MPI_FINALIZE, "MPI_Finalize") +DEFMPICOLLECTIVES(MPI_REDUCE, "MPI_Reduce") +DEFMPICOLLECTIVES(MPI_ALL_REDUCE, "MPI_AllReduce") +DEFMPICOLLECTIVES(MPI_BARRIER, "MPI_Barrier") diff --git a/TDs/TD4/CODE/Makefile b/TDs/TD4/CODE/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..bc83e6ba89fbe1c3fb82de965fce693dba92e8f8 --- /dev/null +++ b/TDs/TD4/CODE/Makefile @@ -0,0 +1,31 @@ +all: TP4_1.pgr + +CPP=g++_1110 +CC=gcc_1110 + +FILE=test3.c + +MPI_PATH=`dirname \` which mpicc \` ` +MPI_FLAGS=-I$(MPI_PATH)/../include/mpi -L$(MPI_PATH)/../lib -lmpi +PLUGIN_FLAGS=-I`gcc -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC + +CFLAGS=-g -O3 + + +libplugin.so: plugin_TP2_1.cpp + $(CPP) $(PLUGIN_FLAGS) -o libplugin.so $< + +%.so: plugin_%.cpp + $(CPP) $(PLUGIN_FLAGS) -o $@ $< + +%.pgr: %.so $(FILE) + gcc $(FILE) $(CFLAGS) -o $@ $(MPI_FLAGS) -fplugin=./$< + +%.pdf: %.dot + dot -Tpdf $< -o $@ + +clean: + rm -rf *.pgr *.pdf + +clean_all: clean + rm -rf libplugin.so *.dot diff --git a/TDs/TD4/CODE/graph_test.dot b/TDs/TD4/CODE/graph_test.dot new file mode 100644 index 0000000000000000000000000000000000000000..a4680c6ccc1ae5651aa2f5f4d6fb555cd11b89eb --- /dev/null +++ b/TDs/TD4/CODE/graph_test.dot @@ -0,0 +1,33 @@ +Digraph G{ +0 +0 -> 2 +2 +2 -> 10 +3 +3 -> 4 +3 -> 8 +4 +4 -> 13 +13 +13 -> 5 +13 -> 6 +5 +5 -> 9 +6 +6 -> 7 +6 -> 9 +7 +7 -> 12 +8 +8 -> 12 +9 +9 -> 10 +10 +10 -> 3 +10 -> 11 +11 +11 -> 12 +12 +12 -> 1 +1 +} diff --git a/TDs/TD4/CODE/graph_test.pdf b/TDs/TD4/CODE/graph_test.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c47764a66d5cb516423bee92522d2bf224a9e41 Binary files /dev/null and b/TDs/TD4/CODE/graph_test.pdf differ diff --git a/TDs/TD4/CODE/libplugin.so b/TDs/TD4/CODE/libplugin.so new file mode 100644 index 0000000000000000000000000000000000000000..f9e6a2840a95a758558b14dbd0c5ad701f959e35 Binary files /dev/null and b/TDs/TD4/CODE/libplugin.so differ diff --git a/TDs/TD4/CODE/main_test3.c_7_0_ini.dot b/TDs/TD4/CODE/main_test3.c_7_0_ini.dot new file mode 100644 index 0000000000000000000000000000000000000000..cc3662379296a230253c4eaf135f926d33499602 --- /dev/null +++ b/TDs/TD4/CODE/main_test3.c_7_0_ini.dot @@ -0,0 +1,19 @@ +Digraph G{ +0 [label="BB 0\n" shape=ellipse]0 -> 2 [color=red label=""] +2 [label="BB 2\nMPI_Init\n" shape=ellipse]2 -> 10 [color=red label=""] +3 [label="BB 3\nMPI_Barrier\n" shape=ellipse]3 -> 4 [color=red label="true"] +3 -> 8 [color=red label="false"] +4 [label="BB 4\nMPI_Barrier\n" shape=ellipse]4 -> 13 [color=red label=""] +13 [label="BB 13\nMPI_Barrier\n" shape=ellipse]13 -> 5 [color=red label="true"] +13 -> 6 [color=red label="false"] +5 [label="BB 5\n" shape=ellipse]5 -> 9 [color=red label=""] +6 [label="BB 6\n" shape=ellipse]6 -> 7 [color=red label="true"] +6 -> 9 [color=red label="false"] +7 [label="BB 7\n" shape=ellipse]7 -> 12 [color=red label=""] +8 [label="BB 8\nMPI_Barrier\n" shape=ellipse]8 -> 12 [color=red label=""] +9 [label="BB 9\n" shape=ellipse]9 -> 10 [color=red label=""] +10 [label="BB 10\n" shape=ellipse]10 -> 3 [color=red label="true"] +10 -> 11 [color=red label="false"] +11 [label="BB 11\nMPI_Finalize\n" shape=ellipse]11 -> 12 [color=red label=""] +12 [label="BB 12\n" shape=ellipse]12 -> 1 [color=red label=""] +1 [label="BB 1\n" shape=ellipse]} diff --git a/TDs/TD4/CODE/plugin.cpp b/TDs/TD4/CODE/plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..697c39028e92f825c35eed20b1e9efa2e2b17ea4 --- /dev/null +++ b/TDs/TD4/CODE/plugin.cpp @@ -0,0 +1,413 @@ +#include <gcc-plugin.h> +#include <plugin-version.h> +#include <tree.h> +#include <basic-block.h> +#include <gimple.h> +#include <tree-pass.h> +#include <context.h> +#include <function.h> +#include <gimple-iterator.h> +#include <dominance.h> + +#include <string.h> + +/* Global variable required for plugin to execute */ +int plugin_is_GPL_compatible; + +/* Global object (const) to represent my pass */ +const pass_data my_pass_data = + { + GIMPLE_PASS, /* type */ + "NEW_PASS", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +/* Enum to represent the collective operations */ +enum mpi_collective_code +{ +#define DEFMPICOLLECTIVES(CODE, NAME) CODE, +#include "MPI_collectives.def" + LAST_AND_UNUSED_MPI_COLLECTIVE_CODE +#undef DEFMPICOLLECTIVES +}; + +/* Name of each MPI collective operations */ +#define DEFMPICOLLECTIVES(CODE, NAME) NAME, +const char *const mpi_collective_name[] = { +#include "MPI_collectives.def" +}; +#undef DEFMPICOLLECTIVES + +enum mpi_collective_code print_if_mpi_function(gimple *stmt) +{ + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + /* + if (strncmp(callee_name, "MPI_", 4) == 0) + { + printf(" |||++||| - gimple statement is a MPI function: function called is \" %s \" \n", callee_name); + } + */ + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + printf(" |||++||| - gimple statement is a MPI collective in enum: function called is \" %s \" \n", callee_name); + return mpi_collective_code(i); + } + } + } + + return LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; +} + +void clear_all_bb_aux(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + bb->aux = NULL; + } +} + +int check_if_bb_contains_multiple_mpi_calls(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + int nb_mpi_calls = 0; + for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + nb_mpi_calls++; + if (nb_mpi_calls > 1) + { + return 1; + } + } + } + } + } + } + + return 0; +} + +void split_block_with_multiple_mpi_calls(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + gimple *old_stmt = NULL; + + for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + if (old_stmt != NULL) + { + printf(" |||++||| SPLIT !\n"); + split_block(bb, old_stmt); + } + old_stmt = stmt; + } + } + } + } + } +} + +const char * +td2_q3_q4_print_func_name(function *fun) +{ + const char *fname = function_name(fun); + printf("\t ... in function %s\n", fname); + + return fname; +} + +void td2_q8_print_called_functions(basic_block bb) +{ + gimple_stmt_iterator gsi; + + /* Iterate on gimple statements in the current basic block */ + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + enum mpi_collective_code code = print_if_mpi_function(stmt); + + bb->aux = (void *)code; + } +} + +void td4_print_dominated_blocks(basic_block bb, enum cdi_direction dir) +{ + auto_vec<basic_block> vec_d = get_all_dominated_blocks(dir, bb); + if (vec_d.length() > 1) + { + if (dir == 1) + printf(" |||++||| - Dominated blocks :"); + else + printf(" |||++||| - Post dominated blocks :"); + for (unsigned int i = 1; i < vec_d.length(); i++) + { + printf(" %d", vec_d[i]->index); + } + printf("\n"); + } +} + +void td2_q5_q6_print_blocks(function *fun) +{ + basic_block bb; + gimple_stmt_iterator gsi; + gimple *stmt; + + if (check_if_bb_contains_multiple_mpi_calls(fun) == 1) + { + printf(" |||++||| - Function contains multiple MPI calls in a basic block\n"); + } + else + { + printf(" |||++||| - Function does not contain multiple MPI calls in a basic block\n"); + } + + split_block_with_multiple_mpi_calls(fun); + + FOR_EACH_BB_FN(bb, fun) + { + gsi = gsi_start_bb(bb); + stmt = gsi_stmt(gsi); + printf(" |||++||| BLOCK INDEX %d : LINE %d\n", bb->index, gimple_lineno(stmt)); + + td4_print_dominated_blocks(bb, CDI_DOMINATORS); + td4_print_dominated_blocks(bb, CDI_POST_DOMINATORS); + + td2_q8_print_called_functions(bb); + } + + clear_all_bb_aux(fun); +} + +/* Build a filename (as a string) based on function name */ +static char *cfgviz_generate_filename(function *fun, const char *suffix) +{ + char *target_filename; + + target_filename = (char *)xmalloc(1024 * sizeof(char)); + + snprintf(target_filename, 1024, "%s_%s_%d_%s.dot", + current_function_name(), + LOCATION_FILE(fun->function_start_locus), + LOCATION_LINE(fun->function_start_locus), + suffix); + + return target_filename; +} + +/* Dump the graphviz representation of function 'fun' in file 'out' */ +static void cfgviz_internal_dump(function *fun, FILE *out, int td) +{ + basic_block bb; + + // Print the header line and open the main graph + fprintf(out, "Digraph G{\n"); + + FOR_ALL_BB_FN(bb, cfun) + { + + // + // Print the basic block BB, with the MPI call if necessary + // + + fprintf(out, + "%d [label=\"BB %d\\n", + bb->index, + bb->index); + + gimple_stmt_iterator gsi; + + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + const char *callee_name; + + callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); + + for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) + { + if (strcmp(callee_name, mpi_collective_name[i]) == 0) + { + fprintf(out, "%s\\n", callee_name); + } + } + } + } + fprintf(out, "\" shape=ellipse]"); + + // + // Process output edges + // + edge_iterator eit; + edge e; + + FOR_EACH_EDGE(e, eit, bb->succs) + { + const char *label = ""; + if (e->flags == EDGE_TRUE_VALUE) + label = "true"; + else if (e->flags == EDGE_FALSE_VALUE) + label = "false"; + + fprintf(out, "%d -> %d [color=red label=\"%s\"]\n", + bb->index, e->dest->index, label); + } + } + + // Close the main graph + fprintf(out, "}\n"); +} + +void cfgviz_dump(function *fun, const char *suffix, int td) +{ + char *target_filename; + FILE *out; + + target_filename = cfgviz_generate_filename(fun, suffix); + + printf("[GRAPHVIZ] Generating CFG of function %s in file <%s>\n", + current_function_name(), target_filename); + + out = fopen(target_filename, "w"); + + cfgviz_internal_dump(fun, out, td); + + fclose(out); + free(target_filename); +} + +void td2_through_the_cfg(function *fun) +{ + td2_q3_q4_print_func_name(fun); + td2_q5_q6_print_blocks(fun); +} + +/* My new pass inheriting from regular gimple pass */ +class my_pass : public gimple_opt_pass +{ +public: + my_pass(gcc::context *ctxt) + : gimple_opt_pass(my_pass_data, ctxt) + { + } + + /* opt_pass methods: */ + + my_pass *clone() + { + return new my_pass(g); + } + + /* Gate function (shall we apply this pass?) */ + bool gate(function *fun) + { + printf("plugin: gate... \n"); + td2_q3_q4_print_func_name(fun); + return true; + } + + /* Execute function */ + unsigned int execute(function *fun) + { + printf("plugin: execute...\n"); + + calculate_dominance_info(CDI_DOMINATORS); + calculate_dominance_info(CDI_POST_DOMINATORS); + + td2_through_the_cfg(fun); + + /* Skip system header functions */ + if (!in_system_header_at(fun->function_start_locus)) + cfgviz_dump(fun, "0_ini", /*TD*/ 4); + + free_dominance_info(CDI_DOMINATORS); + free_dominance_info(CDI_POST_DOMINATORS); + + return 0; + } +}; + +/* Main entry point for plugin */ +int plugin_init(struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + struct register_pass_info my_pass_info; + + printf("plugin_init: Entering...\n"); + + /* First check that the current version of GCC is the right one */ + + if (!plugin_default_version_check(version, &gcc_version)) + return 1; + + printf("plugin_init: Check ok...\n"); + + /* Declare and build my new pass */ + my_pass p(g); + + /* Fill info on my pass + (insertion after the pass building the CFG) */ + my_pass_info.pass = &p; + my_pass_info.reference_pass_name = "cfg"; + my_pass_info.ref_pass_instance_number = 0; + my_pass_info.pos_op = PASS_POS_INSERT_AFTER; + + /* Add my pass to the pass manager */ + register_callback(plugin_info->base_name, + PLUGIN_PASS_MANAGER_SETUP, + NULL, + &my_pass_info); + + printf("plugin_init: Pass added...\n"); + + return 0; +} diff --git a/TDs/TD4/CODE/test3.c b/TDs/TD4/CODE/test3.c new file mode 100644 index 0000000000000000000000000000000000000000..4e760ac22352902d857f35ff28bf9ed907ea6d99 --- /dev/null +++ b/TDs/TD4/CODE/test3.c @@ -0,0 +1,52 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + for (i = 0; i < 10; i++) + { + + MPI_Barrier(MPI_COMM_WORLD); + + if (c < 10) + { + printf("je suis dans le if (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + if (c < 5) + { + a = a * a + 1; + } + else + { + c = c * 3; + if (c < 20) + { + return c; + } + } + } + else + { + printf("je suis dans le else (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + return 1; + } + c += (a + b); + printf("fin du for\n"); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD4/CODE/test3.o b/TDs/TD4/CODE/test3.o new file mode 100644 index 0000000000000000000000000000000000000000..2d70111caf3f876bf032331eb17e64dc64aa0dac Binary files /dev/null and b/TDs/TD4/CODE/test3.o differ diff --git a/TDs/TD4/q1.txt b/TDs/TD4/q1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5f4bc0961bbae97725c0eb802f86382fd55a08c --- /dev/null +++ b/TDs/TD4/q1.txt @@ -0,0 +1,14 @@ + 0 : + 1 : 0, 2, 10, 12 + 2 : 0 + 3 : 0, 2, 10 + 4 : 0, 2, 3, 10 + 5 : 0, 2, 3, 4, 10, 13 + 6 : 0, 2, 3, 4, 10, 13 + 7 : 0, 2, 3, 4, 6, 10, 13 + 8 : 0, 2, 3, 10 + 9 : 0, 2, 3, 4, 10, 13 +10 : 0, 2 +11 : 0, 2, 10 +12 : 0, 2, 10 +13 : 0, 2, 3, 4, 10 \ No newline at end of file diff --git a/TDs/TD4/q2.txt b/TDs/TD4/q2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d80e4c3e0b19a85b96e56e75a70e53ec0b049f8 --- /dev/null +++ b/TDs/TD4/q2.txt @@ -0,0 +1,14 @@ + 0 : 1, 2, 10, 12 + 1 : + 2 : 1, 10, 12 + 3 : 1, 12 + 4 : 1, 12, 13 + 5 : 1, 9, 10, 12 + 6 : 1, 12 + 7 : 1, 12 + 8 : 1, 12 + 9 : 1, 10, 12 +10 : 1, 12 +11 : 1, 12 +12 : 1 +13 : 1, 12 \ No newline at end of file diff --git a/TDs/TD4/q3.txt b/TDs/TD4/q3.txt new file mode 100644 index 0000000000000000000000000000000000000000..787ad2a0ab5e1e046d25542cd42ccc61ce44b86d --- /dev/null +++ b/TDs/TD4/q3.txt @@ -0,0 +1,14 @@ + 0 : + 1 : + 2 : + 3 : 10, 12 + 4 : + 5 : + 6 : + 7 : + 8 : + 9 : +10 : +11 : +12 : +13 : \ No newline at end of file diff --git a/TDs/TD4/td4.pdf b/TDs/TD4/td4.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8ee1aab3f641c63da79dae352dc3b3f8e3864df7 Binary files /dev/null and b/TDs/TD4/td4.pdf differ diff --git a/TDs/TD5/CODE/MPI_collectives.def b/TDs/TD5/CODE/MPI_collectives.def new file mode 100644 index 0000000000000000000000000000000000000000..af1fcb1cf36e79be843d6d8c9b51511bc000299b --- /dev/null +++ b/TDs/TD5/CODE/MPI_collectives.def @@ -0,0 +1,6 @@ + +DEFMPICOLLECTIVES(MPI_INIT, "MPI_Init") +DEFMPICOLLECTIVES(MPI_FINALIZE, "MPI_Finalize") +DEFMPICOLLECTIVES(MPI_REDUCE, "MPI_Reduce") +DEFMPICOLLECTIVES(MPI_ALL_REDUCE, "MPI_AllReduce") +DEFMPICOLLECTIVES(MPI_BARRIER, "MPI_Barrier") diff --git a/TDs/TD5/CODE/libplugin.so b/TDs/TD5/CODE/libplugin.so new file mode 100644 index 0000000000000000000000000000000000000000..c564767dd2b319a2a8b5d15da96959e04f8845aa Binary files /dev/null and b/TDs/TD5/CODE/libplugin.so differ diff --git a/TDs/TD5/CODE/main_test2.c_7_0_ini.dot b/TDs/TD5/CODE/main_test2.c_7_0_ini.dot new file mode 100644 index 0000000000000000000000000000000000000000..f2c419a55fc5bfaf01fd18d1cc12ccbf1d52469f --- /dev/null +++ b/TDs/TD5/CODE/main_test2.c_7_0_ini.dot @@ -0,0 +1,23 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2" shape=ellipse] +2 -> 3 [color=red label="true"] +2 -> 7 [color=red label="false"] +3 [label="BB 3" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 5 [color=red label="false"] +4 [label="BB 4" shape=ellipse] +4 -> 6 [color=red label=""] +5 [label="BB 5" shape=ellipse] +5 -> 6 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 8 [color=red label=""] +7 [label="BB 7" shape=ellipse] +7 -> 8 [color=red label=""] +8 [label="BB 8" shape=ellipse] +8 -> 9 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/main_test2.c_7_1_mpi.dot b/TDs/TD5/CODE/main_test2.c_7_1_mpi.dot new file mode 100644 index 0000000000000000000000000000000000000000..ce905b4c88e15a9ce5a9b1369fead95385fbf9a8 --- /dev/null +++ b/TDs/TD5/CODE/main_test2.c_7_1_mpi.dot @@ -0,0 +1,23 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2 \n MPI_Init" shape=ellipse] +2 -> 3 [color=red label="true"] +2 -> 7 [color=red label="false"] +3 [label="BB 3" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 5 [color=red label="false"] +4 [label="BB 4" shape=ellipse] +4 -> 6 [color=red label=""] +5 [label="BB 5 \n MPI_Barrier" shape=ellipse] +5 -> 6 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 8 [color=red label=""] +7 [label="BB 7 \n MPI_Barrier" shape=ellipse] +7 -> 8 [color=red label=""] +8 [label="BB 8 \n MPI_Finalize" shape=ellipse] +8 -> 9 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/main_test2.c_7_2_split.dot b/TDs/TD5/CODE/main_test2.c_7_2_split.dot new file mode 100644 index 0000000000000000000000000000000000000000..ce905b4c88e15a9ce5a9b1369fead95385fbf9a8 --- /dev/null +++ b/TDs/TD5/CODE/main_test2.c_7_2_split.dot @@ -0,0 +1,23 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2 \n MPI_Init" shape=ellipse] +2 -> 3 [color=red label="true"] +2 -> 7 [color=red label="false"] +3 [label="BB 3" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 5 [color=red label="false"] +4 [label="BB 4" shape=ellipse] +4 -> 6 [color=red label=""] +5 [label="BB 5 \n MPI_Barrier" shape=ellipse] +5 -> 6 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 8 [color=red label=""] +7 [label="BB 7 \n MPI_Barrier" shape=ellipse] +7 -> 8 [color=red label=""] +8 [label="BB 8 \n MPI_Finalize" shape=ellipse] +8 -> 9 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/main_test3.c_7_0_ini.dot b/TDs/TD5/CODE/main_test3.c_7_0_ini.dot new file mode 100644 index 0000000000000000000000000000000000000000..954a416a88482a3b9514d430fcc7e5e2dec171e2 --- /dev/null +++ b/TDs/TD5/CODE/main_test3.c_7_0_ini.dot @@ -0,0 +1,31 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2" shape=ellipse] +2 -> 10 [color=red label=""] +3 [label="BB 3" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 8 [color=red label="false"] +4 [label="BB 4" shape=ellipse] +4 -> 5 [color=red label="true"] +4 -> 6 [color=red label="false"] +5 [label="BB 5" shape=ellipse] +5 -> 9 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 7 [color=red label="true"] +6 -> 9 [color=red label="false"] +7 [label="BB 7" shape=ellipse] +7 -> 12 [color=red label=""] +8 [label="BB 8" shape=ellipse] +8 -> 12 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 10 [color=red label=""] +10 [label="BB 10" shape=ellipse] +10 -> 3 [color=red label="true"] +10 -> 11 [color=red label="false"] +11 [label="BB 11" shape=ellipse] +11 -> 12 [color=red label=""] +12 [label="BB 12" shape=ellipse] +12 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/main_test3.c_7_1_mpi.dot b/TDs/TD5/CODE/main_test3.c_7_1_mpi.dot new file mode 100644 index 0000000000000000000000000000000000000000..e400605a7115da682d9ccbcb3708f8802068e56b --- /dev/null +++ b/TDs/TD5/CODE/main_test3.c_7_1_mpi.dot @@ -0,0 +1,31 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2 \n MPI_Init" shape=ellipse] +2 -> 10 [color=red label=""] +3 [label="BB 3 \n MPI_Barrier" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 8 [color=red label="false"] +4 [label="BB 4 \n MPI_Barrier \n MPI_Barrier" shape=ellipse] +4 -> 5 [color=red label="true"] +4 -> 6 [color=red label="false"] +5 [label="BB 5" shape=ellipse] +5 -> 9 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 7 [color=red label="true"] +6 -> 9 [color=red label="false"] +7 [label="BB 7" shape=ellipse] +7 -> 12 [color=red label=""] +8 [label="BB 8 \n MPI_Barrier" shape=ellipse] +8 -> 12 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 10 [color=red label=""] +10 [label="BB 10" shape=ellipse] +10 -> 3 [color=red label="true"] +10 -> 11 [color=red label="false"] +11 [label="BB 11 \n MPI_Finalize" shape=ellipse] +11 -> 12 [color=red label=""] +12 [label="BB 12" shape=ellipse] +12 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/main_test3.c_7_2_split.dot b/TDs/TD5/CODE/main_test3.c_7_2_split.dot new file mode 100644 index 0000000000000000000000000000000000000000..a6118edb8efd63d18c6628f2d0d1dd525d20682e --- /dev/null +++ b/TDs/TD5/CODE/main_test3.c_7_2_split.dot @@ -0,0 +1,33 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2 \n MPI_Init" shape=ellipse] +2 -> 10 [color=red label=""] +3 [label="BB 3 \n MPI_Barrier" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 8 [color=red label="false"] +4 [label="BB 4 \n MPI_Barrier" shape=ellipse] +4 -> 13 [color=red label=""] +13 [label="BB 13 \n MPI_Barrier" shape=ellipse] +13 -> 5 [color=red label="true"] +13 -> 6 [color=red label="false"] +5 [label="BB 5" shape=ellipse] +5 -> 9 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 7 [color=red label="true"] +6 -> 9 [color=red label="false"] +7 [label="BB 7" shape=ellipse] +7 -> 12 [color=red label=""] +8 [label="BB 8 \n MPI_Barrier" shape=ellipse] +8 -> 12 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 10 [color=red label=""] +10 [label="BB 10" shape=ellipse] +10 -> 3 [color=red label="true"] +10 -> 11 [color=red label="false"] +11 [label="BB 11 \n MPI_Finalize" shape=ellipse] +11 -> 12 [color=red label=""] +12 [label="BB 12" shape=ellipse] +12 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/main_test3.c_7_3_clear.dot b/TDs/TD5/CODE/main_test3.c_7_3_clear.dot new file mode 100644 index 0000000000000000000000000000000000000000..68b17c44d46b5e07a8caf4181067aab63eb27b5c --- /dev/null +++ b/TDs/TD5/CODE/main_test3.c_7_3_clear.dot @@ -0,0 +1,33 @@ +Digraph G{ +0 [label="BB 0" shape=ellipse] +0 -> 2 [color=red label=""] +2 [label="BB 2" shape=ellipse] +2 -> 10 [color=red label=""] +3 [label="BB 3" shape=ellipse] +3 -> 4 [color=red label="true"] +3 -> 8 [color=red label="false"] +4 [label="BB 4" shape=ellipse] +4 -> 13 [color=red label=""] +13 [label="BB 13" shape=ellipse] +13 -> 5 [color=red label="true"] +13 -> 6 [color=red label="false"] +5 [label="BB 5" shape=ellipse] +5 -> 9 [color=red label=""] +6 [label="BB 6" shape=ellipse] +6 -> 7 [color=red label="true"] +6 -> 9 [color=red label="false"] +7 [label="BB 7" shape=ellipse] +7 -> 12 [color=red label=""] +8 [label="BB 8" shape=ellipse] +8 -> 12 [color=red label=""] +9 [label="BB 9" shape=ellipse] +9 -> 10 [color=red label=""] +10 [label="BB 10" shape=ellipse] +10 -> 3 [color=red label="true"] +10 -> 11 [color=red label="false"] +11 [label="BB 11" shape=ellipse] +11 -> 12 [color=red label=""] +12 [label="BB 12" shape=ellipse] +12 -> 1 [color=red label=""] +1 [label="BB 1" shape=ellipse] +} diff --git a/TDs/TD5/CODE/plugin_TP5_1.cpp b/TDs/TD5/CODE/plugin_TP5_1.cpp new file mode 100644 index 0000000000000000000000000000000000000000..31653f9052eebde89ad370e140958bfc200f896e --- /dev/null +++ b/TDs/TD5/CODE/plugin_TP5_1.cpp @@ -0,0 +1,1097 @@ +#include <gcc-plugin.h> +#include <plugin-version.h> +#include <tree.h> +#include <basic-block.h> +#include <gimple.h> +#include <tree-pass.h> +#include <context.h> +#include <function.h> +#include <gimple-iterator.h> +#include <bitmap.h> + +#include <queue> + +/* Global variable required for plugin to execute */ +int plugin_is_GPL_compatible; + +/* Global object (const) to represent my pass */ +const pass_data my_pass_data = + { + GIMPLE_PASS, /* type */ + "NEW_PASS", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_OPTIMIZE, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +/* Enum to represent the collective operations */ +enum mpi_collective_code +{ +#define DEFMPICOLLECTIVES(CODE, NAME) CODE, +#include "MPI_collectives.def" + LAST_AND_UNUSED_MPI_COLLECTIVE_CODE +#undef DEFMPICOLLECTIVES +}; + +/* Name of each MPI collective operations */ +#define DEFMPICOLLECTIVES(CODE, NAME) NAME, +const char *const mpi_collective_name[] = { +#include "MPI_collectives.def" +}; +#undef DEFMPICOLLECTIVES + +void td_isol_print(int td) +{ + printf("\n\n\n"); + printf("/****************************************************************************************************/\n"); + printf("/****************************************************************************************************/\n"); + printf("/************************* TD%d *************************/\n", td); + printf("/****************************************************************************************************/\n"); + printf("/****************************************************************************************************/\n"); + printf("\n\n\n"); +} + +void function_isol_print(function *fun) +{ + printf("\n\n\n"); + printf("/************************************************************************************************************************/\n"); + printf("/************************************************************************************************************************/\n"); + printf("/*********************************** %s ***********************************/\n", function_name(fun)); + printf("/************************************************************************************************************************/\n"); + printf("/************************************************************************************************************************/\n"); + printf("\n\n\n"); +} + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* TD2 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/******************************/ +/**** TD2 - QUESTION 3 & 4 ****/ +/******************************/ + +const char *td2_q3_q4_print_func_name(function *fun) +{ + // const char * fname = fndecl_name(fun->decl); + const char *fname = function_name(fun); + // const char * fname = current_function_name(); + printf("\t ... in function %s\n", fname); + + return fname; +} + +/******************************/ +/** TD2 - FIN QUESTION 3 & 4 **/ +/******************************/ + +/******************************/ +/**** TD2 - QUESTION 8 ****/ +/******************************/ + +void td2_q8_print_called_functions(basic_block bb) +{ + gimple_stmt_iterator gsi; + + /* Iterate on gimple statements in the current basic block */ + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + /* Get the current statement */ + gimple *stmt = gsi_stmt(gsi); + + if (is_gimple_call(stmt)) + { + tree t; + const char *callee_name; + + t = gimple_call_fndecl(stmt); + callee_name = IDENTIFIER_POINTER(DECL_NAME(t)); + + printf(" |||++||| - gimple statement is a function call: function called is \" %s \" \n", callee_name); + } + } +} +/******************************/ +/** TD2 - FIN QUESTION 8 **/ +/******************************/ + +/******************************/ +/**** TD2 - QUESTION 5 & 6 ****/ +/******************************/ + +void td2_q5_q6_print_blocks(function *fun) +{ + basic_block bb; + gimple_stmt_iterator gsi; + gimple *stmt; + + FOR_EACH_BB_FN(bb, fun) + { + gsi = gsi_start_bb(bb); + stmt = gsi_stmt(gsi); + printf(" |||++||| BLOCK INDEX %d : LINE %d\n", bb->index, gimple_lineno(stmt)); + + td2_q8_print_called_functions(bb); + } +} + +/******************************/ +/** TD2 - FIN QUESTION 5 & 6 **/ +/******************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN TD2 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* TD3 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/******************************/ +/**** TD3 - QUESTION 1 à 3 ****/ +/******************************/ + +enum mpi_collective_code td3_q1_q2_q3_is_mpi_call(gimple *stmt, int bb_index) +{ + enum mpi_collective_code returned_code; + + returned_code = LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; + + if (is_gimple_call(stmt)) + { + tree t; + const char *callee_name; + int i; + bool found = false; + + t = gimple_call_fndecl(stmt); + callee_name = IDENTIFIER_POINTER(DECL_NAME(t)); + + i = 0; + while (!found && i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + if (strncmp(callee_name, mpi_collective_name[i], strlen(mpi_collective_name[i])) == 0) + { + found = true; + returned_code = (enum mpi_collective_code)i; + } + i++; + } + } + + if (returned_code != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + printf(" --> |||++||| BB %d [MPI CALL] Found call to %s\n", bb_index, mpi_collective_name[returned_code]); + } + + return returned_code; +} + +/******************************/ +/** TD3 - FIN QUESTION 1 à 3 **/ +/******************************/ + +/******************************/ +/**** TD3 - QUESTION 5 ****/ +/******************************/ + +void clean_aux_field(function *fun, long val) +{ + basic_block bb; + + /* Traverse all BBs to clean 'aux' field */ + FOR_ALL_BB_FN(bb, fun) + { + bb->aux = (void *)val; + } +} +/******************************/ +/** TD3 - FIN QUESTION 5 **/ +/******************************/ + +void td3_q1_q2_q3_q4_read_and_mark_mpi(function *fun) +{ + basic_block bb; + gimple_stmt_iterator gsi; + gimple *stmt; + + FOR_EACH_BB_FN(bb, fun) + { + + /* Iterate on gimple statements in the current basic block */ + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + + /******************************/ + /** TD3 - QUESTION 1 à 4 **/ + /******************************/ + stmt = gsi_stmt(gsi); + + enum mpi_collective_code c; + c = td3_q1_q2_q3_is_mpi_call(stmt, bb->index); + if (bb->aux == (void *)LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + bb->aux = (void *)c; + } + + /******************************/ + /** TD3 - FIN QUESTION 1 à 4 **/ + /******************************/ + } + } +} + +/******************************/ +/**** TD3 - QUESTION 7 ****/ +/******************************/ + +int td3_q7_get_nb_mpi_calls_in_bb(basic_block bb) +{ + gimple_stmt_iterator gsi; + int nb_mpi_coll = 0; + + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + + enum mpi_collective_code c; + c = td3_q1_q2_q3_is_mpi_call(stmt, bb->index); + + if (c != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + nb_mpi_coll++; + } + } + + printf(" == BB %d == contains %d MPI collective(s)\n", + bb->index, nb_mpi_coll); + + return nb_mpi_coll; +} + +bool td3_q7_check_multiple_mpi_calls_per_bb(function *fun) +{ + basic_block bb; + bool is_multiple_mpi_coll = false; + int nb_mpi_coll_in_bb = 0; + FOR_EACH_BB_FN(bb, fun) + { + nb_mpi_coll_in_bb = td3_q7_get_nb_mpi_calls_in_bb(bb); + if (nb_mpi_coll_in_bb > 1) + { + is_multiple_mpi_coll = true; + } + } + + return is_multiple_mpi_coll; +} + +/******************************/ +/** TD3 - FIN QUESTION 7 **/ +/******************************/ + +/******************************/ +/**** TD3 - QUESTION 8 ****/ +/******************************/ + +void td3_q8_split_multiple_mpi_calls(function *fun) +{ + basic_block bb; + + FOR_EACH_BB_FN(bb, fun) + { + int n = td3_q7_get_nb_mpi_calls_in_bb(bb); + + if (n > 1) + { + gimple_stmt_iterator gsi; + + printf("[SPLIT] Need to split BB %d (%d collectives)\n", + bb->index, n); + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + enum mpi_collective_code c; + + c = td3_q1_q2_q3_is_mpi_call(stmt, bb->index); + + if (c != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + split_block(bb, stmt); + } + } + } + } +} + +/******************************/ +/** TD3 - FIN QUESTION 8 **/ +/******************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN TD3 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* TD4 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/******************************/ +/**** TD4 - QUESTION 5 ****/ +/******************************/ + +void td4_q5_q6_print_dominators(function *fun) +{ + printf("DOMINATORS:\n"); + + basic_block bb; + FOR_ALL_BB_FN(bb, fun) + { + vec<basic_block> dominators; + // dominators = get_dominated_by(CDI_DOMINATORS, bb); + dominators = get_all_dominated_blocks(CDI_DOMINATORS, bb); + + printf("Basic block BB %d dominates :", bb->index); + + int i; + int size = dominators.length(); + + for (i = 0; i < size; i++) + { + /******************************/ + /**** TD4 - QUESTION 6 ****/ + /******************************/ + if (dominators[i]->index != bb->index) + { + + printf(" { BB %d }", dominators[i]->index); + } + /******************************/ + /** TD4 - FIN QUESTION 6 **/ + /******************************/ + } + printf("\n"); + } +} + +/******************************/ +/** TD4 - FIN QUESTION 5 **/ +/******************************/ + +/******************************/ +/**** TD4 - QUESTION 7 ****/ +/******************************/ + +void td4_q7_print_postdominators(function *fun) +{ + printf("POST-DOMINATORS:\n"); + + basic_block bb; + FOR_ALL_BB_FN(bb, fun) + { + vec<basic_block> postdoms; + postdoms = get_all_dominated_blocks(CDI_POST_DOMINATORS, bb); + + printf("Basic block BB %d dominates :", bb->index); + + int i; + int size = postdoms.length(); + + for (i = 0; i < size; i++) + { + if (postdoms[i]->index != bb->index) + { + + printf(" { BB %d }", postdoms[i]->index); + } + } + printf("\n"); + } +} + +/******************************/ +/** TD4 - FIN QUESTION 7 **/ +/******************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN TD4 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* TD5 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN TD5 *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* PLUGIN GRAPHVIZ *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +/* Build a filename (as a string) based on function name */ +static char *cfgviz_generate_filename(function *fun, const char *suffix) +{ + char *target_filename; + + target_filename = (char *)xmalloc(1024 * sizeof(char)); + + snprintf(target_filename, 1024, "%s_%s_%d_%s.dot", + current_function_name(), + LOCATION_FILE(fun->function_start_locus), + LOCATION_LINE(fun->function_start_locus), + suffix); + + return target_filename; +} + +/* Dump the graphviz representation of function 'fun' in file 'out' */ +static void cfgviz_internal_dump(function *fun, FILE *out, int td) +{ + basic_block bb; + + // Print the header line and open the main graph + fprintf(out, "Digraph G{\n"); + + /******************************/ + /**** TD2 - QUESTION 7 ****/ + /******************************/ + + FOR_ALL_BB_FN(bb, cfun) + { + + // + // Print the basic block BB, with the MPI call if necessary + // + + /******************************/ + /**** TD3 - QUESTION 6 ****/ + /******************************/ + + if (td == 3 && (long)bb->aux != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + fprintf(out, + "%d [label=\"BB %d", bb->index, bb->index); + + gimple_stmt_iterator gsi; + gimple *stmt; + gsi = gsi_start_bb(bb); + stmt = gsi_stmt(gsi); + + /* Iterate on gimple statements in the current basic block */ + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + + stmt = gsi_stmt(gsi); + + enum mpi_collective_code returned_code; + + returned_code = LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; + + if (is_gimple_call(stmt)) + { + tree t; + const char *callee_name; + int i; + bool found = false; + + t = gimple_call_fndecl(stmt); + callee_name = IDENTIFIER_POINTER(DECL_NAME(t)); + + i = 0; + while (!found && i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + if (strncmp(callee_name, mpi_collective_name[i], strlen(mpi_collective_name[i])) == 0) + { + found = true; + returned_code = (enum mpi_collective_code)i; + } + i++; + } + } + + if (returned_code != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + fprintf(out, " \\n %s", mpi_collective_name[returned_code]); + } + } + + fprintf(out, "\" shape=ellipse]\n"); + } + /******************************/ + /**** TD3 - FIN QUESTION 6 ****/ + /******************************/ + else + { + fprintf(out, + "%d [label=\"BB %d\" shape=ellipse]\n", + bb->index, + bb->index); + } + + // + // Process output edges + // + edge_iterator eit; + edge e; + + FOR_EACH_EDGE(e, eit, bb->succs) + { + const char *label = ""; + if (e->flags == EDGE_TRUE_VALUE) + label = "true"; + else if (e->flags == EDGE_FALSE_VALUE) + label = "false"; + + fprintf(out, "%d -> %d [color=red label=\"%s\"]\n", + bb->index, e->dest->index, label); + } + } + /******************************/ + /** TD2 - FIN QUESTION 7 **/ + /******************************/ + + // Close the main graph + fprintf(out, "}\n"); +} + +void cfgviz_dump(function *fun, const char *suffix, int td) +{ + char *target_filename; + FILE *out; + + target_filename = cfgviz_generate_filename(fun, suffix); + + printf("[GRAPHVIZ] Generating CFG of function %s in file <%s>\n", + current_function_name(), target_filename); + + out = fopen(target_filename, "w"); + + cfgviz_internal_dump(fun, out, td); + + fclose(out); + free(target_filename); +} + +/****************************************************************************************************/ +/****************************************************************************************************/ +/************************* FIN PLUGIN GRAPHVIZ *************************/ +/****************************************************************************************************/ +/****************************************************************************************************/ + +void td2_through_the_cfg(function *fun) +{ + td2_q3_q4_print_func_name(fun); + td2_q5_q6_print_blocks(fun); +} + +void td3_mpi_in_blocks(function *fun) +{ + bool do_splitting = false; + + td3_q1_q2_q3_q4_read_and_mark_mpi(fun); + cfgviz_dump(fun, "1_mpi", /*TD*/ 3); + do_splitting = td3_q7_check_multiple_mpi_calls_per_bb(fun); + + /******************************/ + /**** TD3 - QUESTION 8 ****/ + /******************************/ + + if (do_splitting) + { + td3_q8_split_multiple_mpi_calls(fun); + } + + clean_aux_field(fun, LAST_AND_UNUSED_MPI_COLLECTIVE_CODE); + td3_q1_q2_q3_q4_read_and_mark_mpi(fun); + cfgviz_dump(fun, "2_split", /*TD*/ 3); + + /******************************/ + /** TD3 - FIN QUESTION 8 **/ + /******************************/ +} + +void compute_postdominance_frontiers(bitmap_head *frontiers) +{ + edge p; + edge_iterator ei; + basic_block b; + FOR_EACH_BB_FN(b, cfun) + { + if (EDGE_COUNT(b->succs) >= 2) + { + basic_block domsb = get_immediate_dominator(CDI_POST_DOMINATORS, b); + FOR_EACH_EDGE(p, ei, b->succs) + { + basic_block runner = p->dest; + if (runner == EXIT_BLOCK_PTR_FOR_FN(cfun)) + continue; + + while (runner != domsb) + { + if (!bitmap_set_bit(&frontiers[runner->index], b->index)) + break; + runner = get_immediate_dominator(CDI_POST_DOMINATORS, runner); + } + } + } + } +} + +void td4_q8_compute_post_dominance_frontiers(function *fun) +{ + basic_block bb; + bitmap_head *frontiers; + + frontiers = XNEWVEC(bitmap_head, last_basic_block_for_fn(fun)); + FOR_ALL_BB_FN(bb, fun) + { + bitmap_initialize(&frontiers[bb->index], &bitmap_default_obstack); + } + + compute_postdominance_frontiers(frontiers); + + FOR_ALL_BB_FN(bb, fun) + { + printf("BB %d", bb->index); + bitmap_print(stdout, &frontiers[bb->index], " post-dominance frontier : ", "\n"); + bitmap_clear(&frontiers[bb->index]); + } + free(frontiers); +} + +void td4_dom_and_postdom(function *fun) +{ + /******************************/ + /**** TD4 - QUESTION 5 & 6 ****/ + /******************************/ + calculate_dominance_info(CDI_DOMINATORS); + td4_q5_q6_print_dominators(fun); + /******************************/ + /** TD4 - FIN QUESTION 5 & 6 **/ + /******************************/ + + /******************************/ + /**** TD4 - QUESTION 7 ****/ + /******************************/ + calculate_dominance_info(CDI_POST_DOMINATORS); + td4_q7_print_postdominators(fun); + /******************************/ + /** TD4 - FIN QUESTION 7 **/ + /******************************/ + + // td4_q8_print_dfs(fun); + td4_q8_compute_post_dominance_frontiers(fun); +} + +bitmap get_set_post_dominance(bitmap_head *set, function *fun, bitmap_head *pd) +{ + bitmap_initialize(pd, &bitmap_default_obstack); + + basic_block bb; + FOR_ALL_BB_FN(bb, fun) + { + if (bitmap_bit_p(set, bb->index)) + { + auto_vec<basic_block> pd_blocks = get_all_dominated_blocks(CDI_POST_DOMINATORS, bb); + for (unsigned int i = 0; i < pd_blocks.length(); i++) + { + bitmap_set_bit(pd, pd_blocks[i]->index); + } + } + } + + FOR_ALL_BB_FN(bb, fun) + { + edge e; + edge_iterator ei; + int total = 0; + int succ_n = 0; + FOR_EACH_EDGE(e, ei, bb->succs) + { + basic_block succ = e->dest; + if (bitmap_bit_p(pd, succ->index)) + succ_n++; + + total++; + } + if (total > 0 && succ_n == total) + bitmap_set_bit(pd, bb->index); + } + + return pd; +} + +bitmap get_set_post_dominance_frontier(bitmap_head *set, function *fun, bitmap_head *pd) +{ + bitmap_head pd2; + bitmap_initialize(pd, &bitmap_default_obstack); + get_set_post_dominance(set, fun, &pd2); + + basic_block bb; + FOR_ALL_BB_FN(bb, fun) + { + edge e; + edge_iterator ei; + FOR_EACH_EDGE(e, ei, bb->succs) + { + basic_block succ = e->dest; + if (bitmap_bit_p(&pd2, succ->index) && !bitmap_bit_p(&pd2, bb->index)) + { + bitmap_set_bit(pd, bb->index); + } + } + } + + return pd; +} + +void td5_bitmap_and_pdf_it(function *fun) +{ + bitmap_head *new_cfg_edges = XNEWVEC(bitmap_head, n_basic_blocks_for_fn(fun)); + basic_block src = ENTRY_BLOCK_PTR_FOR_FN(fun); + bitmap *visited_blocks; + visited_blocks = XNEWVEC(bitmap, n_basic_blocks_for_fn(fun)); + edge e; + basic_block bb; + + /* Initialize the new CFG edges bitmap */ + FOR_EACH_BB_FN(bb, fun) + { + bitmap_initialize(&new_cfg_edges[bb->index], &bitmap_default_obstack); + } + + /* Initialize the visited blocks bitmap */ + bitmap_initialize(*visited_blocks, &bitmap_default_obstack); + bitmap_set_bit(*visited_blocks, src->index); + + /* Perform a breadth-first search starting from the source block */ + std::queue<basic_block> q; + q.push(src); + edge_iterator ei; + printf("efzefeff"); + while (!q.empty()) + { + basic_block bb = q.front(); + q.pop(); + + /* Add outgoing edges whose destination block has not been visited yet */ + FOR_EACH_EDGE(e, ei, bb->succs) + { + basic_block succ = e->dest; + + if (!bitmap_bit_p(*visited_blocks, succ->index)) + { + printf("%d -> %d\n", bb->index, succ->index); + bitmap_set_bit(&new_cfg_edges[bb->index], succ->index); + bitmap_set_bit(*visited_blocks, succ->index); + q.push(succ); + } + } + } + + /* Clear the visited blocks bitmap */ + bitmap_clear(*visited_blocks); + + FOR_ALL_BB_FN(bb, fun) + { + printf("BB %d", bb->index); + bitmap_print(stdout, &new_cfg_edges[bb->index], " -> arcs sortants : ", "\n"); + } + + struct super_bb + { + basic_block bb; + int rank; + }; + + std::queue<super_bb> qsbb; + super_bb sbb; + sbb.bb = src; + sbb.rank = 0; + qsbb.push(sbb); + + int calls[n_basic_blocks_for_fn(fun)]; + int ranks[n_basic_blocks_for_fn(fun)]; + + while (!qsbb.empty()) + { + super_bb sbb = qsbb.front(); + qsbb.pop(); + + gimple_stmt_iterator gsi; + enum mpi_collective_code c = LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; + + for (gsi = gsi_start_bb(sbb.bb); !gsi_end_p(gsi); gsi_next(&gsi)) + { + gimple *stmt = gsi_stmt(gsi); + c = td3_q1_q2_q3_is_mpi_call(stmt, sbb.bb->index); + if (c != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + break; + } + + calls[sbb.bb->index] = c; + if (c != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + ranks[sbb.bb->index] = sbb.rank + 1; + } + else + { + ranks[sbb.bb->index] = sbb.rank; + } + + FOR_ALL_BB_FN(bb, fun) + { + if (bitmap_bit_p(&new_cfg_edges[sbb.bb->index], bb->index)) + { + super_bb sbb2; + sbb2.bb = bb; + sbb2.rank = ranks[sbb.bb->index]; + qsbb.push(sbb2); + } + } + } + + FOR_ALL_BB_FN(bb, fun) + { + if (calls[bb->index] != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + printf("BB %d", bb->index); + printf(" -> appel %s", mpi_collective_name[calls[bb->index]]); + printf(" -> rang : %d \n", ranks[bb->index]); + } + } + + // suite + + int max_rank = 0; + for (int i = 0; i < n_basic_blocks_for_fn(fun); i++) + { + if (ranks[i] > max_rank) + { + max_rank = ranks[i]; + } + } + + bitmap_head **sets = XNEWVEC(bitmap_head *, max_rank); + + for (int i = 0; i < max_rank; i++) + { + sets[i] = XNEWVEC(bitmap_head, LAST_AND_UNUSED_MPI_COLLECTIVE_CODE); + for (unsigned int j = 0; j < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; j++) + { + bitmap_initialize(&sets[i][j], &bitmap_default_obstack); + } + } + + FOR_ALL_BB_FN(bb, fun) + { + if (calls[bb->index] != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) + { + bitmap_set_bit(&sets[ranks[bb->index] - 1][calls[bb->index]], bb->index); + } + } + + printf("Ensembles :\n"); + for (int i = 0; i < max_rank; i++) + { + for (unsigned int j = 0; j < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; j++) + { + printf("Rang %d - Appel %s : ", i + 1, mpi_collective_name[j]); + bitmap_print(stdout, &sets[i][j], "", "\n"); + } + } + + // Suite + printf("---\n"); + + for (int i = 0; i < max_rank; i++) + { + for (unsigned int j = 0; j < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; j++) + { + printf("Rang %d - Appel %s -", i + 1, mpi_collective_name[j]); + bitmap_head pd; + get_set_post_dominance(&sets[i][j], fun, &pd); + bitmap_print(stdout, &pd, " Post-dominance : ", "\n"); + } + } + + printf("---\n"); + + for (int i = 0; i < max_rank; i++) + { + for (unsigned int j = 0; j < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; j++) + { + printf("Rang %d - Appel %s -", i + 1, mpi_collective_name[j]); + bitmap_head pd; + get_set_post_dominance_frontier(&sets[i][j], fun, &pd); + bitmap_print(stdout, &pd, " Post-dominance frontier : ", "\n"); + } + } +} + +/* My new pass inheriting from regular gimple pass */ +class my_pass : public gimple_opt_pass +{ +public: + my_pass(gcc::context *ctxt) + : gimple_opt_pass(my_pass_data, ctxt) + { + } + + /* opt_pass methods: */ + + my_pass *clone() + { + return new my_pass(g); + } + + /* Gate function (shall we apply this pass?) */ + bool gate(function *fun) + { + function_isol_print(fun); + printf("plugin: gate... \n"); + td2_q3_q4_print_func_name(fun); + return true; + } + + /* Execute function */ + unsigned int execute(function *fun) + { + printf("plugin: execute...\n"); + + td_isol_print(/*TD*/ 2); + + /******************************/ + /**** TD2 - QUESTION 3 à 8 ****/ + /******************************/ + + td2_through_the_cfg(fun); + + /******************************/ + /** TD2 - FIN QUESTION 3 à 8 **/ + /******************************/ + + /******************************/ + /**** TD2 - QUESTION 7 ****/ + /******************************/ + + cfgviz_dump(fun, "0_ini", /*TD*/ 2); + + /******************************/ + /** TD2 - FIN QUESTION 7 **/ + /******************************/ + + /******************************/ + /********** TD3 ***********/ + /******************************/ + + td_isol_print(/*TD*/ 3); + + /******************************/ + /**** TD3 - QUESTION 5 ****/ + /******************************/ + clean_aux_field(fun, LAST_AND_UNUSED_MPI_COLLECTIVE_CODE); + /******************************/ + /** TD3 - FIN QUESTION 5 **/ + /******************************/ + + td3_mpi_in_blocks(fun); + + /******************************/ + /********** FIN TD3 ***********/ + /******************************/ + + /******************************/ + /********** TD4 ***********/ + /******************************/ + + td_isol_print(/*TD*/ 4); + td4_dom_and_postdom(fun); + + /******************************/ + /********** FIN TD4 ***********/ + /******************************/ + + /******************************/ + /********** TD5 ***********/ + /******************************/ + + td_isol_print(/*TD*/ 5); + td5_bitmap_and_pdf_it(fun); + + /******************************/ + /********** FIN TD5 ***********/ + /******************************/ + + /******************************/ + /**** TD3 - QUESTION 5 ****/ + /******************************/ + clean_aux_field(fun, 0); + /******************************/ + /** TD3 - FIN QUESTION 5 **/ + /******************************/ + + free_dominance_info(CDI_POST_DOMINATORS); + free_dominance_info(CDI_DOMINATORS); + + return 0; + } +}; + +/* Main entry point for plugin */ +int plugin_init(struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + struct register_pass_info my_pass_info; + + printf("plugin_init: Entering...\n"); + + /* First check that the current version of GCC is the right one */ + + if (!plugin_default_version_check(version, &gcc_version)) + return 1; + + printf("plugin_init: Check ok...\n"); + + /* Declare and build my new pass */ + my_pass p(g); + + /* Fill info on my pass + (insertion after the pass building the CFG) */ + my_pass_info.pass = &p; + my_pass_info.reference_pass_name = "cfg"; + my_pass_info.ref_pass_instance_number = 0; + my_pass_info.pos_op = PASS_POS_INSERT_AFTER; + + /* Add my pass to the pass manager */ + register_callback(plugin_info->base_name, + PLUGIN_PASS_MANAGER_SETUP, + NULL, + &my_pass_info); + + printf("plugin_init: Pass added...\n"); + + return 0; +} diff --git a/TDs/TD5/CODE/test2.c b/TDs/TD5/CODE/test2.c new file mode 100644 index 0000000000000000000000000000000000000000..fc9c6088de2b5cca386ffb226a4976132a446917 --- /dev/null +++ b/TDs/TD5/CODE/test2.c @@ -0,0 +1,41 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + if (c < 10) + { + if (c < 5) + { + a = a * a + 1; + } + else + { + a = a * 3; + MPI_Barrier(MPI_COMM_WORLD); + } + + c += (a * 2); + } + else + { + b = b * 4; + MPI_Barrier(MPI_COMM_WORLD); + } + + c += (a + b); + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD5/CODE/test2.o b/TDs/TD5/CODE/test2.o new file mode 100644 index 0000000000000000000000000000000000000000..52bdec472decb7f6ad52a7f815450241faf5c469 Binary files /dev/null and b/TDs/TD5/CODE/test2.o differ diff --git a/TDs/TD5/CODE/test3.c b/TDs/TD5/CODE/test3.c new file mode 100644 index 0000000000000000000000000000000000000000..4e760ac22352902d857f35ff28bf9ed907ea6d99 --- /dev/null +++ b/TDs/TD5/CODE/test3.c @@ -0,0 +1,52 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c = 0; + + for (i = 0; i < 10; i++) + { + + MPI_Barrier(MPI_COMM_WORLD); + + if (c < 10) + { + printf("je suis dans le if (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + if (c < 5) + { + a = a * a + 1; + } + else + { + c = c * 3; + if (c < 20) + { + return c; + } + } + } + else + { + printf("je suis dans le else (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + return 1; + } + c += (a + b); + printf("fin du for\n"); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/TDs/TD5/CODE/test3.o b/TDs/TD5/CODE/test3.o new file mode 100644 index 0000000000000000000000000000000000000000..2d70111caf3f876bf032331eb17e64dc64aa0dac Binary files /dev/null and b/TDs/TD5/CODE/test3.o differ diff --git a/TDs/TD5/td5.pdf b/TDs/TD5/td5.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2f26b91e20a962811797273cefdcfeccacaf2fdc Binary files /dev/null and b/TDs/TD5/td5.pdf differ diff --git a/TDs/TD6/CODE/Makefile b/TDs/TD6/CODE/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b4563d987ac6d14f801390f7f8d52163074be964 --- /dev/null +++ b/TDs/TD6/CODE/Makefile @@ -0,0 +1,31 @@ +all: TP6_1.pgr + +CPP=g++_1220 +CC=gcc_1220 + +FILE=main.c mock.c + +MPI_PATH=`dirname \` which mpicc \` ` +MPI_FLAGS=-I$(MPI_PATH)/../include/mpi -L$(MPI_PATH)/../lib -lmpi +PLUGIN_FLAGS=-I`gcc -print-file-name=plugin`/include -g -Wall -fno-rtti -shared -fPIC + +CFLAGS=-g -O3 + + +libplugin.so: plugin_TP2_1.cpp + $(CPP) $(PLUGIN_FLAGS) -o libplugin.so $< + +%.so: plugin_%.cpp + $(CPP) $(PLUGIN_FLAGS) -o $@ $< + +%.pgr: %.so $(FILE) + gcc $(FILE) $(CFLAGS) -o $@ $(MPI_FLAGS) -fplugin=./$< + +%.pdf: %.dot + dot -Tpdf $< -o $@ + +clean: + rm -rf *.pgr *.pdf + +clean_all: clean + rm -rf libplugin.so *.dot diff --git a/TDs/TD6/CODE/main.c b/TDs/TD6/CODE/main.c new file mode 100644 index 0000000000000000000000000000000000000000..2b422ef74ccee3b2ffdc8f61ff5e64e12853c271 --- /dev/null +++ b/TDs/TD6/CODE/main.c @@ -0,0 +1,15 @@ +/** + * \file main.c + * \brief TEST PLUGIN +*/ +#include <stdio.h> +#include "mock.h" + +int main (int argc, char **argv) { + + printf("begining main\n"); + mock1(); + printf("ending main\n"); + + return 0; +} diff --git a/TDs/TD6/CODE/mock.c b/TDs/TD6/CODE/mock.c new file mode 100644 index 0000000000000000000000000000000000000000..8b5ebd22c3969e4ccbe88e62aef7f17ac4eb8aad --- /dev/null +++ b/TDs/TD6/CODE/mock.c @@ -0,0 +1,34 @@ +/** + * \file main.c + * \brief TEST PLUGIN + */ +#include <stdio.h> +#include "mock.h" + +#pragma instrument function mock1 +#pragma instrument function mock2 +#pragma instrument function mock3, mock5 +#pragma instrument function(mock4, mock6) +#pragma instrument function CANARD +#pragma instrument function mock1 +#pragma instrument function(coincoin + +void mock1() +{ + printf("mock1\n"); +} + +void mock2() +{ + printf("mock2\n"); +} + +void mock3() +{ + printf("mock3\n"); +} + +void mock4() +{ + printf("mock4\n"); +} diff --git a/TDs/TD6/CODE/mock.h b/TDs/TD6/CODE/mock.h new file mode 100644 index 0000000000000000000000000000000000000000..08a21a7f1a252f957a1ca8750cce92a07e9dd018 --- /dev/null +++ b/TDs/TD6/CODE/mock.h @@ -0,0 +1,9 @@ +#ifndef __TEST__H +#define __TEST__H + +void mock1(); +void mock2(); +void mock3(); +void mock4(); + +#endif diff --git a/TDs/TD6/CODE/plugin.cpp b/TDs/TD6/CODE/plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..85f597a08bc845e436897610a598441343f35371 --- /dev/null +++ b/TDs/TD6/CODE/plugin.cpp @@ -0,0 +1,12 @@ +#include <gcc-plugin.h> + +#include "pragma.cpp" + +int plugin_is_GPL_compatible; + +int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) +{ + register_callback(plugin_info->base_name, PLUGIN_PRAGMAS, register_pragma_mpicoll_check, NULL); + + return 0; +} \ No newline at end of file diff --git a/TDs/TD6/td6.pdf b/TDs/TD6/td6.pdf new file mode 100644 index 0000000000000000000000000000000000000000..763a05b1ccfd7a6fc914d6fa431c0b1a3c78eef5 Binary files /dev/null and b/TDs/TD6/td6.pdf differ diff --git a/plugin.cpp b/plugin.cpp deleted file mode 100644 index fa259bce7cd3135ef5c1ae5c2e7b0ffc37bef36c..0000000000000000000000000000000000000000 --- a/plugin.cpp +++ /dev/null @@ -1,665 +0,0 @@ -#include <gcc-plugin.h> -#include <plugin-version.h> -#include <tree.h> -#include <basic-block.h> -#include <diagnostic.h> -#include <gimple.h> -#include <tree-pass.h> -#include <context.h> -#include <function.h> -#include <gimple-iterator.h> -#include <c-family/c-pragma.h> -#include <vec.h> -#include <bitmap.h> -#include <queue> - -// ========== VARIABLES GLOBALES ========== // - -int plugin_is_GPL_compatible; - -// Mode debug (affichage des informations de débogage) -bool debug_mode = true; - -/* Enumération des codes des opérations collectives MPI potentielles à vérifier */ -enum mpi_collective_code -{ -#define DEFMPICOLLECTIVES(CODE, NAME) CODE, -#include "MPI_collectives.def" - LAST_AND_UNUSED_MPI_COLLECTIVE_CODE -#undef DEFMPICOLLECTIVES -}; - -/* Tableau de noms des opérations collectives MPI potentielles à vérifier */ -#define DEFMPICOLLECTIVES(CODE, NAME) NAME, -const char *const mpi_collective_name[] = { -#include "MPI_collectives.def" -}; -#undef DEFMPICOLLECTIVES - -// Vecteur contenant la liste des fonctions à vérifier issue de la directive #pragma ProjetCA mpicoll_check -vec<tree> *fun_vec; - -// ========== // - -// ========== PRAGMA ========== // - -// Affichage du vecteur (variable globale) des fonctions à vérifier -static void print_fun_vec() -{ - tree x; - printf("fun_vec contains %i element(s):", fun_vec->length()); - for (int i = 0; fun_vec->iterate(i, &x); i++) - printf(" %s,", IDENTIFIER_POINTER(x)); - printf("\n"); -} - -// Traitement de la directive #pragma ProjetCA mpicoll_check -static void handle_pragma_mpicoll_check(cpp_reader *) -{ - location_t loc; - enum cpp_ttype token; - tree x; - bool close_paren_needed_p = false; - - // Erreur si la directive est placée au sein d'une fonction - if (cfun) - { - error_at(cfun->function_start_locus, "%<#pragma ProjetCA mpicoll_check%> is not allowed inside functions"); - return; - } - - token = pragma_lex(&x, &loc); - // Si la directive est suivie d'une parenthèse ouvrante, on cherche une liste de noms de fonctions de la forme (fun1,fun2,fun3,...) - // Sinon, on s'attend au nom d'une seule fonction - if (token == CPP_OPEN_PAREN) - { - close_paren_needed_p = true; - token = pragma_lex(&x, &loc); - } - - // Si le premier token (ou suivant la parenthèse) n'est pas un nom, on signale une erreur - if (token != CPP_NAME) - error_at(loc, "%<#pragma ProjetCA mpicoll_check%> is not a valid name"); - else - { - do - { - // On émet un avertissement si le nom d'une fonction est présent plusieurs fois dans l'ensemble des directives #pragma ProjetCA mpicoll_check - if (fun_vec->contains(x)) - warning_at(loc, 0, "%<#pragma ProjetCA mpicoll_check%> already contains the function %<%s%>", IDENTIFIER_POINTER(x)); - // Sinon, on ajoute la fonction au vecteur - else - fun_vec->safe_push(x); - - // On parcourt la liste de noms de fonctions séparés par des virgules - token = pragma_lex(&x, &loc); - while (token == CPP_COMMA) - token = pragma_lex(&x, &loc); - } while (token == CPP_NAME); - - // On vérifie que la liste de noms de fonctions est bien terminée par une parenthèse fermante - if (close_paren_needed_p) - { - if (token == CPP_CLOSE_PAREN) - token = pragma_lex(&x, &loc); - else - error_at(loc, "%<#pragma ProjetCA mpicoll_check%> does not have a final %<)%>"); - } - - if (token != CPP_EOF) - { - error_at(loc, "%<#pragma ProjetCA mpicoll_check%> string is badly formed"); - return; - } - - if (debug_mode) - print_fun_vec(); - } -} - -// Enregistrement de la directive #pragma ProjetCA mpicoll_check -static void register_pragma_mpicoll_check(void *event_data, void *data) -{ - c_register_pragma("ProjetCA", "mpicoll_check", handle_pragma_mpicoll_check); -} - -// Opérations de clôture de la directive #pragma ProjetCA mpicoll_check -static void clear_pragma_mpicoll_check(void *event_data, void *data) -{ - tree x; - // On émet un avertissement pour chaque fonction présente dans la directive qui n'a pas été appelée durant les passes - for (int i = 0; fun_vec->iterate(i, &x); i++) - warning(0, "%<#pragma ProjetCA mpicoll_check%> contains the function %<%s%> which does not seem defined", IDENTIFIER_POINTER(x)); - - // On libère le vecteur - fun_vec->release(); -} - -// ========== // - -// ========== UTILS ========== // - -// Récupération du code de l'opération collective MPI associée à l'instruction courante -// Si l'instruction courante n'est pas une opération collective MPI présente dans la liste, on renvoie LAST_AND_UNUSED_MPI_COLLECTIVE_CODE -enum mpi_collective_code get_mpi_collective_code(gimple *stmt) -{ - if (is_gimple_call(stmt)) - { - const char *callee_name; - - callee_name = IDENTIFIER_POINTER(DECL_NAME(gimple_call_fndecl(stmt))); - - for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; i++) - { - if (strcmp(callee_name, mpi_collective_name[i]) == 0) - { - return mpi_collective_code(i); - } - } - } - - return LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; -} - -// Séparation des blocks contenant plusieurs appels MPI -void split_blocks_with_multiple_mpi_calls(function *fun) -{ - basic_block bb; - - // On parcourt tous les basic blocks de la fonction - FOR_EACH_BB_FN(bb, fun) - { - gimple *old_stmt = NULL; - - for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) - { - gimple *stmt = gsi_stmt(gsi); - - mpi_collective_code stmt_code = get_mpi_collective_code(stmt); - - // On repère les instructions courantes qui sont des fonctions MPI collective présentes dans la liste - if (stmt_code != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - { - // Si on a déjà repéré une instruction MPI collective dans le basic block courant, on crée un nouveau basic block - if (old_stmt != NULL) - split_block(bb, old_stmt); - old_stmt = stmt; - } - } - } -} - -bitmap_head *generate_new_cfg_edges(function *fun) -{ - bitmap_head *new_cfg_edges = XNEWVEC(bitmap_head, n_basic_blocks_for_fn(fun)); - basic_block src = ENTRY_BLOCK_PTR_FOR_FN(fun); - bitmap *visited_blocks; - visited_blocks = XNEWVEC(bitmap, n_basic_blocks_for_fn(fun)); - edge e; - basic_block bb; - - // On initialise le bitmap des arcs du nouveau CFG - FOR_EACH_BB_FN(bb, fun) - { - bitmap_initialize(&new_cfg_edges[bb->index], &bitmap_default_obstack); - } - - // On initialise le bitmap des bb déjà visités - bitmap_initialize(*visited_blocks, &bitmap_default_obstack); - - // On marque le bloc d'entrée comme visité - bitmap_set_bit(*visited_blocks, src->index); - - // On parcourt le CFG à partir du bloc d'entrée - std::queue<basic_block> q; - // Ajout du bloc d'entrée dans la file - q.push(src); - - // Tant que la file n'est pas vide, on traite le premier élément de la file - // On ajoute les arcs sortants dont le bloc de destination n'a pas encore été visité - while (!q.empty()) - { - basic_block bb = q.front(); - q.pop(); - - edge_iterator ei; - FOR_EACH_EDGE(e, ei, bb->succs) - { - basic_block succ = e->dest; - - if (!bitmap_bit_p(*visited_blocks, succ->index)) - { - bitmap_set_bit(&new_cfg_edges[bb->index], succ->index); - bitmap_set_bit(*visited_blocks, succ->index); - q.push(succ); - } - } - } - - // On libère le bitmap des bb déjà visités - bitmap_clear(*visited_blocks); - - return new_cfg_edges; -} - -// Calcul du rang maximal des bb d'une fonction -static int get_max_rank(function *fun, int *ranks) -{ - int max_rank = 0; - for (int i = 0; i < n_basic_blocks_for_fn(fun); i++) - { - if (ranks[i] > max_rank) - { - max_rank = ranks[i]; - } - } - - return max_rank; -} - -// ========== // - -// ========== GRAPHVIZ ========== // - -// Création du nom du fichier .dot à partir du nom de la fonction et d'un suffixe -static char *cfgviz_generate_filename(function *fun, const char *suffix) -{ - char *target_filename; - - target_filename = (char *)xmalloc(1024 * sizeof(char)); - - snprintf(target_filename, 1024, "%s_%s_%d_%s.dot", - current_function_name(), - LOCATION_FILE(fun->function_start_locus), - LOCATION_LINE(fun->function_start_locus), - suffix); - - return target_filename; -} - -// Export de la représentation du CFG d'une fonction dans un descriptor de fichier -static void cfgviz_internal_dump(function *fun, FILE *out) -{ - basic_block bb; - - fprintf(out, "Digraph G{\n"); - - FOR_ALL_BB_FN(bb, cfun) - { - fprintf(out, "%d [label=\"BB %d", bb->index, bb->index); - - gimple_stmt_iterator gsi; - gimple *stmt; - gsi = gsi_start_bb(bb); - stmt = gsi_stmt(gsi); - - /* Itération sur les instructions du bloc */ - for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) - { - stmt = gsi_stmt(gsi); - - enum mpi_collective_code returned_code = get_mpi_collective_code(stmt); - - if (returned_code != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - { - fprintf(out, " \\n %s", mpi_collective_name[returned_code]); - } - } - - fprintf(out, "\" shape=ellipse]\n"); - - edge_iterator eit; - edge e; - - // Représentation des arcs sortants - FOR_EACH_EDGE(e, eit, bb->succs) - { - const char *label = ""; - if (e->flags == EDGE_TRUE_VALUE) - label = "true"; - else if (e->flags == EDGE_FALSE_VALUE) - label = "false"; - - fprintf(out, "%d -> %d [color=red label=\"%s\"]\n", - bb->index, e->dest->index, label); - } - } - - fprintf(out, "}\n"); -} - -// Export de la représentation du CFG d'une fonction dans un fichier .dot -void cfgviz_dump(function *fun, const char *suffix) -{ - char *target_filename; - FILE *out; - - target_filename = cfgviz_generate_filename(fun, suffix); - - printf("Generating CFG of function %s in file <%s>\n", - current_function_name(), target_filename); - - out = fopen(target_filename, "w"); - - cfgviz_internal_dump(fun, out); - - fclose(out); - free(target_filename); -} - -// ========== // - -// ========== DOMINANCE ========== // - -// Calcul de la post dominance d'un ensemble de basic blocks -bitmap get_post_dominance_for_a_set(bitmap_head *set, function *fun, bitmap_head *pd) -{ - bitmap_initialize(pd, &bitmap_default_obstack); - - // Pour chaque bb de l'ensemble, on récupère tous les bb post-dominés par celui-ci - basic_block bb; - FOR_ALL_BB_FN(bb, fun) - { - if (bitmap_bit_p(set, bb->index)) - { - auto_vec<basic_block> pd_blocks = get_all_dominated_blocks(CDI_POST_DOMINATORS, bb); - for (unsigned int i = 0; i < pd_blocks.length(); i++) - { - bitmap_set_bit(pd, pd_blocks[i]->index); - } - } - } - - // On garde les bb dont au moins un successeur est post-dominé par tous les bb de l'ensemble - FOR_ALL_BB_FN(bb, fun) - { - edge e; - edge_iterator ei; - int total = 0; - int succ_n = 0; - FOR_EACH_EDGE(e, ei, bb->succs) - { - basic_block succ = e->dest; - if (bitmap_bit_p(pd, succ->index)) - succ_n++; - - total++; - } - if (total > 0 && succ_n == total) - bitmap_set_bit(pd, bb->index); - } - - return pd; -} - -// Calcul de la frontière de post dominance d'un ensemble de basic blocks -bitmap get_post_dominance_frontier_for_a_set(bitmap_head *set, function *fun, bitmap_head *pd) -{ - bitmap_head pd2; - bitmap_initialize(pd, &bitmap_default_obstack); - - // On récupère la post dominance de l'ensemble - get_post_dominance_for_a_set(set, fun, &pd2); - - // On garde les noeuds qui ne sont pas post-dominés par l'ensemble mais dont au moins un successeur l'est - basic_block bb; - FOR_ALL_BB_FN(bb, fun) - { - edge e; - edge_iterator ei; - FOR_EACH_EDGE(e, ei, bb->succs) - { - basic_block succ = e->dest; - if (bitmap_bit_p(&pd2, succ->index) && !bitmap_bit_p(&pd2, bb->index)) - { - bitmap_set_bit(pd, bb->index); - } - } - } - - return pd; -} - -// ========== // - -// ========== PASS ========== // - -const pass_data pass_mpicoll_check_data = { - GIMPLE_PASS, - "MPICOLL_CHECK", - OPTGROUP_NONE, - TV_OPTIMIZE, - 0, - 0, - 0, - 0, - 0, -}; - -class pass_mpicoll_check : public gimple_opt_pass -{ -public: - pass_mpicoll_check(gcc::context *ctxt) : gimple_opt_pass(pass_mpicoll_check_data, ctxt) {} - - pass_mpicoll_check *clone() { return new pass_mpicoll_check(g); } - - bool gate(function *fun) - { - bool pass_enabled = false; - - tree x; - unsigned int i = 0; - // On parcourt le vecteur des fonctions à vérifier - while (!pass_enabled && i < fun_vec->length()) - { - fun_vec->iterate(i, &x); - i++; - // Si la fonction courante est présente dans le vecteur, on l'enlève du vecteur et on active la passe - if (strcmp(IDENTIFIER_POINTER(x), function_name(fun)) == 0) - { - fun_vec->unordered_remove(i - 1); - pass_enabled = true; - } - } - - if (pass_enabled && debug_mode) - printf("Executing mpicoll_check pass for the function %s\n", function_name(fun)); - - return pass_enabled; - } - - unsigned int execute(function *fun) - { - // Export du CFG de la fonction avant la séparation des blocs contenant plusieurs appels MPI - if (debug_mode) - cfgviz_dump(fun, "before_split"); - - // Séparation des blocs contenant plusieurs appels MPI - split_blocks_with_multiple_mpi_calls(fun); - - // Export du CFG de la fonction après la séparation des blocs contenant plusieurs appels MPI - if (debug_mode) - cfgviz_dump(fun, "after_split"); - - // Calcul des informations de post-dominance - calculate_dominance_info(CDI_POST_DOMINATORS); - - // Création du nouveau CFG en retirant les arcs retour - bitmap_head *new_cfg_edges = generate_new_cfg_edges(fun); - - // Définition d'une structure pour stocker les informations de rang - struct bb_with_rank - { - basic_block bb; - int rank; - }; - - basic_block bb; - - std::queue<bb_with_rank> q; - bb_with_rank bbr; - - bbr.bb = ENTRY_BLOCK_PTR_FOR_FN(fun); - bbr.rank = 0; - q.push(bbr); - - // Tableaux pour stocker les informations de rang et d'appel de chaque bb - int calls[n_basic_blocks_for_fn(fun)]; - int ranks[n_basic_blocks_for_fn(fun)]; - - // On parcourt l'ensemble des basic blocks de l'entrée vers la sortie - while (!q.empty()) - { - bbr = q.front(); - q.pop(); - - gimple_stmt_iterator gsi; - mpi_collective_code c = LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; - - // Si le bb contient une instruction MPI, on sort de la boucle pour lui attribuer un rang - for (gsi = gsi_start_bb(bbr.bb); !gsi_end_p(gsi); gsi_next(&gsi)) - { - gimple *stmt = gsi_stmt(gsi); - c = get_mpi_collective_code(stmt); - if (c != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - break; - } - - calls[bbr.bb->index] = c; - - // Si le bb contient un appel MPI, on augmente d'un son rang par rapport à celui du prédécesseur - // Sinon, on garde le même rang et on continue - if (c != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - ranks[bbr.bb->index] = bbr.rank + 1; - else - ranks[bbr.bb->index] = bbr.rank; - - FOR_ALL_BB_FN(bb, fun) - { - // On ajoute les successeurs du bb courant dans la file en leur donnant le même rang - if (bitmap_bit_p(&new_cfg_edges[bbr.bb->index], bb->index)) - { - bb_with_rank bbr2; - bbr2.bb = bb; - bbr2.rank = ranks[bbr.bb->index]; - q.push(bbr2); - } - } - } - - // Récupération du rang maximal - int max_rank = get_max_rank(fun, ranks); - - // Initialisation d'une matrice de bitmaps de taille nombre_appels_differents * rang_maximum pour avoir tous les ensembles possibles - bitmap_head **sets = XNEWVEC(bitmap_head *, max_rank); - - // Initialisation des bitmaps - for (int i = 0; i < max_rank; i++) - { - sets[i] = XNEWVEC(bitmap_head, LAST_AND_UNUSED_MPI_COLLECTIVE_CODE); - for (unsigned int j = 0; j < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; j++) - { - bitmap_initialize(&sets[i][j], &bitmap_default_obstack); - } - } - - // Remplissage des bitmaps avec les index des bb compris dans les ensembles correspondants - FOR_ALL_BB_FN(bb, fun) - { - if (calls[bb->index] != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - { - bitmap_set_bit(&sets[ranks[bb->index] - 1][calls[bb->index]], bb->index); - } - } - - // Pour chaque ensemble possible de notre matrice, on récupère la frontière de post dominance - for (int i = 0; i < max_rank; i++) - { - for (unsigned int j = 0; j < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; j++) - { - bitmap_head pd; - int target_rank = 0; - get_post_dominance_frontier_for_a_set(&sets[i][j], fun, &pd); - - // Si la frontière de post dominance n'est pas vide, on émet un avertissement pour deadlock - // Cela signifie que certains chemins du CFG ne passent pas forcément par cette collective MPI - // Certains processus peuvent donc être bloqués en attendant que les autres processus atteignent cette collective MPI à un autre moment - if (!bitmap_empty_p(&pd)) - { - // On émet un avertissement en indiquant la collective concernée dans la fonction - warning(0, "The MPI collective %<%s%> (rank %d) differs between process (possible deadlock)", mpi_collective_name[j], i + 1); - target_rank = i + 1; - - bitmap_head temp; - bitmap_initialize(&temp, &bitmap_default_obstack); - // On calcule la frontière de post-dominance itérée jusqu'à ce qu'elle soit stable pour trouver l'origine du problème - do - { - bitmap_copy(&temp, &pd); - get_post_dominance_frontier_for_a_set(&temp, fun, &pd); - } while (!bitmap_empty_p(&pd)); - - // Notre frontière de post-dominance itérée est stable, on peut donc récupérer et indiquer le basic block contenant l'instruction à partir de laquelle on observe des divergences - for (int i = 0; i < n_basic_blocks_for_fn(fun); i++) - { - if (bitmap_bit_p(&temp, i)) - { - bb = BASIC_BLOCK_FOR_FN(fun, i); - - // On parcourt les statements du basic block pour trouver la première instruction non MPI qui pourrait créer la divergence - gimple_stmt_iterator gsi; - gimple *stmt; - for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) - { - stmt = gsi_stmt(gsi); - if (get_mpi_collective_code(stmt) == LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - { - warning_at(gimple_location(stmt), 0, "The deadlock origin for the MPI collective %<%s%> (rank %d) is probably here", mpi_collective_name[j], target_rank); - break; - } - } - } - } - } - } - } - - free_dominance_info(CDI_POST_DOMINATORS); - - return 0; - } -}; - -// ========== // - -// ========== PLUGIN ========== // - -// Initialisation du plugin -int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) -{ - // On crée le vecteur qui contiendra la liste des fonctions à vérifier issue de la directive #pragma ProjetCA mpicoll_check - fun_vec = new vec<tree>; - fun_vec->create(0); - - struct register_pass_info pass_info; - - // On vérifie que la version de GCC est compatible avec le plugin - if (!plugin_default_version_check(version, &gcc_version)) - return 1; - - pass_mpicoll_check p(g); - pass_info.pass = &p; - pass_info.reference_pass_name = "cfg"; - pass_info.ref_pass_instance_number = 0; - pass_info.pos_op = PASS_POS_INSERT_AFTER; - - register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); - - register_callback(plugin_info->base_name, PLUGIN_PRAGMAS, register_pragma_mpicoll_check, NULL); - - register_callback(plugin_info->base_name, PLUGIN_FINISH, clear_pragma_mpicoll_check, NULL); - - return 0; -} - -// ========== // \ No newline at end of file