c - Can I eliminate the usage of pointer during static analysis in this way? -


so using cil (writing cil extension) simplify c code, , trying eliminate usage of pointer(because usage of pointer cause lot of troubles in our next step analysis)

here code:

void foo() {   int = 1;   int* p = &a;   int c = *p;   *p = 3; } 

i thinking maintain map of pointer reference relation in cil extension, , simplified c code be:

void foo() {    int = 1;   // int *p = &a; // map:  {p : a}  eliminate code, , create new entry in map    int c = a;      // substitute based on map    = 3;          // substitute based on map } 

this easy situation, , looks promising.

but things turn complicated, example return pointer(then have change type of function, of course straightforward in cil)

so questions :

  • is universally doable eliminate pointer in way?

  • is there undecidable situation?

i'm not sure trying achieve, eliminating pointer uses next impossible. may able eliminate uses (like rather trivial code in example), not able eliminate all, because indirection used in many interesting ways.

take example linked list. if try eliminate pointers linking list, need give name each list node ever created program. of course, can replace list array (which involves pointer arithmetic of own), won't binary tree. , not end of it, there hash tables, virtually arbitrary linking between objects results object oriented programming, etc.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -