thavlak: code style changes
This commit is contained in:
parent
170cb4f4cb
commit
9eee15f668
1 changed files with 20 additions and 18 deletions
|
|
@ -110,7 +110,7 @@ proc setNestingLevel(self: ref SimpleLoop, level: int) =
|
||||||
self.nestingLevel = level
|
self.nestingLevel = level
|
||||||
if level == 0: self.isRoot = true
|
if level == 0: self.isRoot = true
|
||||||
|
|
||||||
var loop_counter: int = 0
|
var loopCounter: int = 0
|
||||||
|
|
||||||
type
|
type
|
||||||
Lsg = object
|
Lsg = object
|
||||||
|
|
@ -119,8 +119,8 @@ type
|
||||||
|
|
||||||
proc createNewLoop(self: var Lsg): ref SimpleLoop =
|
proc createNewLoop(self: var Lsg): ref SimpleLoop =
|
||||||
result = newSimpleLoop()
|
result = newSimpleLoop()
|
||||||
loop_counter += 1
|
loopCounter += 1
|
||||||
result.counter = loop_counter
|
result.counter = loopCounter
|
||||||
|
|
||||||
proc addLoop(self: var Lsg, l: ref SimpleLoop) =
|
proc addLoop(self: var Lsg, l: ref SimpleLoop) =
|
||||||
self.loops.add l
|
self.loops.add l
|
||||||
|
|
@ -196,7 +196,9 @@ proc newHavlakLoopFinder(cfg: Cfg, lsg: Lsg): HavlakLoopFinder =
|
||||||
proc isAncestor(w: int, v: int, last: seq[int]): bool =
|
proc isAncestor(w: int, v: int, last: seq[int]): bool =
|
||||||
w <= v and v <= last[w]
|
w <= v and v <= last[w]
|
||||||
|
|
||||||
proc dfs(currentNode: ref BasicBlock, nodes: var seq[ref UnionFindNode], number: var Table[ref BasicBlock, int], last: var seq[int], current: int): int =
|
proc dfs(currentNode: ref BasicBlock, nodes: var seq[ref UnionFindNode],
|
||||||
|
number: var Table[ref BasicBlock, int],
|
||||||
|
last: var seq[int], current: int): int =
|
||||||
var stack = @[(currentNode, current)]
|
var stack = @[(currentNode, current)]
|
||||||
while stack.len > 0:
|
while stack.len > 0:
|
||||||
let (currentNode, current) = stack.pop()
|
let (currentNode, current) = stack.pop()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue