Consider the following code segment.

x = u - t; y = x * v; x = y + w; y = t - z; y = x * y;

The minimum number of total variables required to convert the above code segment to static single assignment form is

GATE Exam | Aptitude Questions | GATE Syllabus | GATE Result | Mock Test | GATE Preparation

0 votes

Consider the following code segment.

x = u - t; y = x * v; x = y + w; y = t - z; y = x * y;

The minimum number of total variables required to convert the above code segment to static single assignment form is

0 votes

In compiler design, **static single assignment form** (often abbreviated as **SSA form** or simply **SSA**) is a property of an intermediate representation (IR), which requires that each variable is assigned exactly once, and every variable is defined before it is used. Existing variables in the original IR are split into *versions*, new variables typically indicated by the original name:

x = u - t;

y = x * v;

x = y + w;

y = t - z;

y = x * y;

The value of x being used in the second line comes from the first assignment of x. A program would have to perform reaching definition analysis to determine this. But if the program is in SSA form, both of these are immediate and so the other variables like y:

x1 = u - t;

y1 = x1 * v;

x2 = y1 + w;

y2 = t - z;

y3 = x2 * y2;

Total distinct variables used are: t, u, x1, v, y1, w, x2, z, y2, y3

Hence the answer is 10 variables

- All categories
- Computer Science & Information Technology 452
- Mathematics 80
- Aptitude Questions 114
- GATE 94
- Online Aptitude Test 6
- Gate Exam 22
- Gate Syllabus 6
- Gate Preparation 35
- Gate Coaching 14
- Online Registration 20
- Electronics and Communication (EC) 0
- Electrical Engineering (EE) 3
- Civil Engineering (CE) 0
- Mechanical Engineering (ME) 2
- Aerospace Engineering (AE) 0
- Agricultural Engineering (AG) 0
- Architecture and Planning (AR) 0
- Biotechnology (BT) 0
- Chemical Engineering (CH) 1
- Chemistry (CY) 0
- Ecology and Evolution (EY) 0
- Geology and Geophysics (GG) 0
- Instrumentation Engineering (IN) 0
- Mining Engineering (MN) 0
- Petroleum Engineering (PE) 0
- Physics (PH) 0
- Production and Industrial Engineering (PI) 1
- Textile Engineering and Fibre Science (TF) 0
- Engineering Sciences 1
- Life Sciences 2
- Mathematics (MA) 0