Machine-translated by Google. Questions are authored in English.
Top

Discussion

Tree pattern matching for instruction selection works by

  • A.searching the symbol table for a pattern that fits each name
  • B.covering the expression tree with patterns, each naming an instruction
  • C.comparing the source text against a table of known programs
  • D.matching the token stream against the pattern written for each token

Answer: B

Correct answer: covering the expression tree with patterns, each naming an instruction

Each instruction is described as a small tree pattern, and generating code means tiling the expression tree with those patterns so that every node is covered. Dynamic programming finds the cheapest tiling for a tree, which makes instruction selection systematic rather than a matter of hand-written cases.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.