Rishikesh Agrawal ROLL NO:A-09 REG NO:11006753

Course Code : CSE318 Course Title: System Software Section :K2R12 Max. Marks: 30

Q1. In what phase is the elimination of common sub expressions performed? Why?

Ans1 Eliminating common sub expression is a technique that has been used successfully in Compiler Construction.The idea is to enhance a program by detecting common pieces of code:if two pieces are equivalent,one piece can be omiited.Hence a reduction in execution time and memory usage is achieved.Common sub expressions are also a feature of many constraint models.Elimination of common subexpressions involves identification of expressions which have been explicitly evaluated in separate blocks but whose operands have not changed between the evaluations .If at the first occurrence of the common expression ,the value is assigned to a temporary varirable then subsequent occurrences of the same expression can be replaced by the temporary variable.Constraint solving of a combinatorial problem such as “TIME TABLING or PLANNING”,proceeds in two phases.First ,the problem is modeled as a set of decision variables and a set of constraints on those variables that a solution must satisfy.A decision variable represents a choice that must be made in order to solve the problem.The domain of potential values associated with each decision variable corresponds to the options for that choice.The second phase consists of using a constraint solver to search for solutions to the model:assignments of values to decision variables satisfying all constraints.
Q2. What problem is encountered when symbols in Assembler are used before their definition? How is this problem overcome? ANS.2.

Source program

First pass RELATIVE ADDRESS MNEMONICS INSTRUCTION

Second pass RELATIVE ADDRESS MNEMONICS INSTRUCTIO N

JACK STA 0 RT USI *.1 5) .16(0.15 NG L 1.-(0.FIVE 0 L 1.15) 0 L 1.

.FOUR 4 A 1. the instruction at address of FIVE Smce no base index register is used as bae register and pointing to beginning of this program.15) 4 A 1. Ans.tells assembler that register 15 is the base register .START instruction and it is a pseudo op instruction giving JACK a name of this program Assembler pass the name to the loader Next instruction USING pseudoop.5) 12 16 20 5 4 TEMP DS EN D INTERMIDIATE STEP IN ASSEMBLING THE PROGRAM In this program.-(0. Design a two pass assembler with the help of neat flowcharts.1 5) ST FOUR DC FIVE DC 1.4.-(0. Q4.A 1.12(0.The location counter indicating relative address of instructions being passed.The instruction L1 FIVE LOAD.TEMP F'4' F'5' 1F 8 12 16 20 ST 4 5 - 1.

Sign up to vote on this title
UsefulNot useful