Saturday, 13 January 2018

11. Implementation of Simple Code Optimization Techniques (Constant Folding.,etc.)

Ex. No: 11

Date:
         
        11. Implementation of Simple Code Optimization Techniques (Constant Folding.,etc.)




AIM:

  To write a C program to implement the code optimization techniques.

ALGORITHM:

1. Start
2. Create an input file which contains three address code.
3. Open the file in read mode.
4. If the file pointer returns NULL, exit the program else go to 5.
5. Scan the input symbol from the left to right.
Common Sub expression elimination
6. Store the first expression in a string.
7. Compare the string with the other expressions in the file.
8. If there is a match, remove the expression from the input file.
9. Perform these steps 5 to 8 for all the input symbols in the file.
Dead code Elimination
10. Scan the input symbol from the file from left to right.
11. Get the operand before the operator from the three address code.
12. Check whether the operand is used in any other expression in the three address code.
13. If the operand is not used, then eliminate the complete expression from the three address code else go to 14.
14. Perform steps 11 to 13 for all the operands in the three address code till end of file is reached.
15.Stop.. 
PROGRAM


#include <stdio.h> 
#include <conio.h> 
#include <string.h >
  struct op 
{
    char l;
    char r[20];
  }
op[10], pr[10];

void main() 
{
  int a, i, k, j, n, z = 0, m, q;
  char * p, * l;
  char temp, t;
  char * tem;
  clrscr();
  printf("enter no of values");
  scanf("%d", & n);
  for (i = 0; i < n; i++) 
{
    printf("\tleft\t");
    op[i].l = getche();
    printf("\tright:\t");
    scanf("%s", op[i].r);
  }
  printf("intermediate Code\n");
  for (i = 0; i < n; i++) 
{
    printf("%c=", op[i].l);
    printf("%s\n", op[i].r);
  }
  for (i = 0; i < n - 1; i++) 
{
    temp = op[i].l;
    for (j = 0; j < n; j++) 
{
      p = strchr(op[j].r, temp);
      if (p) 
{
        pr[z].l = op[i].l;
        strcpy(pr[z].r, op[i].r);
        z++;

      }
    }
  }
  pr[z].l = op[n - 1].l;
  strcpy(pr[z].r, op[n - 1].r);
  z++;
  printf("\nafter dead code elimination\n");
  for (k = 0; k < z; k++)
 {
    printf("%c\t=", pr[k].l);
    printf("%s\n", pr[k].r);
  }

  //sub expression elimination
  for (m = 0; m < z; m++) 
{
    tem = pr[m].r;
    for (j = m + 1; j < z; j++) 
{
      p = strstr(tem, pr[j].r);
      if (p)
 {
        t = pr[j].l;
        pr[j].l = pr[m].l;
        for (i = 0; i < z; i++) 
{
          l = strchr(pr[i].r, t);
          if (l) {
            a = l - pr[i].r;
            //printf("pos: %d",a);
            pr[i].r[a] = pr[m].l;
          }
        }
      }
    }
  }
  printf("eliminate common expression\n");
  for (i = 0; i < z; i++) {
    printf("%c\t=", pr[i].l);
    printf("%s\n", pr[i].r);
  }
  // duplicate production elimination

  for (i = 0; i < z; i++)
 {
    for (j = i + 1; j < z; j++)
 {
      q = strcmp(pr[i].r, pr[j].r);
      if ((pr[i].l == pr[j].l) && !q)

      {
        pr[i].l = '\0';
        strcpy(pr[i].r, '\0');
      }
    }
  }
  printf("optimized code");
  for (i = 0; i < z; i++) 
{
    if (pr[i].l != '\0') {
      printf("%c=", pr[i].l);
      printf("%s\n", pr[i].r);
    }    }   getch();
}
OUTPUT:

left    a         right:  9
left    b        right:  c+d
left    e        right:  c+d
left    f        right:  b+e
left    r        right:  f
intermediate Code
a=9
b=c+d
e=c+d
f=b+e
r=f

after dead code elimination
b       =c+d
e       =c+d
f       =b+e
r       =f
eliminate common expression
b       =c+d
b       =c+d
f       =b+b
r       =f
optimized codeb=c+d
f=b+b
r=f


RESULT:

Thus the above program is compiled and executed successfully and output is verified.



