Holooly Plus Logo

Input / Question:

Input / Question:

Construct the DAG and show the optimized sequence of atoms for the C++ expression (a – b) ∗ c + d ∗ (a – b) ∗ c. The atoms produced by the parser are shown below:

 

(SUB, a, b, T1)

(MUL, T1, c, T2)

(SUB, a, b, T3)

(MUL, d, T3, T4)

(MUL, T4, c, T5)

(ADD, T2, T5, T6)

Verified

Output/Answer

(SUB, a, b, T1.3)

(MUL, d, T1.3, T4)

(MUL, T4, c, T5)

(MUL, T1.3, c, T2)

(ADD, T2, T5, T6)

Capture