loopAnalysis | R Documentation |
When analyzing loops, it is good to first call
runLoopPass
on the Module-class
to transform, simplify and canonicalize the loops in the
Function-class
s. This only needs to be done
once as it applies to all of the functions.
Many of the functions that query individual characteristics of a loop
only need the Loop-class
itself.
However, some other functions such as getBounds
also require
an additional argument (a ScalarEvolution-class
object)
and the results change if that is created after the loops are obtained.
Accordingly, it is useful to call loopAnalysis
on a
Function-class
to get all the elements that will be needed to query all
loopAnalysis(fun)
DominatorTree(fun, ...)
PostDominatorTree(fun, ...)
runLoopPass(mod, passes = list(.Call("R_createLoopSimplifyCFGPass")),
mgr = passManager(mod))
fun |
the |
mod |
the |
passes |
a list of |
mgr |
the legacy |
... |
arguments for methods |
A list with three elements
dominatorTree |
the |
loopInfo |
the |
scalarEvolution |
the |
These elements are used in various functions that access information about the loops.
DTL
https://llvm.org/docs/LoopTerminology.html
getBounds
and other functions for querying
loop information.
f = system.file("IR/lengths.ir", package = "Rllvm")
m = parseIR(f)
runLoopPass(m)
la = loopAnalysis(m$two)
loop = getLoops(la)[[1]]
getBounds(loop, la)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.