DefinitionInstruction并不总是有效

问题描述:


我一直试图通过分析包含所述循环的MSIL二进制文件来检测数组循环中的迭代次数。这是我一直试图分析的来源:

I've been trying to detect the number of iterations in loops over an array by analyzing MSIL binaries containing said loops. Here's the source I've been trying to analyze:

















public static void TestArray()
{
int size = 15;
int [] test = new int [size];
for int i = 12; i< = 89; + + I);
}
public static void TestArray()  
{  
    int size = 15;  
    int[] test = new int[size];  
    for (int i = 12; i <= 89; ++i) ;  

DefinitionInstruction仅适用于SSA中的操作数,或者是表达式临时值。 tv291-既不是。我们有不同的SSA风格(在SSA结构的参数中指定)。您似乎已经使用了"unaliased"消息。 flavor(有时称为NotAliasedScalars),它在SSA图中不包含别名变量。切换到"别名" SSA将在SSA中包含tv291-。
DefinitionInstruction only works for operands that are in SSA, or are expression temporaries.  tv291- is neither.  We have different flavors of SSA (specified in arguments to the SSA construction).  It appears that you have used the "unaliased" flavor (sometimes referred to as NotAliasedScalars), which does not include aliased variables in the SSA graph.  Switching to "aliased" SSA would include tv291- in SSA.