Skip to content

Commit

Permalink
lift: identify tail calls at register relative memory references
Browse files Browse the repository at this point in the history
  • Loading branch information
mewmew committed Jun 12, 2017
1 parent 32bd473 commit 4f979b1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lift/terminator.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,23 @@ func (f *Func) isTailCall(inst *x86.Inst) bool {
return false
}
}

// TODO: Find a prettier solution for handling indirect jumps to potential
// tail call functions at register relative memory locations; e.g.
// JMP [EAX+0x8]

// HACK: set the current basic block to a dummy basic block so that we may
// invoke f.getFunc (which may emit load instructions) to figure out if we
// are jumping to a function.
cur := f.cur
dummy := &ir.BasicBlock{}
f.cur = dummy
_, _, _, ok := f.getFunc(arg)
f.cur = cur
if ok {
return true
}

fmt.Println("arg:", arg)
pretty.Println(arg)
panic("not yet implemented")
Expand Down

0 comments on commit 4f979b1

Please sign in to comment.