10. Implement the back end of the compiler which takes the three address code and produces the 8086 assembly language instructions that can be assembled and run using a 8086 assembler. The target assembly instructions can be simple move, add, sub, jump. Also simple addressing modes are used.

Ex. No: 10
Date:
10.   Implement the back end of the compiler which takes the three address code and produces the 8086 assembly language instructions that can be assembled and run using a 8086 assembler. The target assembly instructions can be simple move, add, sub, jump. Also  simple addressing modes are used.



AIM:

  To write a C program to implement the Back end of the compiler.


ALGORITHM:

1. Start the program.
2. Get the three variables from statements and stored in the text file k.txt.
3. Compile the program and give the path of the source file.
4. Execute the program.
5. Target code for the given statement was produced.
6. Stop the program.

PROGRAM


#include <stdio.h > 
#include <stdio.h >
 #include<conio.h>
 #include <string.h >
  void main() {
    char icode[10][30], str[20], opr[10];
    int i = 0;
    clrscr();
    printf("\n Enter the set of intermediate code (terminated by exit):\n");
    do
    {
      scanf("%s", icode[i]);
    } while (strcmp(icode[i++], "exit") != 0);
    printf("\n target code generation");
    printf("\n************************");
    i = 0;
    do {
      strcpy(str, icode[i]);
      switch (str[3]) {
      case '+':
        strcpy(opr, "ADD ");
        break;
      case '-':
        strcpy(opr, "SUB ");
        break;
      case '*':
        strcpy(opr, "MUL ");
        break;
      case '/':
        strcpy(opr, "DIV ");
        break;
      }
      printf("\n\tMov %c,R%d", str[2], i);
      printf("\n\t%s%c,R%d", opr, str[4], i);
      printf("\n\tMov R%d,%c", i, str[0]);
    } while (strcmp(icode[++i], "exit") != 0);
    getch();
  }













OUTPUT:

Enter the set of intermediate code (terminated by exit):
a=a*b
c=f*h
g=a*h
f=Q+w
t=q-j
exit
 target code generation
************************
        Mov a,R0
        MUL b,R0
        Mov R0,a
        Mov f,R1
        MUL h,R1
        Mov R1,c
        Mov a,R2
        MUL h,R2
        Mov R2,g
        Mov Q,R3
        ADD w,R3
        Mov R3,f
        Mov q,R4
        SUB j,R4
        Mov R4,t

RESULT:

Thus the above program is compiled and executed successfully and output is verified.

9. Construction of DAG

Ex. No: 9
Date:
9.   Construction of DAG


AIM:

  To write a C program to construct of DAG(Directed Acyclic Graph)

INTRODUCTION:

The code optimization is required to produce an efficient target code. These are two important       issues that used to be considered while applying the techniques for code optimization.
They are:
The semantics equivalences of the source program must not be changed.
 The improvement over the program efficiency must be achieved without changing the
algorithm.


ALGORITHM:

1. Start the program
2. Include all the header files
3. Check for postfix expression and construct the in order DAG representation
4. Print the output
5. Stop the program

PROGRAM

