Next:Number of iterations analysis, Previous:Scalar evolutions, Up:Analysis and Representation of Loops [Contents][Index]
The induction variable on RTL is simple and only allows analysis ofaffine induction variables, and only in one loop at once. The interfaceis declared incfgloop.h. Before analyzing induction variablesin a loop L,iv_analysis_loop_init function must be called on L.After the analysis (possibly callingiv_analysis_loop_init forseveral loops) is finished,iv_analysis_done should be called.The following functions can be used to access the results of theanalysis:
iv_analyze: Analyzes a single register used in the giveninsn. If no use of the register in this insn is found, the followinginsns are scanned, so that this function can be called on the insnreturned by get_condition.iv_analyze_result: Analyzes result of the assignment in thegiven insn.iv_analyze_expr: Analyzes a more complicated expression.All its operands are analyzed byiv_analyze, and hence they mustbe used in the specified insn or one of the following insns.The description of the induction variable is provided instructrtx_iv. In order to handle subregs, the representation is a bitcomplicated; if the value of theextend field is notUNKNOWN, the value of the induction variable in the i-thiteration is
delta + mult * extend_{extend_mode} (subreg_{mode} (base + i * step)),with the following exception: iffirst_special is true, then thevalue in the first iteration (wheni is zero) isdelta +mult * base. However, ifextend is equal toUNKNOWN,thenfirst_special must be false,delta 0,mult 1and the value in the i-th iteration is
subreg_{mode} (base + i * step)The functionget_iv_value can be used to perform thesecalculations.
Next:Number of iterations analysis, Previous:Scalar evolutions, Up:Analysis and Representation of Loops [Contents][Index]