Skip to content

Graph Matching: Algorithm

Sandeep Dasgupta edited this page Aug 25, 2019 · 4 revisions
/*
  main_driver is responsible for matching the data-flow
  sub-graphs for each instruction in x86_code 
*/
main_driver(X86_code):
  for each instruction "I" in X86_code (following the control flow):
    for each "node" of the data-flow graph of "I" in topological order:
      matchNode(node)

matchNode(x86_node)
  if x86_node.cand == "" {
     // findLLVMCandidates should make sure that all the parents simultaneious
    // agree on x86_node
     x86_node.cand = findLLVMCandidates(x86_node, x86_node.parent)
  }
Clone this wiki locally