Commit b5a778dc authored by Julian Kranz's avatar Julian Kranz
Browse files

Liveness

parent 213f2395
......@@ -252,7 +252,7 @@ __obj __consume8 (__obj s) {
__RECORD_ADD(___1,v);
__RECORD_ADD(___2,ss);
__RECORD_END(a,2);
//printf("index: %lu\n", idx + 1);
printf("index: %lu\n", idx + 1);
return (a);
}
......@@ -274,7 +274,7 @@ __obj __unconsume8 (__obj s) {
__RECORD_ADD(___1,__UNIT);
__RECORD_ADD(___2,ss);
__RECORD_END(a,2);
//printf("index: %lu\n", idx - 1);
printf("index: %lu\n", idx - 1);
return (a);
}
......@@ -304,7 +304,7 @@ __obj __consume16 (__obj s) {
__RECORD_ADD(___1,v);
__RECORD_ADD(___2,ss);
__RECORD_END(a,2);
//printf("index: %lu\n", idx + 2);
printf("index: %lu\n", idx + 2);
return (a);
}
......@@ -326,7 +326,7 @@ __obj __unconsume16 (__obj s) {
__RECORD_ADD(___1,__UNIT);
__RECORD_ADD(___2,ss);
__RECORD_END(a,2);
//printf("index: %lu\n", idx - 2);
printf("index: %lu\n", idx - 2);
return (a);
}
......@@ -358,7 +358,7 @@ __obj __consume32 (__obj s) {
__RECORD_ADD(___1,v);
__RECORD_ADD(___2,ss);
__RECORD_END(a,2);
//printf("index: %lu\n", idx + 4);
printf("index: %lu\n", idx + 4);
return (a);
}
......@@ -380,7 +380,7 @@ __obj __unconsume32 (__obj s) {
__RECORD_ADD(___1,__UNIT);
__RECORD_ADD(___2,ss);
__RECORD_END(a,2);
//printf("index: %lu\n", idx - 4);
printf("index: %lu\n", idx - 4);
return (a);
}
......
......@@ -9,7 +9,7 @@
#include <stddef.h>
#include <string.h>
#define __RT_HEAP_SIZE (8*1024*1024)
#define __RT_HEAP_SIZE (32*1024*1024)
#define __CHECK_HEAP(n) /* TODO: check for heap-overflow */
#define __ALLOC1() --hp /* TODO: check for heap-overflow */
......
......@@ -17,7 +17,7 @@ clang-sweep:
clang -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors sweep.c ../../../dis.o -DRELAXEDFATAL -o clang-sweep
liveness-sweep:
clang -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors liveness-sweep.c ../../../dis.o -lelf -DRELAXEDFATAL -o liveness-sweep
clang -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors liveness-sweep.c ../../../dis.o -lelf -lrt -DRELAXEDFATAL -o liveness-sweep
gcc-sweep:
gcc -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors sweep.c ../../../dis.o -DRELAXEDFATAL -o gcc-sweep
......
......@@ -13,6 +13,8 @@
#include <sysexits.h>
#include <unistd.h>
#include <time.h>
char elf_section_boundary_get(char *path, size_t *offset, size_t *size) {
char retval = 0;
......@@ -148,18 +150,28 @@ int main(int argc, char** argv) {
size_t lines = 0;
size_t lines_greedy = 0;
long time_non_opt = 0;
long time_opt = 0;
struct timespec start;
struct timespec end;
uint64_t consumed = 0;
while(consumed < buffer_length) {
__obj state = __createState(buffer + consumed, buffer_length - consumed, 0, 0);
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
__obj rreil_instructions = __runMonadicNoArg(__translateBlock__, &state);
clock_gettime(CLOCK_MONOTONIC_RAW, &end);
long diff = end.tv_nsec - start.tv_nsec;
time_non_opt += diff > 0 ? diff : 0;
if(!__isNil(rreil_instructions)) {
__fatal("TranslateBlock failed");
goto end;
}
printf("%x\n", buffer[consumed]);
//printf("%x\n", buffer[consumed]);
printf("Initial RREIL instructions:\n");
__pretty(__rreil_pretty__, rreil_instructions, fmt, size);
......@@ -170,8 +182,12 @@ int main(int argc, char** argv) {
if(fmt[i] == '\n')
lines++;
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
__obj greedy_state = __runMonadicOneArg(__liveness__, &state,
rreil_instructions);
clock_gettime(CLOCK_MONOTONIC_RAW, &end);
diff = end.tv_nsec - start.tv_nsec;
time_opt += diff > 0 ? diff : 0;
if(!__isNil(greedy_state)) {
__fatal("Liveness failed");
goto end;
......@@ -200,7 +216,7 @@ int main(int argc, char** argv) {
__resetHeap();
consumed += __getBlobIndex(state);
//printf("consumed: %lu, buffer_length: %lu\n", consumed, buffer_length);
printf("consumed: %lu, buffer_length: %lu\n", consumed, buffer_length);
}
printf("Statistics:\n");
......@@ -211,6 +227,9 @@ int main(int argc, char** argv) {
printf("Reduction: %lf%%\n", 100 * reduction);
printf("Time needed for the decoding and the translation to RREIL: %lf seconds\n", time_non_opt/(double)(1000000000));
printf("Time needed for the lv analysis: %lf\n seconds", time_opt/(double)(1000000000));
end:
free(buffer);
free(fmt);
......
......@@ -4604,6 +4604,8 @@ val /66 [0x0f 0x75 /r] = binop PCMPEQW xmm128 xmm/m128
val / [0x0f 0x76 /r] = binop PCMPEQD mm64 mm/m64
val /66 [0x0f 0x76 /r] = binop PCMPEQD xmm128 xmm/m128
val /vex/66/0f/vexv [0x74 /r] | vex128? = varity3 VPCMPEQB xmm128 v/xmm xmm/m128
#Todo: v- is not in the Intel manual
#val /vex/66/0f [0x74 /r] | vex128? = varity3 VPCMPEQB xmm128 xmm0 xmm/m128
val /vex/66/0f/vexv [0x75 /r] | vex128? = varity3 VPCMPEQW xmm128 v/xmm xmm/m128
val /vex/66/0f/vexv [0x76 /r] | vex128? = varity3 VPCMPEQD xmm128 v/xmm xmm/m128
......@@ -5179,6 +5181,8 @@ val / [0x9c]
val / [0x0f 0xef /r] = binop PXOR mm64 mm/m64
val /66 [0x0f 0xef /r] = binop PXOR xmm128 xmm/m128
val /vex/66/0f/vexv [0xef /r] | vex128? = varity3 VPXOR xmm128 v/xmm xmm/m128
#Todo: v- is not in the Intel manual
#val /vex/66/0f [0xef /r] | vex128? = varity3 VPXOR xmm128 xmm0 xmm/m128
### RCL/RCR/ROL/ROR
### - Rotate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment