1# * Copyright 2016, NICTA 2# * 3# * This software may be distributed and modified according to the terms 4# of 5# * the BSD 2-Clause license. Note that NO WARRANTY is provided. 6# * See "LICENSE_BSD2.txt" for details. 7# * 8# * @TAG(NICTA_BSD) 9def phyAddrP(p_n,p): 10 _,x = p.node_tags[p_n] 11 f_name,g_addr = x 12 return g_addr 13 14def callNodes(p, fs= None): 15 ret = [n for n in p.nodes if isCall(p.nodes[n])] 16 if fs: 17 ret = [n for n in ret if p.nodes[n].fname in fs] 18 return ret 19 20def gToPAddrP(n,p,may_multi=False,may_empty=False): 21 matches = [x for x in p.node_tags if p.node_tags[x][1][1] == n and p.node_tags[1][0] != 'LoopReturn'] 22 if may_empty and not matches: 23 return matches 24 assert matches 25 if may_multi: 26 return matches 27 assert len(matches) == 1 28 return matches[0] 29 30def isCall(node): 31 return node.kind == 'Call' 32 33def toHexs(l): 34 return [hex(x) for x in l] 35