#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<conio.h>
void main()
{
struct da
{
int ptr,left,right;
char label;
}dag[25];
int ptr,l,j,change,n=0,i=0,state=1,x,y,k;
char store,*input1,input[25],var;
clrscr();
for(i=0;i<25;i++)
{
dag[i].ptr=NULL;
dag[i].left=NULL;
dag[i].right=NULL;
dag[i].label=NULL;
}
printf("\n\nENTER THE EXPRESSION\n\n");
scanf("%s",input1);
/*EX:((a*b-c))+((b-c)*d)) like this give with paranthesis.limit
is 25 char ucan change that*/
for(i=0;i<25;i++)
input[i]=NULL;
l=strlen(input1);
a:
for(i=0;input1[i]!=')';i++);
for(j=i;input1[j]!='(';j--);
for(x=j+1;x<i;x++)
if(isalpha(input1[x]))
input[n++]=input1[x];
else
if(input1[x]!='0')
store=input1[x];
input[n++]=store;
for(x=j;x<=i;x++)
input1[x]='0';
if(input1[0]!='0')goto a;
for(i=0;i<n;i++)
{
dag[i].label=input[i];
dag[i].ptr=i;
if(!isalpha(input[i])&&!isdigit(input[i]))
{
dag[i].right=i-1;
ptr=i;
var=input[i-1];
if(isalpha(var))
ptr=ptr-2;
else
{
ptr=i-1;
b:
if(!isalpha(var)&&!isdigit(var))
{
ptr=dag[ptr].left;
var=input[ptr];
goto b;
}
else
ptr=ptr-1;
}
dag[i].left=ptr;
}
}
printf("\n SYNTAX TREE FOR GIVEN EXPRESSION\n\n");
printf("\n\n PTR \t\t LEFT PTR \t\t RIGHT PTR \t\t LABEL\n\n");
for(i=0;i<n;i++)/* draw the syntax tree for the following
output with pointer value*/
printf("\n%d\t%d\t%d\t%c\n",dag[i].ptr,dag[i].left,dag[i].right,dag[i].label);
getch();
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if((dag[i].label==dag[j].label&&dag[i].left==dag[j].left)&&dag[i].right==dag[j].right)
{
for(k=0;k<n;k++)
{
if(dag[k].left==dag[j].ptr)dag[k].left=dag[i].ptr;
if(dag[k].right==dag[j].ptr)dag[k].right=dag[i].ptr;
}
dag[j].ptr=dag[i].ptr;
}
}
}
printf("\n DAG FOR GIVEN EXPRESSION\n\n");
printf("\n\n PTR \t LEFT PTR \t RIGHT PTR \t LABEL \n\n");
for(i=0;i<n;i++)/*draw DAG for the following output with
pointer value*/
printf("\n %dt\t%d\t\t%d\t\t%c\n",dag[i].ptr,dag[i].left,dag[i].right,dag[i].label);
getch();
}


























OUTPUT:
ENTER THE EXPRESSION
((a*b-c))+((b-c)*d))


 SYNTAX TREE FOR GIVEN EXPRESSION

 PTR             LEFT PTR                RIGHT PTR               LABEL


0        0       0        a

1      0       0        b

2        0        0        c
3        1      2          -

4      0        3      -


DAG FOR GIVEN EXPRESSION

 PTR     LEFT PTR        RIGHT PTR       LABEL


 0              0                0                a

 1              0                0                b

 2              0               0                  c

 3              1                2                -

 4              0                   3                -


RESULT:

Thus the program for implementation of DAG has been successfully executed and output is verified.

8. Implement any one storage allocation strategies STACK

Ex. No: 8
Date:
8.  Implement any one storage allocation strategies(Heap,Stack,Static)



MEMORY IN C – THE STACK, THE HEAP, AND STATIC

The great thing about C is that it is so intertwined with memory – and by that I mean that the programmer has quite a good understanding of “what goes where“. C has three different pools of memory.
– static: global variable storage, permanent for the entire run of the program.
– stack: local variable storage (automatic, continuous memory).
– heap: dynamic storage (large pool of memory, not allocated in contiguous order).

STATIC MEMORY

Static memory persists throughout the entire life of the program, and is usually used to store things like global variables, or variables created with the static clause. For example:
int theforce;
On many systems this variable uses 4 bytes of memory. This memory can come from one of two places. If a variable is declared outside of a function, it is considered global, meaning it is accessible anywhere in the program. Global variables are static, and there is only one copy for the entire program. Inside a function the variable is allocated on the stack. It is also possible to force a variable to be static using the static clause. For example, the same variable created inside a function using the static clause would allow it to be stored in static memory.
static int theforce;

STACK MEMORY

The stack is used to store variables used on the inside of a function (including the main()function). It’s a LIFO, “Last-In,-First-Out”, structure. Every time a function declares a new variable it is “pushed” onto the stack. Then when a function finishes running, all the variables associated with that function on the stack are deleted, and the memory they use is freed up. This leads to the “local” scope of function variables. The stack is a special region of memory, and automatically managed by the CPU – so you don’t have to allocate or deallocate memory. Stack memory is divided into successive frames where each time a function is called, it allocates itself a fresh stack frame.
Note that there is generally a limit on the size of the stack – which can vary with the operating system (for example OSX currently has a default stack size of 8MB). If a program tries to put too much information on the stack, stack overflow will occur. Stack overflow happens when all the memory in the stack has been allocated, and further allocations begin overflowing into other sections of memory. Stack overflow also occurs in situations where recursion is incorrectly used.
A summary of the stack:
the stack is managed by the CPU, there is no ability to modify it
variables are allocated and freed automatically
the stack it not limitless – most have an upper bound
the stack grows and shrinks as variables are created and destroyed
stack variables only exist whilst the function that created them exists
HEAP MEMORY
The heap is the diametrical opposite of the stack. The heap is a large pool of memory that can be used dynamically – it is also known as the “free store”. This is memory that is not automatically managed – you have to explicitly allocate (using functions such as malloc), and deallocate (e.g. free) the memory. Failure to free the memory when you are finished with it will result in what is known as a memory leak – memory that is still “being used”, and not available to other processes. Unlike the stack, there are generally no restrictions on the size of the heap (or the variables it creates), other than the physical size of memory in the machine. Variables created on the heap are accessible anywhere in the program.
Oh, and heap memory requires you to use pointers.
A summary of the heap:
the heap is managed by the programmer, the ability to modify it is somewhat boundless
in C, variables are allocated and freed using functions like malloc() and free()
the heap is large, and is usually limited by the physical memory available
the heap requires pointers to access it
AN EXAMPLE OF MEMORY USE
Consider the following example of a program containing all three forms of memory:
#include <stdio.h>
#include <stdlib.h>
int x;          

int main(void) 
{
    int y;   
    char *str; 

    y = 4;
    printf("stack memory: %d\n", y);

    str = malloc(100*sizeof(char)); 
    str[0] = 'm';
    printf("heap memory: %c\n", str[0]); 
    free(str);          
    return 0;
}
The variable x is static storage, because of its global nature. Both y and str are dynamic stack storage which is deallocated when the program ends. The function malloc() is used to allocate 100 pieces of of dynamic heap storage, each the size of char, to str. Conversely, the function free(), deallocates the memory associated with str.











AIM:

  To implement Stack storage allocation strategies using C program.


ALGORITHM:

Step-1: Initially check whether the stack is empty 
Step-2: Insert an element into the stack using push operation 
Step-3: Insert more elements onto the stack until stack becomes full 
Step-4: Delete an element from the stack using pop operation 
Step-5: Display the elements in the stack 
Step-6:Stop the program by exit





PROGRAM


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define size 5
struct stack
{
int s[size];
int top;
} st;
int stfull()
{
if (st.top >= size - 1)
return 1;
else
return 0; 
}
void push(int item)
{
st.top++;
st.s[st.top] = item;
}
int stempty()
{
if (st.top == -1)
return 1;
else
return 0;
}
int pop()
{
int item;
item = st.s[st.top];
st.top--;
return (item);
}
void display()
{
int i;
if (stempty())
printf("\nStack Is Empty!");
else
{
for (i = st.top; i >= 0; i--)
printf("\n%d", st.s[i]);

}
int main()
{
int item, choice;
char ans;
st.top = -1;
printf("\n\tImplementation Of Stack");
do {
printf("\nMain Menu");
printf("\n1.Push \n2.Pop \n3.Display \n4.exit");
printf("\nEnter Your Choice");
scanf("%d", &choice);
switch (choice)
{
case 1:
printf("\nEnter The item to be pushed");
scanf("%d", &item);
if (stfull())
printf("\nStack is Full!");
else
push(item);
break;
case 2:
if (stempty())
printf("\nEmpty stack!Underflow !!");
else
{
item = pop();
printf("\nThe popped element is %d", item);
}
break; 
case 3:
display();
break;
case 4:
goto halt;
}
printf("\nDo You want To Continue?");
ans = getche();
} while (ans == 'Y' || ans == 'y');
halt:
return 0;
}




OUTPUT:

     Implementation Of Stack
Main Menu
1.Push
2.Pop
3.Display
4.exit
Enter Your Choice 1

Enter The item to be pushed 10

Do You want To Continue?y
Main Menu
1.Push
2.Pop
3.Display
4.exit
Enter Your Choice 1

Enter The item to be pushed 20

Do You want To Continue?y
Main Menu
1.Push
2.Pop
3.Display
4.exit
Enter Your Choice1

Enter The item to be pushed 30
Do You want To Continue?y
Main Menu
1.Push
2.Pop
3.Display
4.exit
Do You want To Continue?y
Main Menu
1.Push
2.Pop
3.Display
4.exit
Enter Your Choice 2

The popped element is 30
Do You want To Continue?y
Main Menu
1.Push
2.Pop
3.Display
4.exit
Enter Your Choice3

20
10
Do You want To Continue?n










RESULT:

Thus the above program is compiled and executed successfully and output is verified.

data flow analysis in c program


Ex. No: 7 B
Date:
7B.  Implement Data flow analysis 

AIM:

  To write a C program to implement Data Flow Analysis.


INTRODUCTION:

Data flow analysis is a technique for gathering information about the possible set of value calculated at various points in a computer program.

ALGORITHM:

Step-1: Start the Program Execution.
Step-2: Read the total Numbers of Expression 
Step-3: Read the Left and Right side of Each Expressions 
Step-4: Display the Expressions with Line No
Step-5: Display the Data flow movement with Particular Expressions 
Step-6: Stop the Program Execution.


PROGRAM

#include <stdio.h>
#include <conio.h>
#include <string.h >
struct op
{
char l[20];
char r[20];
}
op[10], pr[10];

void main()
{
int a, i, k, j, n, z = 0, m, q,lineno=1;
char * p, * l;
char temp, t;
char * tem;char *match;
clrscr();
printf("enter no of values");
scanf("%d", & n);
for (i = 0; i < n; i++)
{
printf("\tleft\t");
scanf("%s",op[i].l);
printf("\tright:\t");
scanf("%s", op[i].r);
}
printf("intermediate Code\n");
for (i = 0; i < n; i++)
{   printf("Line No=%d\n",lineno);
printf("\t\t\t%s=", op[i].l);
printf("%s\n", op[i].r);lineno++;
}
printf("***Data Flow Analysis for the Above Code ***\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
match=strstr(op[j].r,op[i].l);
if(match)
{
printf("\n %s is live at  %s \n ", op[i].l,op[j].r);
}
}
}}
OUTPUT:

Enter no of values
4
        left    a
        right:  a+b
        left    b
        right:  a+c
        left    c
        right:  a+b
        left    d
        right:  b+c+d
 Line No=1
 a=a+b
 Line No=2
 b=a+c
Line No=3
                        c=a+b
Line No=4
                        d=b+c+d
***Data Flow Analysis for the Above Code ***

 a is live at  a+b

 a is live at  a+c

 a is live at  a+b

 b is live at  a+b

 b is live at  a+b

 b is live at  b+c+d

 c is live at  a+c

 c is live at  b+c+d

 d is live at  b+c+d



RESULT:

Thus the above program is compiled and executed successfully and output is verified.

7A. Implement control flow analysis

Ex. No: 7A
Date:
7A.  Implement control flow analysis

AIM:

  To write a C program to implement Control Flow Analysis.


INTRODUCTION:

Control flow analysis can be represented by basic blocks. It depicts how the program control is being passed among the blocks.

ALGORITHM:

Step-1: Start the Program Execution.

Step-2: Declare the necessary variables for accessing statements from cdp7.txt
Step-3: Find out the Leaders, Conditional Statements and blocks from the file.
Step-4: Display the blocks with Block No.
Step-5: Display the Control flow movement with block Number.
Step-6: Stop the Program Execution.

PROGRAM

CDP7A.C
# include<stdio.h>
# include<conio.h>
#include<alloc.h>
#include<string.h>
struct Listnode
{
char data[50];
int leader,block,u_goto,c_goto;
struct Listnode *next;
char label[10],target[10];
}*temp,*cur,*first=NULL,*last=NULL,*cur1;

FILE *fpr;
void createnode(char code[50])
{
temp=(struct Listnode *)malloc(sizeof(struct Listnode));
strcpy(temp->data,code);
strcpy(temp->label,'\0');
strcpy(temp->target,'\0');

temp->leader=0;
temp->block=0;
temp->u_goto=0;
temp->c_goto=0;
temp->next=NULL;

if(first==NULL)
{
first=temp;
last=temp;
}
else
{
last->next=temp;
last=temp;
}
}

void main()
{
char codeline[50];
char c,dup[50],target[10];
char *substring,*token;
int i=0,block,block1;
int j=0;
fpr= fopen("CDP7.txt","r");
clrscr();
while((c=getc(fpr))!=EOF)
{
if(c!='\n')
{
codeline[i]=c;
i++;
}
else
{
codeline[i]='\0';
createnode(codeline);
i=0;
}
}
//create last node
codeline[i]='\0';
createnode(codeline);
fclose(fpr);
// find out leaders,conditional stmts
cur=first;
cur->leader=1;
while(cur!=NULL)
{
substring=strstr((cur->data),"if");
if(substring==NULL)
{
if((strstr((cur->data),"goto"))!=NULL)
{
cur->u_goto=1;
(cur->next)->leader=1;
}
}
else
{
cur->c_goto=1;
(cur->next)->leader=1;
}
substring=strstr((cur->data),":");
if(substring!=NULL)
{
cur->leader=1;
}
substring=strstr((cur->data),"call");
if(substring!=NULL)
{
cur->leader=1;
}
if(strstr(cur->data,"return")!=NULL)
{
cur->leader=1;
(cur->next)->leader=1;
}
cur=cur->next;
}
//to find labels and targets
cur=first;
while(cur!=NULL)
{
if((cur->u_goto==1)||(cur->c_goto==1))
{
substring=strstr(cur->data,":");
if(substring!=NULL)
{
token=strstr(substring,"L" );
if(token!=NULL)
strcpy(cur->target,token);
}
else
{
substring=strstr(cur->data,"L");
if(substring!=NULL)
strcpy(cur->target,substring);
}
}

if(strstr(cur->data,":")!=NULL)
{
strcpy(dup,cur->data);
token=strtok(dup,":");
// printf("\ntoken:%s",token);
if(token!=NULL)
strcpy(cur->label,token);
}
cur=cur->next;
}
//to identify blocks
cur=first;
while(cur!= NULL)
{
cur=cur->next;
if((cur->leader)==1)
{
j++;
cur->block=j;
}
else
cur->block=j;
}
printf("\n\n......Basic Blocks......\n");
cur=first;
j=0;
printf("\nBlock %d:",j);
while(cur!=NULL)
{

if ((cur->block)==j)
{

printf("%s",cur->data);
printf("\n\t");
cur=cur->next;
}
else
{
j++;
printf("\nBlock %d:",j);
}

}
//to output the control flow from each block
printf ("\t\t.......Control Flow.......\n\n");
cur=first;
i=0;
while(cur!=NULL)
{
if((cur->block)!=(cur->next)->block)
{
block=cur->block;
if(cur->u_goto==1)
{
strcpy(target,cur->target);
cur1=first;
while(cur1!=NULL)
{
if(strcmp(cur1->label,target)==0)
{
block1=cur1->block;
printf("\t\tBlock%d---------->Block%d\n",block,block1);
}
cur1=cur1->next;
}
}
else if(cur->c_goto==1)
{
strcpy(target,cur->target);
cur1=first;
while(cur1!=NULL)
{
if(strcmp(cur1->label,target)==0)
{
block1=cur1->block;
printf("\t\tBlock%d---TRUE--->Block%d---FALSE--->Block%d\n",block,block1,(block+1));
}
cur1=cur1->next;
}
}
else if(strstr(cur->data,"return")==NULL)
{
printf("\t\tBlock%d---------->Block%d\n",block,(block+1));
}
else
printf("\t\tBlock%d---------->NULL\n",block);
}

cur=cur->next;
}
cur=last;
block= cur->block;
printf("\t\tBlock%d--------->NULL",block);
getch();
}




CDP7.TXT

m <- 0
v <- 0
L1 :  if v < n goto L2
r <- v
s <- 0
return
L2 : if r >= n goto L1
v <- v + 1

OUTPUT:

......Basic Blocks......

Block 0:m <- 0
        v <- 0

Block 1:L1 :  if v < n goto L2

Block 2:r <- v
        s <- 0

Block 3:return

Block 4:L2 : if r >= n goto L1

Block 5:v <- v + 1

.......Control Flow.......

                Block0---------->Block1
                Block 1---TRUE--->Block 4---FALSE--->Block 2   
                Block2---------->Block3
Block3---------->NULL
Block 4---TRUE--->Block 1---FALSE--->Block 5
                Block5--------->NULL












RESULT:

Thus the above program is compiled and executed successfully and output is verified.

11. Implementation of Simple Code Optimization Techniques (Constant Folding.,etc.)

Ex. No: 11 Date:                   11. Implementation of Simple Code Optimization Techniques (Constant Folding.,etc.) ...