cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/ 0000755 0001750 0001750 00000000000 11620326252 017357 5 ustar laney laney cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ 0000755 0001750 0001750 00000000000 11620326252 023010 5 ustar laney laney cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/AssemblyInfo.cs 0000644 0001750 0001750 00000003255 11620326252 025737 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System.Reflection;
#if !EMBEDDED
[assembly: AssemblyTitle ("Cecil.FlowAnalysis")]
[assembly: AssemblyDescription ("A flow analysis framework for Mono.Cecil")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("db4objects Inc.")]
[assembly: AssemblyProduct ("Cecil.FlowAnalysis")]
[assembly: AssemblyCopyright ("(C) db4objects Inc.")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
[assembly: AssemblyVersion("0.1.0.0")]
#if KEYFILE
[assembly: AssemblyKeyFile("../../../mcs/class/mono.snk")]
#endif
#endif
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Utilities/ 0000755 0001750 0001750 00000000000 11620326252 024763 5 ustar laney laney ././@LongLink 0000000 0000000 0000000 00000000151 00000000000 011562 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Utilities/AbstractInstructionVisitor.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Utilities/AbstractInstructionVisito0000644 0001750 0001750 00000073511 11620326252 032120 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using System;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.Utilities {
public class AbstractInstructionVisitor : IInstructionVisitor {
public virtual void OnNop (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBreak (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdarg_0 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdarg_1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdarg_2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdarg_3 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdloc_0 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdloc_1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdloc_2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdloc_3 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStloc_0 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStloc_1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStloc_2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStloc_3 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdarg (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdarga (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStarg (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdloc (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdloca (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStloc (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdnull (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_M1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_0 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_3 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_5 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_6 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_7 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4_8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_R4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdc_R8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnDup (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnPop (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnJmp (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCall (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCalli (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnRet (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBr (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBrfalse (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBrtrue (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBeq (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBge (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBgt (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBle (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBlt (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBne_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBge_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBgt_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBle_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBlt_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnSwitch (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_I1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_U1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_I2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_U2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_U4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_I (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_R4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_R8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdind_Ref (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_Ref (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_I1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_I2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_R4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_R8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnAdd (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnSub (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnMul (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnDiv (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnDiv_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnRem (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnRem_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnAnd (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnOr (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnXor (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnShl (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnShr (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnShr_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnNeg (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnNot (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_I1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_I2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_R4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_R8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_U4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_U8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCallvirt (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCpobj (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdobj (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdstr (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnNewobj (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCastclass (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnIsinst (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_R_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnUnbox (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnThrow (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdfld (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdflda (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStfld (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdsfld (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdsflda (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStsfld (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStobj (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I1_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I2_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I4_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I8_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U1_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U2_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U4_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U8_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnBox (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnNewarr (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdlen (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelema (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_I1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_U1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_I2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_U2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_U4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_I (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_R4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_R8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_Ref (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_I (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_I1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_I2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_R4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_R8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_Ref (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdelem_Any (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStelem_Any (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnUnbox_Any (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U4 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U8 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnRefanyval (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCkfinite (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnMkrefany (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdtoken (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_U2 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_U1 (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_I (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_I (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_Ovf_U (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnAdd_Ovf (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnAdd_Ovf_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnMul_Ovf (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnMul_Ovf_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnSub_Ovf (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnSub_Ovf_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnEndfinally (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLeave (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnStind_I (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnConv_U (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnArglist (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCeq (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCgt (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCgt_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnClt (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnClt_Un (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdftn (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLdvirtftn (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnLocalloc (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnEndfilter (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnUnaligned (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnVolatile (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnTail (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnInitobj (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnCpblk (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnInitblk (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnRethrow (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnSizeof (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public virtual void OnRefanytype (Instruction instruction)
{
throw new NotImplementedException (Formatter.FormatInstruction (instruction));
}
public void Visit (Instruction instruction)
{
InstructionDispatcher.Dispatch (instruction, this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Utilities/IInstructionVisitor.cs 0000644 0001750 0001750 00000023272 11620326252 031332 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.Utilities {
public interface IInstructionVisitor {
void OnNop (Instruction instruction);
void OnBreak (Instruction instruction);
void OnLdarg_0 (Instruction instruction);
void OnLdarg_1 (Instruction instruction);
void OnLdarg_2 (Instruction instruction);
void OnLdarg_3 (Instruction instruction);
void OnLdloc_0 (Instruction instruction);
void OnLdloc_1 (Instruction instruction);
void OnLdloc_2 (Instruction instruction);
void OnLdloc_3 (Instruction instruction);
void OnStloc_0 (Instruction instruction);
void OnStloc_1 (Instruction instruction);
void OnStloc_2 (Instruction instruction);
void OnStloc_3 (Instruction instruction);
void OnLdarg (Instruction instruction);
void OnLdarga (Instruction instruction);
void OnStarg (Instruction instruction);
void OnLdloc (Instruction instruction);
void OnLdloca (Instruction instruction);
void OnStloc (Instruction instruction);
void OnLdnull (Instruction instruction);
void OnLdc_I4_M1 (Instruction instruction);
void OnLdc_I4_0 (Instruction instruction);
void OnLdc_I4_1 (Instruction instruction);
void OnLdc_I4_2 (Instruction instruction);
void OnLdc_I4_3 (Instruction instruction);
void OnLdc_I4_4 (Instruction instruction);
void OnLdc_I4_5 (Instruction instruction);
void OnLdc_I4_6 (Instruction instruction);
void OnLdc_I4_7 (Instruction instruction);
void OnLdc_I4_8 (Instruction instruction);
void OnLdc_I4 (Instruction instruction);
void OnLdc_I8 (Instruction instruction);
void OnLdc_R4 (Instruction instruction);
void OnLdc_R8 (Instruction instruction);
void OnDup (Instruction instruction);
void OnPop (Instruction instruction);
void OnJmp (Instruction instruction);
void OnCall (Instruction instruction);
void OnCalli (Instruction instruction);
void OnRet (Instruction instruction);
void OnBr (Instruction instruction);
void OnBrfalse (Instruction instruction);
void OnBrtrue (Instruction instruction);
void OnBeq (Instruction instruction);
void OnBge (Instruction instruction);
void OnBgt (Instruction instruction);
void OnBle (Instruction instruction);
void OnBlt (Instruction instruction);
void OnBne_Un (Instruction instruction);
void OnBge_Un (Instruction instruction);
void OnBgt_Un (Instruction instruction);
void OnBle_Un (Instruction instruction);
void OnBlt_Un (Instruction instruction);
void OnSwitch (Instruction instruction);
void OnLdind_I1 (Instruction instruction);
void OnLdind_U1 (Instruction instruction);
void OnLdind_I2 (Instruction instruction);
void OnLdind_U2 (Instruction instruction);
void OnLdind_I4 (Instruction instruction);
void OnLdind_U4 (Instruction instruction);
void OnLdind_I8 (Instruction instruction);
void OnLdind_I (Instruction instruction);
void OnLdind_R4 (Instruction instruction);
void OnLdind_R8 (Instruction instruction);
void OnLdind_Ref (Instruction instruction);
void OnStind_Ref (Instruction instruction);
void OnStind_I1 (Instruction instruction);
void OnStind_I2 (Instruction instruction);
void OnStind_I4 (Instruction instruction);
void OnStind_I8 (Instruction instruction);
void OnStind_R4 (Instruction instruction);
void OnStind_R8 (Instruction instruction);
void OnAdd (Instruction instruction);
void OnSub (Instruction instruction);
void OnMul (Instruction instruction);
void OnDiv (Instruction instruction);
void OnDiv_Un (Instruction instruction);
void OnRem (Instruction instruction);
void OnRem_Un (Instruction instruction);
void OnAnd (Instruction instruction);
void OnOr (Instruction instruction);
void OnXor (Instruction instruction);
void OnShl (Instruction instruction);
void OnShr (Instruction instruction);
void OnShr_Un (Instruction instruction);
void OnNeg (Instruction instruction);
void OnNot (Instruction instruction);
void OnConv_I1 (Instruction instruction);
void OnConv_I2 (Instruction instruction);
void OnConv_I4 (Instruction instruction);
void OnConv_I8 (Instruction instruction);
void OnConv_R4 (Instruction instruction);
void OnConv_R8 (Instruction instruction);
void OnConv_U4 (Instruction instruction);
void OnConv_U8 (Instruction instruction);
void OnCallvirt (Instruction instruction);
void OnCpobj (Instruction instruction);
void OnLdobj (Instruction instruction);
void OnLdstr (Instruction instruction);
void OnNewobj (Instruction instruction);
void OnCastclass (Instruction instruction);
void OnIsinst (Instruction instruction);
void OnConv_R_Un (Instruction instruction);
void OnUnbox (Instruction instruction);
void OnThrow (Instruction instruction);
void OnLdfld (Instruction instruction);
void OnLdflda (Instruction instruction);
void OnStfld (Instruction instruction);
void OnLdsfld (Instruction instruction);
void OnLdsflda (Instruction instruction);
void OnStsfld (Instruction instruction);
void OnStobj (Instruction instruction);
void OnConv_Ovf_I1_Un (Instruction instruction);
void OnConv_Ovf_I2_Un (Instruction instruction);
void OnConv_Ovf_I4_Un (Instruction instruction);
void OnConv_Ovf_I8_Un (Instruction instruction);
void OnConv_Ovf_U1_Un (Instruction instruction);
void OnConv_Ovf_U2_Un (Instruction instruction);
void OnConv_Ovf_U4_Un (Instruction instruction);
void OnConv_Ovf_U8_Un (Instruction instruction);
void OnConv_Ovf_I_Un (Instruction instruction);
void OnConv_Ovf_U_Un (Instruction instruction);
void OnBox (Instruction instruction);
void OnNewarr (Instruction instruction);
void OnLdlen (Instruction instruction);
void OnLdelema (Instruction instruction);
void OnLdelem_I1 (Instruction instruction);
void OnLdelem_U1 (Instruction instruction);
void OnLdelem_I2 (Instruction instruction);
void OnLdelem_U2 (Instruction instruction);
void OnLdelem_I4 (Instruction instruction);
void OnLdelem_U4 (Instruction instruction);
void OnLdelem_I8 (Instruction instruction);
void OnLdelem_I (Instruction instruction);
void OnLdelem_R4 (Instruction instruction);
void OnLdelem_R8 (Instruction instruction);
void OnLdelem_Ref (Instruction instruction);
void OnStelem_I (Instruction instruction);
void OnStelem_I1 (Instruction instruction);
void OnStelem_I2 (Instruction instruction);
void OnStelem_I4 (Instruction instruction);
void OnStelem_I8 (Instruction instruction);
void OnStelem_R4 (Instruction instruction);
void OnStelem_R8 (Instruction instruction);
void OnStelem_Ref (Instruction instruction);
void OnLdelem_Any (Instruction instruction);
void OnStelem_Any (Instruction instruction);
void OnUnbox_Any (Instruction instruction);
void OnConv_Ovf_I1 (Instruction instruction);
void OnConv_Ovf_U1 (Instruction instruction);
void OnConv_Ovf_I2 (Instruction instruction);
void OnConv_Ovf_U2 (Instruction instruction);
void OnConv_Ovf_I4 (Instruction instruction);
void OnConv_Ovf_U4 (Instruction instruction);
void OnConv_Ovf_I8 (Instruction instruction);
void OnConv_Ovf_U8 (Instruction instruction);
void OnRefanyval (Instruction instruction);
void OnCkfinite (Instruction instruction);
void OnMkrefany (Instruction instruction);
void OnLdtoken (Instruction instruction);
void OnConv_U2 (Instruction instruction);
void OnConv_U1 (Instruction instruction);
void OnConv_I (Instruction instruction);
void OnConv_Ovf_I (Instruction instruction);
void OnConv_Ovf_U (Instruction instruction);
void OnAdd_Ovf (Instruction instruction);
void OnAdd_Ovf_Un (Instruction instruction);
void OnMul_Ovf (Instruction instruction);
void OnMul_Ovf_Un (Instruction instruction);
void OnSub_Ovf (Instruction instruction);
void OnSub_Ovf_Un (Instruction instruction);
void OnEndfinally (Instruction instruction);
void OnLeave (Instruction instruction);
void OnStind_I (Instruction instruction);
void OnConv_U (Instruction instruction);
void OnArglist (Instruction instruction);
void OnCeq (Instruction instruction);
void OnCgt (Instruction instruction);
void OnCgt_Un (Instruction instruction);
void OnClt (Instruction instruction);
void OnClt_Un (Instruction instruction);
void OnLdftn (Instruction instruction);
void OnLdvirtftn (Instruction instruction);
void OnLocalloc (Instruction instruction);
void OnEndfilter (Instruction instruction);
void OnUnaligned (Instruction instruction);
void OnVolatile (Instruction instruction);
void OnTail (Instruction instruction);
void OnInitobj (Instruction instruction);
void OnCpblk (Instruction instruction);
void OnInitblk (Instruction instruction);
void OnRethrow (Instruction instruction);
void OnSizeof (Instruction instruction);
void OnRefanytype (Instruction instruction);
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Utilities/Formatter.cs 0000644 0001750 0001750 00000011641 11620326252 027260 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.IO;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.Utilities {
///
///
public class Formatter {
public static string FormatInstruction (Instruction instruction)
{
StringWriter writer = new StringWriter ();
WriteInstruction (writer, instruction);
return writer.ToString ();
}
public static string FormatMethodBody (MethodDefinition method)
{
StringWriter writer = new StringWriter ();
WriteMethodBody (writer, method);
return writer.ToString ();
}
public static void WriteMethodBody (TextWriter writer, MethodDefinition method)
{
writer.WriteLine (method);
foreach (Instruction instruction in method.Body.Instructions) {
writer.Write ('\t');
WriteInstruction (writer, instruction);
writer.WriteLine ();
}
}
public static void WriteInstruction (TextWriter writer, Instruction instruction)
{
writer.Write (FormatLabel (instruction.Offset));
writer.Write (": ");
writer.Write (instruction.OpCode.Name);
if (null != instruction.Operand) {
writer.Write (' ');
WriteOperand (writer, instruction.Operand);
}
}
private static string FormatLabel (int offset)
{
string label = "000" + offset.ToString ("x");
return "IL_" + label.Substring (label.Length - 4);
}
private static void WriteOperand (TextWriter writer, object operand)
{
if (null == operand) throw new ArgumentNullException ("operand");
Instruction targetInstruction = operand as Instruction;
if (null != targetInstruction) {
writer.Write (FormatLabel (targetInstruction.Offset));
return;
}
Instruction [] targetInstructions = operand as Instruction [];
if (null != targetInstructions) {
WriteLabelList (writer, targetInstructions);
return;
}
VariableReference variableRef = operand as VariableReference;
if (null != variableRef) {
writer.Write (variableRef.Index.ToString ());
return;
}
MethodReference methodRef = operand as MethodReference;
if (null != methodRef) {
WriteMethodReference (writer, methodRef);
return;
}
string s = operand as string;
if (null != s) {
writer.Write ("\"" + s + "\"");
return;
}
s = ToInvariantCultureString (operand);
writer.Write (s);
}
static void WriteLabelList (TextWriter writer, Instruction [] instructions)
{
writer.Write ("(");
for (int i = 0; i < instructions.Length; i++) {
if (i != 0) writer.Write (", ");
writer.Write (FormatLabel (instructions [i].Offset));
}
writer.Write (")");
}
public static string ToInvariantCultureString (object value)
{
IConvertible convertible = value as IConvertible;
return (null != convertible)
? convertible.ToString (System.Globalization.CultureInfo.InvariantCulture)
: value.ToString ();
}
private static void WriteMethodReference (TextWriter writer, MethodReference method)
{
writer.Write (FormatTypeReference (method.ReturnType));
writer.Write (' ');
writer.Write (FormatTypeReference (method.DeclaringType));
writer.Write ("::");
writer.Write (method.Name);
writer.Write ("(");
var parameters = method.Parameters;
for (int i=0; i < parameters.Count; ++i) {
if (i > 0) writer.Write (", ");
writer.Write (FormatTypeReference (parameters [i].ParameterType));
}
writer.Write (")");
}
public static string FormatTypeReference (TypeReference type)
{
string typeName = type.FullName;
switch (typeName) {
case "System.Void": return "void";
case "System.String": return "string";
case "System.Int32": return "int32";
case "System.Long": return "int64";
case "System.Boolean": return "bool";
case "System.Single": return "float32";
case "System.Double": return "float64";
}
return typeName;
}
private Formatter ()
{
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Utilities/InstructionDispatcher.cs 0000644 0001750 0001750 00000123743 11620326252 031654 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using System;
using System.Collections;
using System.Collections.Generic;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.Utilities {
public class InstructionDispatcher {
public static void Dispatch (Instruction instruction, IInstructionVisitor visitor)
{
InstructionVisitorDelegate handler = (InstructionVisitorDelegate)_handlers[instruction.OpCode.Value];
if (null == handler) throw new ArgumentException (Formatter.FormatInstruction (instruction), "instruction");
handler (visitor, instruction);
}
delegate void InstructionVisitorDelegate (IInstructionVisitor visitor, Instruction instruction);
static IDictionary _handlers = new Dictionary ();
static InstructionDispatcher ()
{
Bind (new InstructionVisitorDelegate (DispatchNop), OpCodes.Nop);
Bind (new InstructionVisitorDelegate (DispatchBreak), OpCodes.Break);
Bind (new InstructionVisitorDelegate (DispatchLdarg_0), OpCodes.Ldarg_0);
Bind (new InstructionVisitorDelegate (DispatchLdarg_1), OpCodes.Ldarg_1);
Bind (new InstructionVisitorDelegate (DispatchLdarg_2), OpCodes.Ldarg_2);
Bind (new InstructionVisitorDelegate (DispatchLdarg_3), OpCodes.Ldarg_3);
Bind (new InstructionVisitorDelegate (DispatchLdloc_0), OpCodes.Ldloc_0);
Bind (new InstructionVisitorDelegate (DispatchLdloc_1), OpCodes.Ldloc_1);
Bind (new InstructionVisitorDelegate (DispatchLdloc_2), OpCodes.Ldloc_2);
Bind (new InstructionVisitorDelegate (DispatchLdloc_3), OpCodes.Ldloc_3);
Bind (new InstructionVisitorDelegate (DispatchStloc_0), OpCodes.Stloc_0);
Bind (new InstructionVisitorDelegate (DispatchStloc_1), OpCodes.Stloc_1);
Bind (new InstructionVisitorDelegate (DispatchStloc_2), OpCodes.Stloc_2);
Bind (new InstructionVisitorDelegate (DispatchStloc_3), OpCodes.Stloc_3);
Bind (new InstructionVisitorDelegate (DispatchLdarg), OpCodes.Ldarg, OpCodes.Ldarg_S);
Bind (new InstructionVisitorDelegate (DispatchLdarga), OpCodes.Ldarga, OpCodes.Ldarga_S);
Bind (new InstructionVisitorDelegate (DispatchStarg), OpCodes.Starg, OpCodes.Starg_S);
Bind (new InstructionVisitorDelegate (DispatchLdloc), OpCodes.Ldloc, OpCodes.Ldloc_S);
Bind (new InstructionVisitorDelegate (DispatchLdloca), OpCodes.Ldloca, OpCodes.Ldloca_S);
Bind (new InstructionVisitorDelegate (DispatchStloc), OpCodes.Stloc, OpCodes.Stloc_S);
Bind (new InstructionVisitorDelegate (DispatchLdnull), OpCodes.Ldnull);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_M1), OpCodes.Ldc_I4_M1);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_0), OpCodes.Ldc_I4_0);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_1), OpCodes.Ldc_I4_1);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_2), OpCodes.Ldc_I4_2);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_3), OpCodes.Ldc_I4_3);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_4), OpCodes.Ldc_I4_4);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_5), OpCodes.Ldc_I4_5);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_6), OpCodes.Ldc_I4_6);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_7), OpCodes.Ldc_I4_7);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4_8), OpCodes.Ldc_I4_8);
Bind (new InstructionVisitorDelegate (DispatchLdc_I4), OpCodes.Ldc_I4, OpCodes.Ldc_I4_S);
Bind (new InstructionVisitorDelegate (DispatchLdc_I8), OpCodes.Ldc_I8);
Bind (new InstructionVisitorDelegate (DispatchLdc_R4), OpCodes.Ldc_R4);
Bind (new InstructionVisitorDelegate (DispatchLdc_R8), OpCodes.Ldc_R8);
Bind (new InstructionVisitorDelegate (DispatchDup), OpCodes.Dup);
Bind (new InstructionVisitorDelegate (DispatchPop), OpCodes.Pop);
Bind (new InstructionVisitorDelegate (DispatchJmp), OpCodes.Jmp);
Bind (new InstructionVisitorDelegate (DispatchCall), OpCodes.Call);
Bind (new InstructionVisitorDelegate (DispatchCalli), OpCodes.Calli);
Bind (new InstructionVisitorDelegate (DispatchRet), OpCodes.Ret);
Bind (new InstructionVisitorDelegate (DispatchBr), OpCodes.Br, OpCodes.Br_S);
Bind (new InstructionVisitorDelegate (DispatchBrfalse), OpCodes.Brfalse, OpCodes.Brfalse_S);
Bind (new InstructionVisitorDelegate (DispatchBrtrue), OpCodes.Brtrue, OpCodes.Brtrue_S);
Bind (new InstructionVisitorDelegate (DispatchBeq), OpCodes.Beq, OpCodes.Beq_S);
Bind (new InstructionVisitorDelegate (DispatchBge), OpCodes.Bge, OpCodes.Bge_S);
Bind (new InstructionVisitorDelegate (DispatchBgt), OpCodes.Bgt, OpCodes.Bgt_S);
Bind (new InstructionVisitorDelegate (DispatchBle), OpCodes.Ble, OpCodes.Ble_S);
Bind (new InstructionVisitorDelegate (DispatchBlt), OpCodes.Blt, OpCodes.Blt_S);
Bind (new InstructionVisitorDelegate (DispatchBne_Un), OpCodes.Bne_Un, OpCodes.Bne_Un_S);
Bind (new InstructionVisitorDelegate (DispatchBge_Un), OpCodes.Bge_Un, OpCodes.Bge_Un_S);
Bind (new InstructionVisitorDelegate (DispatchBgt_Un), OpCodes.Bgt_Un, OpCodes.Bgt_Un_S);
Bind (new InstructionVisitorDelegate (DispatchBle_Un), OpCodes.Ble_Un, OpCodes.Ble_Un_S);
Bind (new InstructionVisitorDelegate (DispatchBlt_Un), OpCodes.Blt_Un, OpCodes.Blt_Un_S);
Bind (new InstructionVisitorDelegate (DispatchSwitch), OpCodes.Switch);
Bind (new InstructionVisitorDelegate (DispatchLdind_I1), OpCodes.Ldind_I1);
Bind (new InstructionVisitorDelegate (DispatchLdind_U1), OpCodes.Ldind_U1);
Bind (new InstructionVisitorDelegate (DispatchLdind_I2), OpCodes.Ldind_I2);
Bind (new InstructionVisitorDelegate (DispatchLdind_U2), OpCodes.Ldind_U2);
Bind (new InstructionVisitorDelegate (DispatchLdind_I4), OpCodes.Ldind_I4);
Bind (new InstructionVisitorDelegate (DispatchLdind_U4), OpCodes.Ldind_U4);
Bind (new InstructionVisitorDelegate (DispatchLdind_I8), OpCodes.Ldind_I8);
Bind (new InstructionVisitorDelegate (DispatchLdind_I), OpCodes.Ldind_I);
Bind (new InstructionVisitorDelegate (DispatchLdind_R4), OpCodes.Ldind_R4);
Bind (new InstructionVisitorDelegate (DispatchLdind_R8), OpCodes.Ldind_R8);
Bind (new InstructionVisitorDelegate (DispatchLdind_Ref), OpCodes.Ldind_Ref);
Bind (new InstructionVisitorDelegate (DispatchStind_Ref), OpCodes.Stind_Ref);
Bind (new InstructionVisitorDelegate (DispatchStind_I1), OpCodes.Stind_I1);
Bind (new InstructionVisitorDelegate (DispatchStind_I2), OpCodes.Stind_I2);
Bind (new InstructionVisitorDelegate (DispatchStind_I4), OpCodes.Stind_I4);
Bind (new InstructionVisitorDelegate (DispatchStind_I8), OpCodes.Stind_I8);
Bind (new InstructionVisitorDelegate (DispatchStind_R4), OpCodes.Stind_R4);
Bind (new InstructionVisitorDelegate (DispatchStind_R8), OpCodes.Stind_R8);
Bind (new InstructionVisitorDelegate (DispatchAdd), OpCodes.Add);
Bind (new InstructionVisitorDelegate (DispatchSub), OpCodes.Sub);
Bind (new InstructionVisitorDelegate (DispatchMul), OpCodes.Mul);
Bind (new InstructionVisitorDelegate (DispatchDiv), OpCodes.Div);
Bind (new InstructionVisitorDelegate (DispatchDiv_Un), OpCodes.Div_Un);
Bind (new InstructionVisitorDelegate (DispatchRem), OpCodes.Rem);
Bind (new InstructionVisitorDelegate (DispatchRem_Un), OpCodes.Rem_Un);
Bind (new InstructionVisitorDelegate (DispatchAnd), OpCodes.And);
Bind (new InstructionVisitorDelegate (DispatchOr), OpCodes.Or);
Bind (new InstructionVisitorDelegate (DispatchXor), OpCodes.Xor);
Bind (new InstructionVisitorDelegate (DispatchShl), OpCodes.Shl);
Bind (new InstructionVisitorDelegate (DispatchShr), OpCodes.Shr);
Bind (new InstructionVisitorDelegate (DispatchShr_Un), OpCodes.Shr_Un);
Bind (new InstructionVisitorDelegate (DispatchNeg), OpCodes.Neg);
Bind (new InstructionVisitorDelegate (DispatchNot), OpCodes.Not);
Bind (new InstructionVisitorDelegate (DispatchConv_I1), OpCodes.Conv_I1);
Bind (new InstructionVisitorDelegate (DispatchConv_I2), OpCodes.Conv_I2);
Bind (new InstructionVisitorDelegate (DispatchConv_I4), OpCodes.Conv_I4);
Bind (new InstructionVisitorDelegate (DispatchConv_I8), OpCodes.Conv_I8);
Bind (new InstructionVisitorDelegate (DispatchConv_R4), OpCodes.Conv_R4);
Bind (new InstructionVisitorDelegate (DispatchConv_R8), OpCodes.Conv_R8);
Bind (new InstructionVisitorDelegate (DispatchConv_U4), OpCodes.Conv_U4);
Bind (new InstructionVisitorDelegate (DispatchConv_U8), OpCodes.Conv_U8);
Bind (new InstructionVisitorDelegate (DispatchCallvirt), OpCodes.Callvirt);
Bind (new InstructionVisitorDelegate (DispatchCpobj), OpCodes.Cpobj);
Bind (new InstructionVisitorDelegate (DispatchLdobj), OpCodes.Ldobj);
Bind (new InstructionVisitorDelegate (DispatchLdstr), OpCodes.Ldstr);
Bind (new InstructionVisitorDelegate (DispatchNewobj), OpCodes.Newobj);
Bind (new InstructionVisitorDelegate (DispatchCastclass), OpCodes.Castclass);
Bind (new InstructionVisitorDelegate (DispatchIsinst), OpCodes.Isinst);
Bind (new InstructionVisitorDelegate (DispatchConv_R_Un), OpCodes.Conv_R_Un);
Bind (new InstructionVisitorDelegate (DispatchUnbox), OpCodes.Unbox);
Bind (new InstructionVisitorDelegate (DispatchThrow), OpCodes.Throw);
Bind (new InstructionVisitorDelegate (DispatchLdfld), OpCodes.Ldfld);
Bind (new InstructionVisitorDelegate (DispatchLdflda), OpCodes.Ldflda);
Bind (new InstructionVisitorDelegate (DispatchStfld), OpCodes.Stfld);
Bind (new InstructionVisitorDelegate (DispatchLdsfld), OpCodes.Ldsfld);
Bind (new InstructionVisitorDelegate (DispatchLdsflda), OpCodes.Ldsflda);
Bind (new InstructionVisitorDelegate (DispatchStsfld), OpCodes.Stsfld);
Bind (new InstructionVisitorDelegate (DispatchStobj), OpCodes.Stobj);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I1_Un), OpCodes.Conv_Ovf_I1_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I2_Un), OpCodes.Conv_Ovf_I2_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I4_Un), OpCodes.Conv_Ovf_I4_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I8_Un), OpCodes.Conv_Ovf_I8_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U1_Un), OpCodes.Conv_Ovf_U1_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U2_Un), OpCodes.Conv_Ovf_U2_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U4_Un), OpCodes.Conv_Ovf_U4_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U8_Un), OpCodes.Conv_Ovf_U8_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I_Un), OpCodes.Conv_Ovf_I_Un);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U_Un), OpCodes.Conv_Ovf_U_Un);
Bind (new InstructionVisitorDelegate (DispatchBox), OpCodes.Box);
Bind (new InstructionVisitorDelegate (DispatchNewarr), OpCodes.Newarr);
Bind (new InstructionVisitorDelegate (DispatchLdlen), OpCodes.Ldlen);
Bind (new InstructionVisitorDelegate (DispatchLdelema), OpCodes.Ldelema);
Bind (new InstructionVisitorDelegate (DispatchLdelem_I1), OpCodes.Ldelem_I1);
Bind (new InstructionVisitorDelegate (DispatchLdelem_U1), OpCodes.Ldelem_U1);
Bind (new InstructionVisitorDelegate (DispatchLdelem_I2), OpCodes.Ldelem_I2);
Bind (new InstructionVisitorDelegate (DispatchLdelem_U2), OpCodes.Ldelem_U2);
Bind (new InstructionVisitorDelegate (DispatchLdelem_I4), OpCodes.Ldelem_I4);
Bind (new InstructionVisitorDelegate (DispatchLdelem_U4), OpCodes.Ldelem_U4);
Bind (new InstructionVisitorDelegate (DispatchLdelem_I8), OpCodes.Ldelem_I8);
Bind (new InstructionVisitorDelegate (DispatchLdelem_I), OpCodes.Ldelem_I);
Bind (new InstructionVisitorDelegate (DispatchLdelem_R4), OpCodes.Ldelem_R4);
Bind (new InstructionVisitorDelegate (DispatchLdelem_R8), OpCodes.Ldelem_R8);
Bind (new InstructionVisitorDelegate (DispatchLdelem_Ref), OpCodes.Ldelem_Ref);
Bind (new InstructionVisitorDelegate (DispatchStelem_I), OpCodes.Stelem_I);
Bind (new InstructionVisitorDelegate (DispatchStelem_I1), OpCodes.Stelem_I1);
Bind (new InstructionVisitorDelegate (DispatchStelem_I2), OpCodes.Stelem_I2);
Bind (new InstructionVisitorDelegate (DispatchStelem_I4), OpCodes.Stelem_I4);
Bind (new InstructionVisitorDelegate (DispatchStelem_I8), OpCodes.Stelem_I8);
Bind (new InstructionVisitorDelegate (DispatchStelem_R4), OpCodes.Stelem_R4);
Bind (new InstructionVisitorDelegate (DispatchStelem_R8), OpCodes.Stelem_R8);
Bind (new InstructionVisitorDelegate (DispatchStelem_Ref), OpCodes.Stelem_Ref);
Bind (new InstructionVisitorDelegate (DispatchLdelem_Any), OpCodes.Ldelem_Any);
Bind (new InstructionVisitorDelegate (DispatchStelem_Any), OpCodes.Stelem_Any);
Bind (new InstructionVisitorDelegate (DispatchUnbox_Any), OpCodes.Unbox_Any);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I1), OpCodes.Conv_Ovf_I1);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U1), OpCodes.Conv_Ovf_U1);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I2), OpCodes.Conv_Ovf_I2);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U2), OpCodes.Conv_Ovf_U2);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I4), OpCodes.Conv_Ovf_I4);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U4), OpCodes.Conv_Ovf_U4);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I8), OpCodes.Conv_Ovf_I8);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U8), OpCodes.Conv_Ovf_U8);
Bind (new InstructionVisitorDelegate (DispatchRefanyval), OpCodes.Refanyval);
Bind (new InstructionVisitorDelegate (DispatchCkfinite), OpCodes.Ckfinite);
Bind (new InstructionVisitorDelegate (DispatchMkrefany), OpCodes.Mkrefany);
Bind (new InstructionVisitorDelegate (DispatchLdtoken), OpCodes.Ldtoken);
Bind (new InstructionVisitorDelegate (DispatchConv_U2), OpCodes.Conv_U2);
Bind (new InstructionVisitorDelegate (DispatchConv_U1), OpCodes.Conv_U1);
Bind (new InstructionVisitorDelegate (DispatchConv_I), OpCodes.Conv_I);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_I), OpCodes.Conv_Ovf_I);
Bind (new InstructionVisitorDelegate (DispatchConv_Ovf_U), OpCodes.Conv_Ovf_U);
Bind (new InstructionVisitorDelegate (DispatchAdd_Ovf), OpCodes.Add_Ovf);
Bind (new InstructionVisitorDelegate (DispatchAdd_Ovf_Un), OpCodes.Add_Ovf_Un);
Bind (new InstructionVisitorDelegate (DispatchMul_Ovf), OpCodes.Mul_Ovf);
Bind (new InstructionVisitorDelegate (DispatchMul_Ovf_Un), OpCodes.Mul_Ovf_Un);
Bind (new InstructionVisitorDelegate (DispatchSub_Ovf), OpCodes.Sub_Ovf);
Bind (new InstructionVisitorDelegate (DispatchSub_Ovf_Un), OpCodes.Sub_Ovf_Un);
Bind (new InstructionVisitorDelegate (DispatchEndfinally), OpCodes.Endfinally);
Bind (new InstructionVisitorDelegate (DispatchLeave), OpCodes.Leave, OpCodes.Leave_S);
Bind (new InstructionVisitorDelegate (DispatchStind_I), OpCodes.Stind_I);
Bind (new InstructionVisitorDelegate (DispatchConv_U), OpCodes.Conv_U);
Bind (new InstructionVisitorDelegate (DispatchArglist), OpCodes.Arglist);
Bind (new InstructionVisitorDelegate (DispatchCeq), OpCodes.Ceq);
Bind (new InstructionVisitorDelegate (DispatchCgt), OpCodes.Cgt);
Bind (new InstructionVisitorDelegate (DispatchCgt_Un), OpCodes.Cgt_Un);
Bind (new InstructionVisitorDelegate (DispatchClt), OpCodes.Clt);
Bind (new InstructionVisitorDelegate (DispatchClt_Un), OpCodes.Clt_Un);
Bind (new InstructionVisitorDelegate (DispatchLdftn), OpCodes.Ldftn);
Bind (new InstructionVisitorDelegate (DispatchLdvirtftn), OpCodes.Ldvirtftn);
Bind (new InstructionVisitorDelegate (DispatchLocalloc), OpCodes.Localloc);
Bind (new InstructionVisitorDelegate (DispatchEndfilter), OpCodes.Endfilter);
Bind (new InstructionVisitorDelegate (DispatchUnaligned), OpCodes.Unaligned);
Bind (new InstructionVisitorDelegate (DispatchVolatile), OpCodes.Volatile);
Bind (new InstructionVisitorDelegate (DispatchTail), OpCodes.Tail);
Bind (new InstructionVisitorDelegate (DispatchInitobj), OpCodes.Initobj);
Bind (new InstructionVisitorDelegate (DispatchCpblk), OpCodes.Cpblk);
Bind (new InstructionVisitorDelegate (DispatchInitblk), OpCodes.Initblk);
Bind (new InstructionVisitorDelegate (DispatchRethrow), OpCodes.Rethrow);
Bind (new InstructionVisitorDelegate (DispatchSizeof), OpCodes.Sizeof);
Bind (new InstructionVisitorDelegate (DispatchRefanytype), OpCodes.Refanytype);
}
static void Bind (InstructionVisitorDelegate handler, params OpCode[] opcodes)
{
foreach (OpCode op in opcodes)
{
_handlers.Add (op.Value, handler);
}
}
static void DispatchNop (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnNop (instruction);
}
static void DispatchBreak (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBreak (instruction);
}
static void DispatchLdarg_0 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdarg_0 (instruction);
}
static void DispatchLdarg_1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdarg_1 (instruction);
}
static void DispatchLdarg_2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdarg_2 (instruction);
}
static void DispatchLdarg_3 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdarg_3 (instruction);
}
static void DispatchLdloc_0 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdloc_0 (instruction);
}
static void DispatchLdloc_1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdloc_1 (instruction);
}
static void DispatchLdloc_2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdloc_2 (instruction);
}
static void DispatchLdloc_3 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdloc_3 (instruction);
}
static void DispatchStloc_0 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStloc_0 (instruction);
}
static void DispatchStloc_1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStloc_1 (instruction);
}
static void DispatchStloc_2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStloc_2 (instruction);
}
static void DispatchStloc_3 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStloc_3 (instruction);
}
static void DispatchLdarg (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdarg (instruction);
}
static void DispatchLdarga (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdarga (instruction);
}
static void DispatchStarg (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStarg (instruction);
}
static void DispatchLdloc (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdloc (instruction);
}
static void DispatchLdloca (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdloca (instruction);
}
static void DispatchStloc (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStloc (instruction);
}
static void DispatchLdnull (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdnull (instruction);
}
static void DispatchLdc_I4_M1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_M1 (instruction);
}
static void DispatchLdc_I4_0 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_0 (instruction);
}
static void DispatchLdc_I4_1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_1 (instruction);
}
static void DispatchLdc_I4_2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_2 (instruction);
}
static void DispatchLdc_I4_3 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_3 (instruction);
}
static void DispatchLdc_I4_4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_4 (instruction);
}
static void DispatchLdc_I4_5 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_5 (instruction);
}
static void DispatchLdc_I4_6 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_6 (instruction);
}
static void DispatchLdc_I4_7 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_7 (instruction);
}
static void DispatchLdc_I4_8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4_8 (instruction);
}
static void DispatchLdc_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I4 (instruction);
}
static void DispatchLdc_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_I8 (instruction);
}
static void DispatchLdc_R4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_R4 (instruction);
}
static void DispatchLdc_R8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdc_R8 (instruction);
}
static void DispatchDup (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnDup (instruction);
}
static void DispatchPop (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnPop (instruction);
}
static void DispatchJmp (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnJmp (instruction);
}
static void DispatchCall (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCall (instruction);
}
static void DispatchCalli (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCalli (instruction);
}
static void DispatchRet (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnRet (instruction);
}
static void DispatchBr (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBr (instruction);
}
static void DispatchBrfalse (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBrfalse (instruction);
}
static void DispatchBrtrue (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBrtrue (instruction);
}
static void DispatchBeq (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBeq (instruction);
}
static void DispatchBge (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBge (instruction);
}
static void DispatchBgt (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBgt (instruction);
}
static void DispatchBle (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBle (instruction);
}
static void DispatchBlt (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBlt (instruction);
}
static void DispatchBne_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBne_Un (instruction);
}
static void DispatchBge_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBge_Un (instruction);
}
static void DispatchBgt_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBgt_Un (instruction);
}
static void DispatchBle_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBle_Un (instruction);
}
static void DispatchBlt_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBlt_Un (instruction);
}
static void DispatchSwitch (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnSwitch (instruction);
}
static void DispatchLdind_I1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_I1 (instruction);
}
static void DispatchLdind_U1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_U1 (instruction);
}
static void DispatchLdind_I2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_I2 (instruction);
}
static void DispatchLdind_U2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_U2 (instruction);
}
static void DispatchLdind_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_I4 (instruction);
}
static void DispatchLdind_U4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_U4 (instruction);
}
static void DispatchLdind_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_I8 (instruction);
}
static void DispatchLdind_I (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_I (instruction);
}
static void DispatchLdind_R4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_R4 (instruction);
}
static void DispatchLdind_R8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_R8 (instruction);
}
static void DispatchLdind_Ref (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdind_Ref (instruction);
}
static void DispatchStind_Ref (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_Ref (instruction);
}
static void DispatchStind_I1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_I1 (instruction);
}
static void DispatchStind_I2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_I2 (instruction);
}
static void DispatchStind_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_I4 (instruction);
}
static void DispatchStind_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_I8 (instruction);
}
static void DispatchStind_R4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_R4 (instruction);
}
static void DispatchStind_R8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_R8 (instruction);
}
static void DispatchAdd (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnAdd (instruction);
}
static void DispatchSub (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnSub (instruction);
}
static void DispatchMul (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnMul (instruction);
}
static void DispatchDiv (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnDiv (instruction);
}
static void DispatchDiv_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnDiv_Un (instruction);
}
static void DispatchRem (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnRem (instruction);
}
static void DispatchRem_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnRem_Un (instruction);
}
static void DispatchAnd (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnAnd (instruction);
}
static void DispatchOr (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnOr (instruction);
}
static void DispatchXor (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnXor (instruction);
}
static void DispatchShl (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnShl (instruction);
}
static void DispatchShr (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnShr (instruction);
}
static void DispatchShr_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnShr_Un (instruction);
}
static void DispatchNeg (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnNeg (instruction);
}
static void DispatchNot (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnNot (instruction);
}
static void DispatchConv_I1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_I1 (instruction);
}
static void DispatchConv_I2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_I2 (instruction);
}
static void DispatchConv_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_I4 (instruction);
}
static void DispatchConv_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_I8 (instruction);
}
static void DispatchConv_R4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_R4 (instruction);
}
static void DispatchConv_R8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_R8 (instruction);
}
static void DispatchConv_U4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_U4 (instruction);
}
static void DispatchConv_U8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_U8 (instruction);
}
static void DispatchCallvirt (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCallvirt (instruction);
}
static void DispatchCpobj (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCpobj (instruction);
}
static void DispatchLdobj (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdobj (instruction);
}
static void DispatchLdstr (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdstr (instruction);
}
static void DispatchNewobj (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnNewobj (instruction);
}
static void DispatchCastclass (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCastclass (instruction);
}
static void DispatchIsinst (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnIsinst (instruction);
}
static void DispatchConv_R_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_R_Un (instruction);
}
static void DispatchUnbox (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnUnbox (instruction);
}
static void DispatchThrow (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnThrow (instruction);
}
static void DispatchLdfld (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdfld (instruction);
}
static void DispatchLdflda (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdflda (instruction);
}
static void DispatchStfld (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStfld (instruction);
}
static void DispatchLdsfld (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdsfld (instruction);
}
static void DispatchLdsflda (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdsflda (instruction);
}
static void DispatchStsfld (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStsfld (instruction);
}
static void DispatchStobj (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStobj (instruction);
}
static void DispatchConv_Ovf_I1_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I1_Un (instruction);
}
static void DispatchConv_Ovf_I2_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I2_Un (instruction);
}
static void DispatchConv_Ovf_I4_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I4_Un (instruction);
}
static void DispatchConv_Ovf_I8_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I8_Un (instruction);
}
static void DispatchConv_Ovf_U1_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U1_Un (instruction);
}
static void DispatchConv_Ovf_U2_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U2_Un (instruction);
}
static void DispatchConv_Ovf_U4_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U4_Un (instruction);
}
static void DispatchConv_Ovf_U8_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U8_Un (instruction);
}
static void DispatchConv_Ovf_I_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I_Un (instruction);
}
static void DispatchConv_Ovf_U_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U_Un (instruction);
}
static void DispatchBox (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnBox (instruction);
}
static void DispatchNewarr (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnNewarr (instruction);
}
static void DispatchLdlen (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdlen (instruction);
}
static void DispatchLdelema (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelema (instruction);
}
static void DispatchLdelem_I1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_I1 (instruction);
}
static void DispatchLdelem_U1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_U1 (instruction);
}
static void DispatchLdelem_I2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_I2 (instruction);
}
static void DispatchLdelem_U2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_U2 (instruction);
}
static void DispatchLdelem_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_I4 (instruction);
}
static void DispatchLdelem_U4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_U4 (instruction);
}
static void DispatchLdelem_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_I8 (instruction);
}
static void DispatchLdelem_I (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_I (instruction);
}
static void DispatchLdelem_R4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_R4 (instruction);
}
static void DispatchLdelem_R8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_R8 (instruction);
}
static void DispatchLdelem_Ref (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_Ref (instruction);
}
static void DispatchStelem_I (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_I (instruction);
}
static void DispatchStelem_I1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_I1 (instruction);
}
static void DispatchStelem_I2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_I2 (instruction);
}
static void DispatchStelem_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_I4 (instruction);
}
static void DispatchStelem_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_I8 (instruction);
}
static void DispatchStelem_R4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_R4 (instruction);
}
static void DispatchStelem_R8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_R8 (instruction);
}
static void DispatchStelem_Ref (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_Ref (instruction);
}
static void DispatchLdelem_Any (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdelem_Any (instruction);
}
static void DispatchStelem_Any (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStelem_Any (instruction);
}
static void DispatchUnbox_Any (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnUnbox_Any (instruction);
}
static void DispatchConv_Ovf_I1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I1 (instruction);
}
static void DispatchConv_Ovf_U1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U1 (instruction);
}
static void DispatchConv_Ovf_I2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I2 (instruction);
}
static void DispatchConv_Ovf_U2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U2 (instruction);
}
static void DispatchConv_Ovf_I4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I4 (instruction);
}
static void DispatchConv_Ovf_U4 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U4 (instruction);
}
static void DispatchConv_Ovf_I8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I8 (instruction);
}
static void DispatchConv_Ovf_U8 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U8 (instruction);
}
static void DispatchRefanyval (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnRefanyval (instruction);
}
static void DispatchCkfinite (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCkfinite (instruction);
}
static void DispatchMkrefany (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnMkrefany (instruction);
}
static void DispatchLdtoken (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdtoken (instruction);
}
static void DispatchConv_U2 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_U2 (instruction);
}
static void DispatchConv_U1 (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_U1 (instruction);
}
static void DispatchConv_I (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_I (instruction);
}
static void DispatchConv_Ovf_I (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_I (instruction);
}
static void DispatchConv_Ovf_U (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_Ovf_U (instruction);
}
static void DispatchAdd_Ovf (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnAdd_Ovf (instruction);
}
static void DispatchAdd_Ovf_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnAdd_Ovf_Un (instruction);
}
static void DispatchMul_Ovf (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnMul_Ovf (instruction);
}
static void DispatchMul_Ovf_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnMul_Ovf_Un (instruction);
}
static void DispatchSub_Ovf (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnSub_Ovf (instruction);
}
static void DispatchSub_Ovf_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnSub_Ovf_Un (instruction);
}
static void DispatchEndfinally (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnEndfinally (instruction);
}
static void DispatchLeave (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLeave (instruction);
}
static void DispatchStind_I (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnStind_I (instruction);
}
static void DispatchConv_U (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnConv_U (instruction);
}
static void DispatchArglist (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnArglist (instruction);
}
static void DispatchCeq (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCeq (instruction);
}
static void DispatchCgt (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCgt (instruction);
}
static void DispatchCgt_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCgt_Un (instruction);
}
static void DispatchClt (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnClt (instruction);
}
static void DispatchClt_Un (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnClt_Un (instruction);
}
static void DispatchLdftn (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdftn (instruction);
}
static void DispatchLdvirtftn (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLdvirtftn (instruction);
}
static void DispatchLocalloc (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnLocalloc (instruction);
}
static void DispatchEndfilter (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnEndfilter (instruction);
}
static void DispatchUnaligned (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnUnaligned (instruction);
}
static void DispatchVolatile (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnVolatile (instruction);
}
static void DispatchTail (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnTail (instruction);
}
static void DispatchInitobj (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnInitobj (instruction);
}
static void DispatchCpblk (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnCpblk (instruction);
}
static void DispatchInitblk (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnInitblk (instruction);
}
static void DispatchRethrow (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnRethrow (instruction);
}
static void DispatchSizeof (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnSizeof (instruction);
}
static void DispatchRefanytype (IInstructionVisitor visitor, Instruction instruction)
{
visitor.OnRefanytype (instruction);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ControlFlow/ 0000755 0001750 0001750 00000000000 11620326252 025260 5 ustar laney laney cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ControlFlow/InstructionData.cs 0000644 0001750 0001750 00000002710 11620326252 030722 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace Cecil.FlowAnalysis.ControlFlow {
public class InstructionData {
int _before;
int _after;
public int StackBefore {
get { return _before; }
}
public int StackAfter {
get { return _after; }
}
public InstructionData (int before, int after)
{
_before = before;
_after = after;
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ControlFlow/ControlFlowGraph.cs 0000644 0001750 0001750 00000003446 11620326252 031050 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System.Collections;
using Cecil.FlowAnalysis.ControlFlow;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ControlFlow {
public class ControlFlowGraph {
InstructionBlock [] _blocks;
MethodBody _body;
IDictionary _data;
public MethodBody MethodBody {
get { return _body; }
}
public InstructionBlock [] Blocks {
get { return _blocks; }
}
public ControlFlowGraph (MethodBody body, InstructionBlock [] blocks, IDictionary instructionData)
{
_body = body;
_blocks = blocks;
_data = instructionData;
}
public InstructionData GetData (Instruction instruction)
{
return (InstructionData) _data [instruction.Offset];
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ControlFlow/InstructionBlock.cs 0000644 0001750 0001750 00000005174 11620326252 031112 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.ControlFlow {
public class InstructionBlock : IComparable, IEnumerable {
public static readonly InstructionBlock [] NoSuccessors = new InstructionBlock [0];
Instruction _firstInstruction;
Instruction _lastInstruction;
InstructionBlock [] _successors = NoSuccessors;
public Instruction FirstInstruction {
get { return _firstInstruction; }
}
public Instruction LastInstruction {
get { return _lastInstruction; }
}
public InstructionBlock [] Successors {
get { return _successors; }
}
internal InstructionBlock (Instruction first)
{
if (null == first) throw new ArgumentNullException ("first");
_firstInstruction = first;
}
internal void SetLastInstruction (Instruction last)
{
if (null == last) throw new ArgumentNullException ("last");
_lastInstruction = last;
}
internal void SetSuccessors (InstructionBlock [] successors)
{
_successors = successors;
}
public int CompareTo (object obj)
{
return _firstInstruction.Offset.CompareTo (((InstructionBlock)obj).FirstInstruction.Offset);
}
public IEnumerator GetEnumerator ()
{
var instructions = new Collection ();
Instruction instruction = _firstInstruction;
while (true) {
instructions.Add (instruction);
if (instruction == _lastInstruction) break;
instruction = instruction.Next;
}
return instructions.GetEnumerator ();
}
}
}
././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ControlFlow/ControlFlowGraphBuilder.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ControlFlow/ControlFlowGraphBuilder0000644 0001750 0001750 00000024476 11620326252 031761 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using Cecil.FlowAnalysis.Utilities;
using Cecil.FlowAnalysis.ControlFlow;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.ControlFlow {
///
///
class ControlFlowGraphBuilder {
MethodBody _body;
Dictionary _instructionData;
Dictionary _blocks = new Dictionary ();
InstructionBlock [] RegisteredBlocks {
get { return ToArray (new InstructionBlock [BlockCount]); }
}
int BlockCount {
get { return _blocks.Count; }
}
internal ControlFlowGraphBuilder (MethodDefinition method)
{
_body = method.Body;
}
public ControlFlowGraph BuildGraph ()
{
DelimitBlocks ();
ConnectBlocks ();
ComputeInstructionData ();
return new ControlFlowGraph (_body, RegisteredBlocks, _instructionData);
}
void DelimitBlocks ()
{
var instructions = _body.Instructions;
MarkBlockStarts (instructions);
MarkBlockEnds (instructions);
}
void MarkBlockStarts (Collection instructions)
{
Instruction instruction = instructions [0];
// the first instruction starts a block
MarkBlockStart (instruction);
for (int i = 1; i < instructions.Count; ++i) {
instruction = instructions [i];
if (!IsBlockDelimiter (instruction))
continue;
if (HasMultipleBranches (instruction)) {
// each switch case first instruction starts a block
foreach (Instruction target in GetBranchTargets (instruction))
if (target != null)
MarkBlockStart (target);
} else {
// the target of a branch starts a block
Instruction target = GetBranchTarget (instruction);
if (null != target) MarkBlockStart (target);
}
// the next instruction after a branch starts a block
if (null != instruction.Next) MarkBlockStart (instruction.Next);
}
}
void MarkBlockEnds (Collection instructions)
{
InstructionBlock [] blocks = this.RegisteredBlocks;
InstructionBlock current = blocks [0];
for (int i = 1; i < blocks.Length; ++i) {
InstructionBlock block = blocks [i];
current.SetLastInstruction (block.FirstInstruction.Previous);
current = block;
}
current.SetLastInstruction (instructions [instructions.Count - 1]);
}
static bool IsBlockDelimiter (Instruction instruction)
{
FlowControl control = instruction.OpCode.FlowControl;
switch (control) {
case FlowControl.Break:
case FlowControl.Branch:
case FlowControl.Return:
case FlowControl.Cond_Branch:
return true;
}
return false;
}
void MarkBlockStart (Instruction instruction)
{
InstructionBlock block = GetBlock (instruction);
if (null != block) return;
block = new InstructionBlock (instruction);
RegisterBlock (block);
}
void ComputeInstructionData ()
{
_instructionData = new Dictionary ();
var visited = new HashSet ();
ComputeInstructionData (visited, 0, GetFirstBlock ());
}
InstructionBlock GetFirstBlock ()
{
return GetBlock (_body.Instructions [0]);
}
void ComputeInstructionData (HashSet visited, int stackHeight, InstructionBlock block)
{
if (visited.Contains (block)) return;
visited.Add (block);
foreach (Instruction instruction in block) {
stackHeight = ComputeInstructionData (stackHeight, instruction);
}
foreach (InstructionBlock successor in block.Successors) {
ComputeInstructionData (visited, stackHeight, successor);
}
}
int ComputeInstructionData (int stackHeight, Instruction instruction)
{
int before = stackHeight;
int after = ComputeNewStackHeight (stackHeight, instruction);
_instructionData.Add (instruction.Offset, new InstructionData (before, after));
return after;
}
int ComputeNewStackHeight (int stackHeight, Instruction instruction)
{
return stackHeight + GetPushDelta (instruction) - GetPopDelta (stackHeight, instruction);
}
static int GetPushDelta (Instruction instruction)
{
OpCode code = instruction.OpCode;
switch (code.StackBehaviourPush) {
case StackBehaviour.Push0:
return 0;
case StackBehaviour.Push1:
case StackBehaviour.Pushi:
case StackBehaviour.Pushi8:
case StackBehaviour.Pushr4:
case StackBehaviour.Pushr8:
case StackBehaviour.Pushref:
return 1;
case StackBehaviour.Push1_push1:
return 2;
case StackBehaviour.Varpush:
if (code.FlowControl == FlowControl.Call) {
MethodReference method = (MethodReference)instruction.Operand;
return IsVoid (method.ReturnType) ? 0 : 1;
}
break;
}
throw new ArgumentException (Formatter.FormatInstruction (instruction));
}
int GetPopDelta (int stackHeight, Instruction instruction)
{
OpCode code = instruction.OpCode;
switch (code.StackBehaviourPop) {
case StackBehaviour.Pop0:
return 0;
case StackBehaviour.Popi:
case StackBehaviour.Popref:
case StackBehaviour.Pop1:
return 1;
case StackBehaviour.Pop1_pop1:
case StackBehaviour.Popi_pop1:
case StackBehaviour.Popi_popi:
case StackBehaviour.Popi_popi8:
case StackBehaviour.Popi_popr4:
case StackBehaviour.Popi_popr8:
case StackBehaviour.Popref_pop1:
case StackBehaviour.Popref_popi:
return 2;
case StackBehaviour.Popi_popi_popi:
case StackBehaviour.Popref_popi_popi:
case StackBehaviour.Popref_popi_popi8:
case StackBehaviour.Popref_popi_popr4:
case StackBehaviour.Popref_popi_popr8:
case StackBehaviour.Popref_popi_popref:
return 3;
case StackBehaviour.PopAll:
return stackHeight;
case StackBehaviour.Varpop:
if (code.FlowControl == FlowControl.Call) {
MethodReference method = (MethodReference)instruction.Operand;
int count = method.Parameters.Count;
if (method.HasThis && OpCodes.Newobj.Value != code.Value)
++count;
return count;
}
if (code.Value == OpCodes.Ret.Value)
return IsVoidMethod () ? 0 : 1;
break;
}
throw new ArgumentException (Formatter.FormatInstruction (instruction));
}
bool IsVoidMethod ()
{
return IsVoid (_body.Method.ReturnType);
}
static bool IsVoid (TypeReference type)
{
return type.MetadataType == MetadataType.Void;
}
InstructionBlock [] ToArray (InstructionBlock [] blocks)
{
_blocks.Values.CopyTo (blocks, 0);
Array.Sort (blocks);
return blocks;
}
void ConnectBlocks ()
{
foreach (InstructionBlock block in _blocks.Values)
ConnectBlock (block);
}
void ConnectBlock (InstructionBlock block)
{
if (block.LastInstruction == null)
throw new ArgumentException ("Undelimited block at offset " + block.FirstInstruction.Offset);
Instruction instruction = block.LastInstruction;
switch (instruction.OpCode.FlowControl) {
case FlowControl.Branch:
case FlowControl.Cond_Branch: {
if (HasMultipleBranches (instruction)) {
InstructionBlock [] blocks = GetBranchTargetsBlocks (instruction);
if (instruction.Next != null)
blocks = AddBlock (GetBlock (instruction.Next), blocks);
block.SetSuccessors (blocks);
break;
}
InstructionBlock target = GetBranchTargetBlock (instruction);
if (instruction.OpCode.FlowControl == FlowControl.Cond_Branch && instruction.Next != null)
block.SetSuccessors (new InstructionBlock [] { target, GetBlock (instruction.Next) });
else
block.SetSuccessors (new InstructionBlock [] { target });
break;
}
case FlowControl.Call:
case FlowControl.Next:
if (null != instruction.Next)
block.SetSuccessors (new InstructionBlock [] { GetBlock (instruction.Next) });
break;
case FlowControl.Return:
break;
default:
throw new ArgumentException (
string.Format ("Unhandled instruction flow behavior {0}: {1}",
instruction.OpCode.FlowControl,
Formatter.FormatInstruction (instruction)));
}
}
static InstructionBlock [] AddBlock (InstructionBlock block, InstructionBlock [] blocks)
{
InstructionBlock [] result = new InstructionBlock [blocks.Length + 1];
Array.Copy (blocks, result, blocks.Length);
result [result.Length - 1] = block;
return result;
}
static bool HasMultipleBranches (Instruction instruction)
{
return instruction.OpCode.Code == Code.Switch;
}
InstructionBlock [] GetBranchTargetsBlocks (Instruction instruction)
{
Instruction [] targets = GetBranchTargets (instruction);
InstructionBlock [] blocks = new InstructionBlock [targets.Length];
for (int i = 0; i < targets.Length; i++)
blocks [i] = GetBlock (targets [i]);
return blocks;
}
static Instruction [] GetBranchTargets (Instruction instruction)
{
return (Instruction []) instruction.Operand;
}
InstructionBlock GetBranchTargetBlock (Instruction instruction)
{
return GetBlock (GetBranchTarget (instruction));
}
static Instruction GetBranchTarget (Instruction instruction)
{
return (Instruction) instruction.Operand;
}
void RegisterBlock (InstructionBlock block)
{
_blocks.Add (block.FirstInstruction.Offset, block);
}
InstructionBlock GetBlock (Instruction firstInstruction)
{
InstructionBlock block;
_blocks.TryGetValue (firstInstruction.Offset, out block);
return block;
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ 0000755 0001750 0001750 00000000000 11620326252 025603 5 ustar laney laney cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/BinaryOperator.cs 0000644 0001750 0001750 00000002725 11620326252 031100 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace Cecil.FlowAnalysis.CodeStructure {
public enum BinaryOperator {
None,
Add,
Subtract,
Multiply,
Divide,
ValueEquality,
ValueInequality,
LogicalOr,
LogicalAnd,
LessThan,
LessThanOrEqual,
GreaterThan,
GreaterThanOrEqual,
LeftShift,
RightShift,
BitwiseOr,
BitwiseAnd,
BitwiseXor,
Modulo,
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ICodeElement.cs 0000644 0001750 0001750 00000002463 11620326252 030434 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace Cecil.FlowAnalysis.CodeStructure {
public interface ICodeElement {
CodeElementType CodeElementType { get; }
void Accept (ICodeStructureVisitor visitor);
}
}
././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ICodeStructureVisitor.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ICodeStructureVisitor0000644 0001750 0001750 00000003574 11620326252 032023 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
namespace Cecil.FlowAnalysis.CodeStructure {
public interface ICodeStructureVisitor {
void Visit (MethodInvocationExpression node);
void Visit (MethodReferenceExpression node);
void Visit (LiteralExpression node);
void Visit (UnaryExpression node);
void Visit (BinaryExpression node);
void Visit (AssignExpression node);
void Visit (ArgumentReferenceExpression node);
void Visit (VariableReferenceExpression node);
void Visit (ThisReferenceExpression node);
void Visit (FieldReferenceExpression node);
void Visit (PropertyReferenceExpression node);
void Visit (BlockStatement node);
void Visit (ReturnStatement node);
void Visit (CastExpression node);
void Visit (TryCastExpression node);
}
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/AbstractCodeStructureVisitor.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/AbstractCodeStructure0000644 0001750 0001750 00000005534 11620326252 032014 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using System.Collections;
namespace Cecil.FlowAnalysis.CodeStructure {
public class AbstractCodeStructureVisitor : ICodeStructureVisitor {
public virtual void Visit (ICodeElement node)
{
if (null == node) return;
node.Accept (this);
}
public virtual void Visit (ICollection collection)
{
foreach (ICodeElement node in collection)
{
Visit (node);
}
}
public virtual void Visit (MethodInvocationExpression node)
{
Visit (node.Target);
Visit (node.Arguments);
}
public virtual void Visit (MethodReferenceExpression node)
{
Visit (node.Target);
}
public virtual void Visit (LiteralExpression node)
{
}
public virtual void Visit (UnaryExpression node)
{
Visit (node.Operand);
}
public virtual void Visit (BinaryExpression node)
{
Visit (node.Left);
Visit (node.Right);
}
public virtual void Visit (AssignExpression node)
{
Visit (node.Target);
Visit (node.Expression);
}
public virtual void Visit (ArgumentReferenceExpression node)
{
}
public virtual void Visit (VariableReferenceExpression node)
{
}
public virtual void Visit (ThisReferenceExpression node)
{
}
public virtual void Visit (FieldReferenceExpression node)
{
Visit (node.Target);
}
public virtual void Visit (PropertyReferenceExpression node)
{
Visit (node.Target);
}
public virtual void Visit (BlockStatement node)
{
Visit (node.Statements);
}
public virtual void Visit (ReturnStatement node)
{
Visit (node.Expression);
}
public virtual void Visit (CastExpression node)
{
Visit (node.Target);
}
public virtual void Visit (TryCastExpression node)
{
Visit (node.Target);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/PropertyReferenceExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/PropertyReferenceExpr0000644 0001750 0001750 00000003537 11620326252 032040 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class PropertyReferenceExpression : Expression {
Expression _target;
PropertyReference _property;
public PropertyReferenceExpression (Expression target, PropertyReference property)
{
_target = target;
_property = property;
}
public Expression Target
{
get { return _target; }
}
public PropertyReference Property
{
get { return _property; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.PropertyReferenceExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/BlockStatement.cs 0000644 0001750 0001750 00000003363 11620326252 031056 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.CodeStructure {
public class BlockStatement : Statement {
Collection _statements;
public BlockStatement (Collection statements)
{
_statements = statements;
}
public Collection Statements
{
get { return _statements; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.BlockStatement; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/CastExpression.cs 0000644 0001750 0001750 00000003440 11620326252 031105 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class CastExpression : Expression {
Expression _target;
TypeReference _toType;
public CastExpression (Expression target, TypeReference toType)
{
_target = target;
_toType = toType;
}
public Expression Target
{
get { return _target; }
}
public TypeReference ToType
{
get { return _toType; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.CastExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/Expression.cs 0000644 0001750 0001750 00000002726 11620326252 030300 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public abstract class Expression : ICodeElement {
public Expression ()
{
}
public abstract CodeElementType CodeElementType {
get;
}
public abstract void Accept (ICodeStructureVisitor visitor);
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/UnaryExpression.cs 0000644 0001750 0001750 00000003467 11620326252 031322 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class UnaryExpression : Expression {
UnaryOperator _operator;
Expression _operand;
public UnaryExpression (UnaryOperator operator_, Expression operand)
{
_operator = operator_;
_operand = operand;
}
public UnaryOperator Operator
{
get { return _operator; }
}
public Expression Operand
{
get { return _operand; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.UnaryExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/MethodReferenceExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/MethodReferenceExpres0000644 0001750 0001750 00000003507 11620326252 031761 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class MethodReferenceExpression : Expression {
Expression _target;
MethodReference _method;
public MethodReferenceExpression (Expression target, MethodReference method)
{
_target = target;
_method = method;
}
public Expression Target
{
get { return _target; }
}
public MethodReference Method
{
get { return _method; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.MethodReferenceExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011564 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/FieldReferenceExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/FieldReferenceExpress0000644 0001750 0001750 00000003473 11620326252 031751 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class FieldReferenceExpression : Expression {
Expression _target;
FieldReference _field;
public FieldReferenceExpression (Expression target, FieldReference field)
{
_target = target;
_field = field;
}
public Expression Target
{
get { return _target; }
}
public FieldReference Field
{
get { return _field; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.FieldReferenceExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/AssignExpression.cs 0000644 0001750 0001750 00000003465 11620326252 031446 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class AssignExpression : Expression {
Expression _target;
Expression _expression;
public AssignExpression (Expression target, Expression expression)
{
_target = target;
_expression = expression;
}
public Expression Target
{
get { return _target; }
}
public Expression Expression
{
get { return _expression; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.AssignExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/UnaryOperator.cs 0000644 0001750 0001750 00000002367 11620326252 030754 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace Cecil.FlowAnalysis.CodeStructure {
public enum UnaryOperator {
None,
BitwiseComplement,
Not,
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ReturnStatement.cs 0000644 0001750 0001750 00000003264 11620326252 031303 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class ReturnStatement : Statement {
Expression _expression;
public ReturnStatement (Expression expression)
{
_expression = expression;
}
public Expression Expression
{
get { return _expression; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.ReturnStatement; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ArgumentReferenceExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ArgumentReferenceExpr0000644 0001750 0001750 00000003353 11620326252 031772 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class ArgumentReferenceExpression : Expression {
ParameterReference _parameter;
public ArgumentReferenceExpression (ParameterReference parameter)
{
_parameter = parameter;
}
public ParameterReference Parameter
{
get { return _parameter; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.ArgumentReferenceExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/CodeElementType.cs 0000644 0001750 0001750 00000003143 11620326252 031161 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
namespace Cecil.FlowAnalysis.CodeStructure {
public enum CodeElementType {
MethodInvocationExpression,
MethodReferenceExpression,
LiteralExpression,
UnaryExpression,
BinaryExpression,
AssignExpression,
ArgumentReferenceExpression,
VariableReferenceExpression,
ThisReferenceExpression,
FieldReferenceExpression,
PropertyReferenceExpression,
BlockStatement,
ReturnStatement,
CastExpression,
TryCastExpression
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/Statement.cs 0000644 0001750 0001750 00000002724 11620326252 030103 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public abstract class Statement : ICodeElement {
public Statement ()
{
}
public abstract CodeElementType CodeElementType {
get;
}
public abstract void Accept (ICodeStructureVisitor visitor);
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ExpressionPrinter.cs 0000644 0001750 0001750 00000012471 11620326252 031642 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.IO;
using Cecil.FlowAnalysis.Utilities;
using Mono.Cecil;
namespace Cecil.FlowAnalysis.CodeStructure {
///
///
public class ExpressionPrinter : AbstractCodeStructureVisitor {
public static string ToString (Expression expression)
{
ExpressionPrinter printer = new ExpressionPrinter ();
expression.Accept (printer);
return printer.Writer.ToString ();
}
private TextWriter _writer;
public ExpressionPrinter ()
{
_writer = new StringWriter ();
}
public ExpressionPrinter (TextWriter writer)
{
if (null == writer) throw new ArgumentNullException ("writer");
_writer = writer;
}
public TextWriter Writer {
get { return _writer; }
}
public override void Visit (AssignExpression node)
{
Visit (node.Target);
Write (" = ");
Visit (node.Expression);
}
public override void Visit (BinaryExpression node)
{
Write ("(");
Visit (node.Left);
Write (" {0} ", ToString (node.Operator));
Visit (node.Right);
Write (")");
}
public override void Visit (CastExpression node)
{
Write ("((");
Write (node.ToType.FullName);
Write (")");
Visit (node.Target);
Write (")");
}
public override void Visit (TryCastExpression node)
{
Write ("(");
Visit (node.Target);
Write (" as ");
Write (node.ToType.FullName);
Write (")");
}
public override void Visit (ArgumentReferenceExpression node)
{
Write (node.Parameter.Name);
}
public override void Visit (ThisReferenceExpression node)
{
Write ("this");
}
public override void Visit (FieldReferenceExpression node)
{
if (node.Target != null)
{
Visit(node.Target);
Write(".{0}", node.Field.Name);
}
else
{
Write("{0}.{1}", node.Field.DeclaringType.FullName, node.Field.Name);
}
}
public override void Visit (MethodReferenceExpression node)
{
MethodReference method = node.Method;
if (null == node.Target) {
Write (Formatter.FormatTypeReference (method.DeclaringType));
} else {
Visit (node.Target);
}
Write (".{0}", method.Name);
}
public override void Visit (MethodInvocationExpression node)
{
Visit (node.Target);
Write ("(");
for (int i=0; i < node.Arguments.Count; ++i) {
if (i > 0) Write (", ");
Visit (node.Arguments [i]);
}
Write (")");
}
public override void Visit (VariableReferenceExpression node)
{
string name = "local" + node.Variable.Index;
Write (name);
}
public override void Visit (LiteralExpression node)
{
object value = node.Value;
if (value is string) {
Write ("\"{0}\"", value);
return;
}
Write (value == null ? "null" : Formatter.ToInvariantCultureString (value).ToLower ());
}
public override void Visit (UnaryExpression node)
{
Write ("(");
Write (ToString (node.Operator));
Visit (node.Operand);
Write (")");
}
static string ToString (UnaryOperator op)
{
switch (op) {
case UnaryOperator.BitwiseComplement: return "~";
case UnaryOperator.Not: return "!";
}
throw new ArgumentException (op.ToString (), "op");
}
static string ToString (BinaryOperator op)
{
switch (op) {
case BinaryOperator.LogicalAnd: return "&&";
case BinaryOperator.LogicalOr: return "||";
case BinaryOperator.Add: return "+";
case BinaryOperator.Subtract: return "-";
case BinaryOperator.Multiply: return "*";
case BinaryOperator.Divide: return "/";
case BinaryOperator.ValueEquality: return "==";
case BinaryOperator.ValueInequality: return "!=";
case BinaryOperator.LessThan: return "<";
case BinaryOperator.LessThanOrEqual: return "<=";
case BinaryOperator.GreaterThan: return ">";
case BinaryOperator.GreaterThanOrEqual: return ">=";
case BinaryOperator.RightShift: return ">>";
case BinaryOperator.LeftShift: return "<<";
case BinaryOperator.BitwiseAnd: return "&";
case BinaryOperator.BitwiseOr: return "|";
case BinaryOperator.BitwiseXor: return "^";
case BinaryOperator.Modulo: return "%";
}
throw new ArgumentException (op.ToString (), "op");
}
void Write (string text)
{
_writer.Write (text);
}
void Write (string format, params object [] args)
{
_writer.Write (format, args);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/TryCastExpression.cs 0000644 0001750 0001750 00000003451 11620326252 031606 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class TryCastExpression : Expression {
Expression _target;
TypeReference _toType;
public TryCastExpression (Expression target, TypeReference toType)
{
_target = target;
_toType = toType;
}
public Expression Target
{
get { return _target; }
}
public TypeReference ToType
{
get { return _toType; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.TryCastExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011566 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/MethodInvocationExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/MethodInvocationExpre0000644 0001750 0001750 00000003622 11620326252 032007 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.CodeStructure {
public class MethodInvocationExpression : Expression {
Expression _target;
Collection _arguments;
public MethodInvocationExpression (Expression target, Collection arguments)
{
_target = target;
_arguments = arguments;
}
public Expression Target
{
get { return _target; }
}
public Collection Arguments
{
get { return _arguments; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.MethodInvocationExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/LiteralExpression.cs 0000644 0001750 0001750 00000003221 11620326252 031604 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class LiteralExpression : Expression {
object _value;
public LiteralExpression (object value)
{
_value = value;
}
public object Value
{
get { return _value; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.LiteralExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ThisReferenceExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/ThisReferenceExpressi0000644 0001750 0001750 00000003072 11620326252 032001 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class ThisReferenceExpression : Expression {
public ThisReferenceExpression ()
{
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.ThisReferenceExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/VariableReferenceExpression.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/VariableReferenceExpr0000644 0001750 0001750 00000003342 11620326252 031733 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class VariableReferenceExpression : Expression {
VariableReference _variable;
public VariableReferenceExpression (VariableReference variable)
{
_variable = variable;
}
public VariableReference Variable
{
get { return _variable; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.VariableReferenceExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CodeStructure/BinaryExpression.cs 0000644 0001750 0001750 00000003642 11620326252 031443 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
// Warning: generated do not edit
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.CodeStructure {
public class BinaryExpression : Expression {
BinaryOperator _operator;
Expression _left;
Expression _right;
public BinaryExpression (BinaryOperator operator_, Expression left, Expression right)
{
_operator = operator_;
_left = left;
_right = right;
}
public BinaryOperator Operator
{
get { return _operator; }
}
public Expression Left
{
get { return _left; }
}
public Expression Right
{
get { return _right; }
}
public override CodeElementType CodeElementType
{
get { return CodeElementType.BinaryExpression; }
}
public override void Accept (ICodeStructureVisitor visitor)
{
visitor.Visit (this);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ 0000755 0001750 0001750 00000000000 11620326252 025055 5 ustar laney laney cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ActionType.cs 0000644 0001750 0001750 00000002410 11620326252 027460 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace Cecil.FlowAnalysis.ActionFlow {
public enum ActionType {
Assign,
Invoke,
Branch,
ConditionalBranch,
Return
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/BranchActionBlock.cs 0000644 0001750 0001750 00000004010 11620326252 030705 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Cecil.FlowAnalysis.ActionFlow;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ActionFlow {
public class BranchActionBlock : ActionBlock {
ActionBlock _target;
public ActionBlock Target {
get { return _target; }
}
public override ActionType ActionType {
get { return ActionType.Branch; }
}
public override ActionBlock [] Successors {
get { return new ActionBlock [] { _target }; }
}
public BranchActionBlock (Instruction sourceInstruction) : base (sourceInstruction)
{
}
internal void SetTarget (ActionBlock target)
{
if (null == target) throw new ArgumentNullException ("target");
_target = target;
AddAsPredecessorOf (target);
}
internal override void ReplaceSuccessor (ActionBlock existing, ActionBlock newBlock)
{
if (_target != existing) throw new ArgumentException ("existing");
_target = newBlock;
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ActionFlowGraph.cs 0000644 0001750 0001750 00000005537 11620326252 030445 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Cecil.FlowAnalysis.ActionFlow;
using Cecil.FlowAnalysis.ControlFlow;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.ActionFlow {
public class ActionFlowGraph {
Collection _blocks;
ControlFlowGraph _cfg;
public ActionFlowGraph (ControlFlowGraph cfg, Collection blocks)
{
if (null == cfg) throw new ArgumentNullException ("cfg");
if (null == blocks) throw new ArgumentNullException ("blocks");
_cfg = cfg;
_blocks = blocks;
}
public ControlFlowGraph ControlFlowGraph {
get { return _cfg; }
}
public Collection Blocks {
get { return _blocks; }
}
public bool IsBranchTarget (ActionBlock block)
{
if (null == block) throw new ArgumentNullException ("block");
foreach (ActionBlock p in block.Predecessors) {
switch (p.ActionType) {
case ActionType.Branch:
BranchActionBlock br = (BranchActionBlock) p;
if (br.Target == block) return true;
break;
case ActionType.ConditionalBranch:
ConditionalBranchActionBlock cbr = (ConditionalBranchActionBlock) p;
if (cbr.Then == block) return true;
break;
}
}
return false;
}
internal void ReplaceAt (int index, ActionBlock block)
{
if (null == block) throw new ArgumentNullException ("block");
ActionBlock existing = _blocks [index];
foreach (ActionBlock p in existing.Predecessors.ToArray ()) {
p.ReplaceSuccessor (existing, block);
}
Remove (existing);
_blocks.Insert (index, block);
}
void Remove (ActionBlock block)
{
foreach (ActionBlock s in block.Successors) {
s.RemovePredecessor (block);
if (0 == s.Predecessors.Count) {
Remove (s);
}
}
_blocks.Remove (block);
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ReturnActionBlock.cs 0000644 0001750 0001750 00000003537 11620326252 031004 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Cecil.FlowAnalysis.CodeStructure;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ActionFlow {
public class ReturnActionBlock : ActionBlock {
Expression _expression;
public override ActionType ActionType {
get { return ActionType.Return; }
}
public Expression Expression {
get { return _expression; }
}
public override ActionBlock [] Successors {
get { return new ActionBlock [0]; }
}
public ReturnActionBlock (Instruction sourceInstruction, Expression expression)
: base (sourceInstruction)
{
_expression = expression;
}
internal override void ReplaceSuccessor (ActionBlock existing, ActionBlock newBlock)
{
throw new InvalidOperationException ();
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ActionBlock.cs 0000644 0001750 0001750 00000004255 11620326252 027602 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.ActionFlow
{
///
///
public abstract class ActionBlock {
Collection _predecessors = new Collection ();
Instruction _sourceInstruction;
public Instruction SourceInstruction {
get { return _sourceInstruction; }
}
public virtual Collection Predecessors {
get { return _predecessors; }
}
public abstract ActionType ActionType {
get;
}
public abstract ActionBlock [] Successors {
get;
}
internal ActionBlock (Instruction sourceInstruction)
{
if (null == sourceInstruction) throw new ArgumentNullException ("sourceInstruction");
_sourceInstruction = sourceInstruction;
}
protected void AddAsPredecessorOf (ActionBlock block)
{
block.Predecessors.Add (this);
}
internal void RemovePredecessor (ActionBlock block)
{
_predecessors.Remove (block);
}
internal abstract void ReplaceSuccessor (ActionBlock existing, ActionBlock newBlock);
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/AssignActionBlock.cs 0000644 0001750 0001750 00000003306 11620326252 030743 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using Cecil.FlowAnalysis.ActionFlow;
using Cecil.FlowAnalysis.CodeStructure;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ActionFlow {
public class AssignActionBlock : AbstractFallThroughActionBlock {
AssignExpression _assignExpression;
public override ActionType ActionType {
get { return ActionType.Assign; }
}
public AssignExpression AssignExpression {
get { return _assignExpression; }
}
public AssignActionBlock (Instruction sourceInstruction, AssignExpression assign)
: base (sourceInstruction)
{
_assignExpression = assign;
}
}
}
././@LongLink 0000000 0000000 0000000 00000000156 00000000000 011567 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/AbstractFallThroughActionBlock.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/AbstractFallThroughActio0000644 0001750 0001750 00000003601 11620326252 031663 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ActionFlow {
public abstract class AbstractFallThroughActionBlock : ActionBlock {
protected ActionBlock _next;
public ActionBlock Next {
get { return _next; }
}
public override ActionBlock [] Successors {
get { return new ActionBlock [] { _next }; }
}
public AbstractFallThroughActionBlock (Instruction sourceInstruction) : base (sourceInstruction)
{
}
internal void SetNext (ActionBlock next)
{
if (null == next) return;
_next = next;
AddAsPredecessorOf (_next);
}
internal override void ReplaceSuccessor (ActionBlock existing, ActionBlock newBlock)
{
if (_next != existing) throw new ArgumentException ("existing");
_next = newBlock;
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/InvokeActionBlock.cs 0000644 0001750 0001750 00000003342 11620326252 030752 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using Cecil.FlowAnalysis.ActionFlow;
using Cecil.FlowAnalysis.CodeStructure;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ActionFlow {
public class InvokeActionBlock : AbstractFallThroughActionBlock {
MethodInvocationExpression _expression;
public override ActionType ActionType {
get {
return ActionType.Invoke;
}
}
public MethodInvocationExpression Expression {
get {
return _expression;
}
}
public InvokeActionBlock (Instruction sourceInstruction, MethodInvocationExpression expression)
: base (sourceInstruction)
{
_expression = expression;
}
}
}
././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ConditionalBranchActionBlock.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ConditionalBranchActionB0000644 0001750 0001750 00000005074 11620326252 031627 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Cecil.FlowAnalysis.CodeStructure;
using Mono.Cecil.Cil;
namespace Cecil.FlowAnalysis.ActionFlow {
///
///
public class ConditionalBranchActionBlock : ActionBlock {
Expression _condition;
ActionBlock _then;
ActionBlock _else;
public override ActionType ActionType {
get { return ActionType.ConditionalBranch; }
}
public Expression Condition {
get { return _condition; }
}
public ActionBlock Then {
get { return _then; }
}
public ActionBlock Else {
get { return _else; }
}
public override ActionBlock [] Successors {
get {
return _else != null
? new ActionBlock [] { _then, _else }
: new ActionBlock [] { _then };
}
}
public ConditionalBranchActionBlock (Instruction sourceInstruction, Expression condition)
: base (sourceInstruction)
{
if (null == condition) throw new ArgumentNullException ("condition");
_condition = condition;
}
internal void SetTargets (ActionBlock then, ActionBlock else_)
{
if (null == then) throw new ArgumentNullException ("then");
AddAsPredecessorOf (then);
if (null != else_) AddAsPredecessorOf (else_);
_then = then;
_else = else_;
}
internal override void ReplaceSuccessor (ActionBlock existing, ActionBlock newBlock)
{
if (existing == _then)
_then = newBlock;
else if (existing == _else)
_else = newBlock;
else
throw new ArgumentException ("existing");
}
}
}
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ActionFlowGraphBuilder.cs cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ActionFlowGraphBuilder.c0000644 0001750 0001750 00000031712 11620326252 031563 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using Cecil.FlowAnalysis.ActionFlow;
using Cecil.FlowAnalysis.ControlFlow;
using Cecil.FlowAnalysis.CodeStructure;
using Cecil.FlowAnalysis.Utilities;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.ActionFlow {
///
///
internal class ActionFlowGraphBuilder : AbstractInstructionVisitor {
Collection _blocks = new Collection ();
Dictionary _instruction2block = new Dictionary ();
HashSet _processed = new HashSet ();
ExpressionDecompiler _expressionDecompiler;
MethodDefinition _method;
ControlFlowGraph _cfg;
Instruction _current;
ActionFlowGraph _graph;
internal ActionFlowGraphBuilder (ControlFlowGraph cfg)
{
_method = cfg.MethodBody.Method;
_cfg = cfg;
_expressionDecompiler = new ExpressionDecompiler (_method);
_graph = new ActionFlowGraph (_cfg, _blocks);
}
public ActionFlowGraph BuildGraph ()
{
Run ();
return _graph;
}
void Run ()
{
ProcessBlocks ();
ConnectActionBlocks ();
SimplifyActionBlocks ();
}
void SimplifyActionBlocks ()
{
int index = 0;
while (index < _blocks.Count) {
ActionBlock block = _blocks [index];
switch (block.ActionType) {
case ActionType.ConditionalBranch:
/// if condition goto label
/// return expression
/// label: return true
/// |
/// V
/// return (condition || expression)
///
/// label: return false
/// |
/// V
/// return (!condition || expression)
ConditionalBranchActionBlock cbr = (ConditionalBranchActionBlock)block;
if (IsReturnTrueOrFalse (cbr.Then)
&& IsReturn (cbr.Else)
&& 1 == cbr.Then.Predecessors.Count
&& 1 == cbr.Else.Predecessors.Count) {
BinaryOperator op = BinaryOperator.LogicalOr;
Expression lhs = cbr.Condition;
Expression rhs = ((ReturnActionBlock) cbr.Else).Expression;
if (((LiteralExpression) ((ReturnActionBlock) cbr.Then).Expression).Value.Equals (0)) {
op = BinaryOperator.LogicalAnd;
_expressionDecompiler.Negate (lhs);
lhs = _expressionDecompiler.Pop ();
}
ActionBlock newBlock = new ReturnActionBlock (
block.SourceInstruction,
new BinaryExpression (op, lhs, rhs));
_graph.ReplaceAt (index, newBlock);
index = 0;
continue;
}
break;
}
++index;
}
}
static bool IsReturnTrueOrFalse (ActionBlock block)
{
ReturnActionBlock ret = block as ReturnActionBlock;
return ret != null && IsTrueOrFalse (ret.Expression);
}
static bool IsTrueOrFalse (Expression expression)
{
LiteralExpression literal = expression as LiteralExpression;
return literal != null
&& literal.Value != null
&& (literal.Value.Equals (1)
|| literal.Value.Equals (0));
}
static bool IsReturn (ActionBlock block)
{
return block.ActionType == ActionType.Return;
}
void ConnectActionBlocks ()
{
for (int i=0; i < _blocks.Count; ++i) {
ActionBlock block = _blocks [i];
switch (block.ActionType) {
case ActionType.Branch:
BranchActionBlock br = (BranchActionBlock) block;
br.SetTarget (GetBranchTarget (br.SourceInstruction));
break;
case ActionType.ConditionalBranch:
ConditionalBranchActionBlock cbr = (ConditionalBranchActionBlock) block;
cbr.SetTargets (GetBranchTarget (cbr.SourceInstruction), GetBlockAtOrNull (i + 1));
break;
case ActionType.Return:
break;
default:
AbstractFallThroughActionBlock ftb = (AbstractFallThroughActionBlock) block;
ftb.SetNext (GetBlockAtOrNull (i + 1));
break;
}
}
}
ActionBlock GetBlockAtOrNull (int index)
{
return index >= _blocks.Count
? null
: _blocks [index];
}
ActionBlock GetBranchTarget (Instruction instruction)
{
return GetActionBlock ((Instruction) instruction.Operand);
}
void ProcessBlocks ()
{
foreach (InstructionBlock block in _cfg.Blocks) {
if (WasProcessed (block)) continue;
_current = block.FirstInstruction;
ProcessBlock (block);
}
}
void ProcessBlock (InstructionBlock block)
{
switch (block.Successors.Length) {
case 0:
case 1:
ProcessSimpleBlock (block);
break;
case 2:
ProcessTwoWayBlock (block);
break;
default:
throw new ArgumentException ("n-way block not supported", "block");
}
MarkProcessed (block);
}
void ProcessTwoWayBlock (InstructionBlock block)
{
if (IsLogicalExpression (block)) {
ProcessLogicalExpressionBlock (block);
} else {
ProcessSimpleBlock (block);
}
}
///
/// Checks if the subgraph starting at block represents
/// a logical expression.
///
///
///
bool IsLogicalExpression (InstructionBlock block)
{
return IsLogicalExpression (new HashSet (), block);
}
bool IsLogicalExpression (HashSet visited, InstructionBlock block)
{
if (visited.Contains (block)) return false;
visited.Add (block);
foreach (InstructionBlock successor in block.Successors) {
if (GetStackAfter (successor.LastInstruction) > 0) return true;
if (IsLogicalExpression (visited, successor)) return true;
}
return false;
}
void ProcessSimpleBlock (InstructionBlock block)
{
foreach (Instruction instruction in block) {
_expressionDecompiler.Visit (instruction);
if (0 == GetStackAfter (instruction)) {
CreateActionBlock (instruction);
_current = instruction.Next;
}
}
}
void ProcessLogicalExpressionBlock (InstructionBlock block)
{
switch (DetectExpressionPattern (block)) {
case ExpressionPattern.SimpleOr:
ProcessOr (block);
break;
case ExpressionPattern.SimpleNotAnd:
ProcessNotAnd (block);
break;
case ExpressionPattern.NestedNotAnd:
ProcessNestedNotAnd (block);
break;
default:
throw new ArgumentException ("Unknown expression pattern starting at " + Formatter.FormatInstruction (block.FirstInstruction), "block");
}
MarkProcessed (block.Successors);
}
enum ExpressionPattern {
Unknown,
SimpleOr,
SimpleNotAnd,
NestedNotAnd
}
static ExpressionPattern DetectExpressionPattern (InstructionBlock block)
{
InstructionBlock then = GetThen (block);
if (IsTrue (then)) return ExpressionPattern.SimpleOr;
if (IsFalse (then)) return ExpressionPattern.SimpleNotAnd;
// the following flow graph patterns are described in
// Decompilation of .NET Bytecode, Computer Science Tripos Part II
// Trinity Hall, May 13, 2004
// Fig. 3.10 on pg. 43
// pattern 4: !x && y
if (GetElse (GetElse (block)) == then) return ExpressionPattern.NestedNotAnd;
return ExpressionPattern.Unknown;
}
void ProcessNestedNotAnd (InstructionBlock block)
{
BuildNegateExpression (block);
InstructionBlock y = GetElse (block);
BuildExpression (y);
_expressionDecompiler.PushBinaryExpression (BinaryOperator.LogicalAnd);
ProcessNestedExpression (y);
}
void ProcessOr (InstructionBlock block)
{
BuildExpression (block);
ProcessNestedExpression (GetElse (block));
_expressionDecompiler.PushBinaryExpression (BinaryOperator.LogicalOr);
}
void ProcessNotAnd (InstructionBlock block)
{
BuildNegateExpression (block);
ProcessNestedExpression (GetElse (block));
_expressionDecompiler.PushBinaryExpression (BinaryOperator.LogicalAnd);
}
void BuildNegateExpression (InstructionBlock block)
{
BuildExpression (block);
_expressionDecompiler.Negate ();
}
void ProcessNestedExpression (InstructionBlock block)
{
switch (block.Successors.Length) {
case 1:
BuildExpression (block);
break;
case 2:
ProcessLogicalExpressionBlock (block);
break;
default:
throw new ArgumentException ("block");
}
}
void BuildExpression (InstructionBlock block)
{
if (WasProcessed (block)) return;
foreach (Instruction instruction in block) {
_expressionDecompiler.Visit (instruction);
}
MarkProcessed (block);
}
static bool IsTrue (InstructionBlock block)
{
return block.FirstInstruction == block.LastInstruction
&& block.FirstInstruction.OpCode.Value == OpCodes.Ldc_I4_1.Value;
}
static bool IsFalse (InstructionBlock block)
{
return block.FirstInstruction == block.LastInstruction
&& block.FirstInstruction.OpCode.Value == OpCodes.Ldc_I4_0.Value;
}
void AssertStackIsEmpty ()
{
if (0 == _expressionDecompiler.Count) return;
throw new InvalidOperationException ("stack should be empty after a statement");
}
void CreateActionBlock (Instruction instruction)
{
Visit (instruction);
AssertStackIsEmpty ();
}
public override void OnBrfalse (Instruction instruction)
{
AddConditionalBranch (instruction);
}
public override void OnBrtrue (Instruction instruction)
{
AddConditionalBranch (instruction);
}
public override void OnBle (Instruction instruction)
{
AddConditionalBranch (instruction);
}
public override void OnBlt (Instruction instruction)
{
AddConditionalBranch (instruction);
}
public override void OnBeq (Instruction instruction)
{
AddConditionalBranch (instruction);
}
public override void OnBne_Un (Instruction instruction)
{
AddConditionalBranch (instruction);
}
public override void OnBge (Instruction instruction)
{
AddConditionalBranch (instruction);
}
void AddConditionalBranch (Instruction instruction)
{
Add (new ConditionalBranchActionBlock (instruction, Pop ()));
}
public override void OnNop (Instruction instruction)
{
}
public override void OnRet (Instruction instruction)
{
Expression expression = null;
if (1 == GetStackBefore (instruction))
expression = Pop ();
Add (new ReturnActionBlock (instruction, expression));
}
public override void OnCall (Instruction instruction)
{
Add (new InvokeActionBlock (instruction, (MethodInvocationExpression) Pop ()));
}
public override void OnCallvirt (Instruction instruction)
{
OnCall (instruction);
}
public override void OnPop (Instruction instruction)
{
Visit (instruction.Previous);
}
public override void OnBr (Instruction instruction)
{
Add (new BranchActionBlock (instruction));
}
public override void OnStloc_0 (Instruction instruction)
{
Add (new AssignActionBlock (instruction, (AssignExpression) Pop ()));
}
public override void OnStfld (Instruction instruction)
{
Add (new AssignActionBlock (instruction, (AssignExpression) Pop ()));
}
public override void OnStsfld (Instruction instruction)
{
OnStfld (instruction);
}
int GetStackBefore (Instruction instruction)
{
return GetInstructionData (instruction).StackBefore;
}
int GetStackAfter (Instruction instruction)
{
return GetInstructionData (instruction).StackAfter;
}
InstructionData GetInstructionData (Instruction instruction)
{
return _cfg.GetData (instruction);
}
void Add (ActionBlock block)
{
if (null == block) throw new ArgumentNullException ("block");
_blocks.Add (block);
_instruction2block.Add (_current, block);
}
ActionBlock GetActionBlock (Instruction block)
{
return _instruction2block [block];
}
Expression Pop ()
{
return _expressionDecompiler.Pop ();
}
void MarkProcessed (InstructionBlock [] blocks)
{
foreach (InstructionBlock block in blocks) {
MarkProcessed (block);
}
}
void MarkProcessed (InstructionBlock block)
{
_processed.Add (block);
}
bool WasProcessed (InstructionBlock block)
{
return _processed.Contains (block);
}
static InstructionBlock GetThen (InstructionBlock block)
{
return block.Successors [0];
}
static InstructionBlock GetElse (InstructionBlock block)
{
return block.Successors [1];
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/ActionFlow/ExpressionDecompiler.cs 0000755 0001750 0001750 00000037435 11620326252 031566 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using Cecil.FlowAnalysis.Utilities;
using Cecil.FlowAnalysis.CodeStructure;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
namespace Cecil.FlowAnalysis.ActionFlow {
internal class Stack : IEnumerable {
readonly Collection collection = new Collection ();
public int Count {
get { return collection.Count; }
}
public T Peek ()
{
if (collection.Count == 0)
throw new InvalidOperationException ();
return collection [collection.Count - 1];
}
public void Push (T value)
{
collection.Add (value);
}
public T Pop ()
{
if (collection.Count == 0)
throw new InvalidOperationException ();
var top = collection.Count - 1;
var value = collection [top];
collection.RemoveAt (top);
return value;
}
public IEnumerator GetEnumerator ()
{
return collection.GetEnumerator ();
}
IEnumerator IEnumerable.GetEnumerator ()
{
return GetEnumerator ();
}
}
internal class ExpressionDecompiler : AbstractInstructionVisitor {
Stack _expressionStack;
MethodDefinition _method;
public int Count {
get { return _expressionStack.Count; }
}
public ExpressionDecompiler (MethodDefinition method)
{
_method = method;
_expressionStack = new Stack ();
}
public override void OnNop (Instruction instruction)
{
}
public override void OnRet (Instruction instruction)
{
}
public override void OnBr (Instruction instruction)
{
}
public override void OnStloc_0 (Instruction instruction)
{
PushVariableAssignement (0);
}
public override void OnStloc_1 (Instruction instruction)
{
PushVariableAssignement (1);
}
public override void OnStloc_2 (Instruction instruction)
{
PushVariableAssignement (2);
}
public override void OnStloc_3 (Instruction instruction)
{
PushVariableAssignement (3);
}
public override void OnStloc (Instruction instruction)
{
PushVariableAssignement ((VariableReference) instruction.Operand);
}
private void PushVariableAssignement (VariableReference variable)
{
PushVariableAssignement (variable.Index);
}
private void PushVariableAssignement (int index)
{
PushVariableReference (index);
PushAssignment (Pop (), Pop ());
}
public override void OnStsfld (Instruction instruction)
{
FieldReference field = (FieldReference) instruction.Operand;
PushAssignment (new FieldReferenceExpression (null, field), Pop());
}
public override void OnStfld (Instruction instruction)
{
FieldReference field = (FieldReference) instruction.Operand;
Expression expression = Pop ();
Expression target = Pop ();
PushAssignment(new FieldReferenceExpression (target, field), expression);
}
private void PushAssignment (Expression lvalue, Expression rvalue)
{
Push (
new AssignExpression (
lvalue,
rvalue));
}
public override void OnCallvirt (Instruction instruction)
{
OnCall (instruction);
}
public override void OnBox (Instruction instruction)
{
Push(
new CastExpression (
Pop (),
(TypeReference) instruction.Operand));
}
public override void OnCastclass (Instruction instruction)
{
Push (
new CastExpression (
Pop (),
(TypeReference) instruction.Operand));
}
public override void OnIsinst (Instruction instruction)
{
Push (
new TryCastExpression (
Pop (),
(TypeReference) instruction.Operand));
}
public override void OnCall (Instruction instruction)
{
MethodReference method = (MethodReference) instruction.Operand;
Collection args = PopRange (method.Parameters.Count);
Expression target = method.HasThis ? Pop () : null;
Push (
new MethodInvocationExpression (
new MethodReferenceExpression (target, method), args));
}
public override void OnDup (Instruction instruction)
{
Expression expression = Pop ();
Push (expression);
Push (expression);
}
public override void OnPop (Instruction instruction)
{
}
public override void OnAdd (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.Add);
}
public override void OnSub (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.Subtract);
}
public override void OnMul (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.Multiply);
}
public override void OnDiv (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.Divide);
}
public void PushBinaryExpression (BinaryOperator op)
{
Expression rhs = Pop ();
Expression lhs = Pop ();
Push (new BinaryExpression (op, lhs, rhs));
}
public override void OnLdstr (Instruction instruction)
{
PushLiteral (instruction.Operand);
}
public override void OnLdc_R4 (Instruction instruction)
{
PushLiteral (instruction.Operand);
}
public override void OnLdc_R8 (Instruction instruction)
{
PushLiteral (instruction.Operand);
}
public override void OnLdc_I8 (Instruction instruction)
{
PushLiteral (instruction.Operand);
}
public override void OnLdc_I4 (Instruction instruction)
{
PushLiteral (instruction.Operand);
}
public override void OnLdc_I4_M1 (Instruction instruction)
{
PushLiteral (-1);
}
public override void OnLdc_I4_0 (Instruction instruction)
{
PushLiteral (0);
}
public override void OnLdc_I4_1 (Instruction instruction)
{
PushLiteral (1);
}
public override void OnLdc_I4_2 (Instruction instruction)
{
PushLiteral (2);
}
public override void OnLdc_I4_3 (Instruction instruction)
{
PushLiteral (3);
}
public override void OnLdc_I4_4 (Instruction instruction)
{
PushLiteral (4);
}
public override void OnLdc_I4_5 (Instruction instruction)
{
PushLiteral (5);
}
public override void OnLdc_I4_6 (Instruction instruction)
{
PushLiteral (6);
}
public override void OnLdc_I4_7 (Instruction instruction)
{
PushLiteral (7);
}
public override void OnLdc_I4_8 (Instruction instruction)
{
PushLiteral (8);
}
public override void OnLdloc_0 (Instruction instruction)
{
PushVariableReference (0);
}
public override void OnLdloc_1 (Instruction instruction)
{
PushVariableReference (1);
}
public override void OnLdloc_2 (Instruction instruction)
{
PushVariableReference (2);
}
public override void OnLdloc_3 (Instruction instruction)
{
PushVariableReference (3);
}
public override void OnLdloc (Instruction instruction)
{
PushVariableReference ((VariableReference) instruction.Operand);
}
public override void OnCeq (Instruction instruction)
{
// XXX: ceq might be used for reference equality as well
Expression rhs = Pop ();
Expression lhs = Pop ();
// simplify common expression patterns
// ((x < y) == 0) => x >= y
// ((x > y) == 0) => x <= y
// ((x == y) == 0) => x != y
// (BooleanMethod(x) == 0) => !BooleanMethod(x)
if (IsBooleanExpression (lhs) && IsFalse (rhs)) {
Negate (lhs);
} else {
Push (new BinaryExpression (BinaryOperator.ValueEquality, lhs, rhs));
}
}
static bool IsFalse (Expression expression)
{
LiteralExpression literal = expression as LiteralExpression;
return literal != null && literal.Value.Equals (0);
}
bool IsBooleanExpression (Expression expression)
{
switch (expression.CodeElementType) {
case CodeElementType.BinaryExpression:
return IsComparisonOperator (((BinaryExpression) expression).Operator);
case CodeElementType.MethodInvocationExpression:
MethodReferenceExpression mre = ((MethodInvocationExpression) expression).Target as MethodReferenceExpression;
if (null != mre) return mre.Method.ReturnType.MetadataType == MetadataType.Boolean;
break;
}
return false;
}
static bool IsComparisonOperator (BinaryOperator op)
{
switch (op) {
case BinaryOperator.GreaterThan:
case BinaryOperator.LessThan:
case BinaryOperator.GreaterThanOrEqual:
case BinaryOperator.LessThanOrEqual:
case BinaryOperator.ValueEquality:
case BinaryOperator.ValueInequality:
return true;
}
return false;
}
public override void OnClt (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LessThan);
}
public override void OnClt_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LessThan);
}
public override void OnCgt (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.GreaterThan);
}
public override void OnCgt_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.GreaterThan);
}
public override void OnBeq (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.ValueEquality);
}
public override void OnBne_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.ValueInequality);
}
public override void OnBle (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LessThanOrEqual);
}
public override void OnBle_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LessThanOrEqual);
}
public override void OnBgt (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.GreaterThan);
}
public override void OnBgt_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.GreaterThan);
}
public override void OnBge (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.GreaterThanOrEqual);
}
public override void OnBge_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.GreaterThanOrEqual);
}
public override void OnBlt (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LessThan);
}
public override void OnBlt_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LessThan);
}
public override void OnShr (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.RightShift);
}
public override void OnShr_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.RightShift);
}
public override void OnShl (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.LeftShift);
}
public override void OnOr (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.BitwiseOr);
}
public override void OnAnd (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.BitwiseAnd);
}
public override void OnXor (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.BitwiseXor);
}
public override void OnRem (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.Modulo);
}
public override void OnRem_Un (Instruction instruction)
{
PushBinaryExpression (BinaryOperator.Modulo);
}
public override void OnNot (Instruction instruction)
{
PushUnaryExpression (UnaryOperator.BitwiseComplement, Pop ());
}
public override void OnBrtrue (Instruction instruction)
{
}
public override void OnBrfalse (Instruction instruction)
{
Negate ();
}
private void PushVariableReference (int index)
{
PushVariableReference (_method.Body.Variables [index]);
}
private void PushVariableReference (VariableReference variable)
{
Push (new VariableReferenceExpression (variable));
}
public override void OnLdfld (Instruction instruction)
{
Push (new FieldReferenceExpression (Pop (), (FieldReference) instruction.Operand));
}
public override void OnLdsfld (Instruction instruction)
{
Push (new FieldReferenceExpression (null, (FieldReference) instruction.Operand));
}
public override void OnLdnull (Instruction instruction)
{
PushLiteral (null);
}
public override void OnLdarg_0 (Instruction instruction)
{
PushArgumentReference (0);
}
public override void OnLdarg_1 (Instruction instruction)
{
PushArgumentReference (1);
}
public override void OnLdarg_2 (Instruction instruction)
{
PushArgumentReference (2);
}
public override void OnLdarg_3 (Instruction instruction)
{
PushArgumentReference (3);
}
public override void OnLdarg (Instruction instruction)
{
PushArgumentReference (((VariableDefinition)instruction.Operand).Index);
}
public void Negate ()
{
Negate (Pop ());
}
public void Negate (Expression expression)
{
switch (expression.CodeElementType) {
case CodeElementType.BinaryExpression:
BinaryExpression be = (BinaryExpression) expression;
BinaryOperator op = GetInverseOperator (be.Operator);
if (BinaryOperator.None != op) {
Push (new BinaryExpression (op, be.Left, be.Right));
} else {
if (BinaryOperator.LogicalAnd == be.Operator) {
Negate (be.Left);
Negate (be.Right);
PushBinaryExpression (BinaryOperator.LogicalOr);
} else {
PushNotExpression (expression);
}
}
break;
case CodeElementType.UnaryExpression:
UnaryExpression ue = (UnaryExpression) expression;
switch (ue.Operator) {
case UnaryOperator.Not:
Push (ue.Operand);
break;
default:
throw new ArgumentException ("expression");
}
break;
default:
PushNotExpression (expression);
break;
}
}
void PushNotExpression (Expression expression)
{
PushUnaryExpression (UnaryOperator.Not, expression);
}
void PushUnaryExpression (UnaryOperator op, Expression expression)
{
Push (new UnaryExpression (op, expression));
}
static BinaryOperator GetInverseOperator (BinaryOperator op)
{
switch (op) {
case BinaryOperator.ValueEquality:
return BinaryOperator.ValueInequality;
case BinaryOperator.ValueInequality:
return BinaryOperator.ValueEquality;
case BinaryOperator.LessThan:
return BinaryOperator.GreaterThanOrEqual;
case BinaryOperator.LessThanOrEqual:
return BinaryOperator.GreaterThan;
case BinaryOperator.GreaterThan:
return BinaryOperator.LessThanOrEqual;
case BinaryOperator.GreaterThanOrEqual:
return BinaryOperator.LessThan;
}
return BinaryOperator.None;
}
void PushArgumentReference (int index)
{
if (_method.HasThis) {
if (index == 0) {
Push (new ThisReferenceExpression ());
return;
}
index -= 1; // the Parameters collection dos not contain the implict this argument
}
Push (new ArgumentReferenceExpression (_method.Parameters [index]));
}
void PushLiteral (object value)
{
Push (new LiteralExpression (value));
}
void Push (Expression expression)
{
if (null == expression) throw new ArgumentNullException ("expression");
_expressionStack.Push (expression);
}
public Expression Pop ()
{
return (Expression) _expressionStack.Pop ();
}
Collection PopRange (int count)
{
Collection range = new Collection ();
for (int i=0; i < count; ++i) {
range.Insert (0, Pop ());
}
return range;
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/FlowGraphFactory.cs 0000644 0001750 0001750 00000004074 11620326252 026565 0 ustar laney laney #region license
//
// (C) db4objects Inc. http://www.db4o.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using Cecil.FlowAnalysis.ActionFlow;
using Cecil.FlowAnalysis.ControlFlow;
using Mono.Cecil;
namespace Cecil.FlowAnalysis {
///
/// Creates the specific graphs.
///
public class FlowGraphFactory {
public static ControlFlowGraph CreateControlFlowGraph (MethodDefinition method)
{
if (null == method) throw new ArgumentNullException ("method");
ControlFlowGraphBuilder builder = new ControlFlowGraphBuilder (method);
return builder.BuildGraph ();
}
public static ActionFlowGraph CreateActionFlowGraph (ControlFlowGraph cfg)
{
if (null == cfg) throw new ArgumentNullException ("cfg");
ActionFlowGraphBuilder builder = new ActionFlowGraphBuilder (cfg);
return builder.BuildGraph ();
}
public static ActionFlowGraph CreateActionFlowGraph (MethodDefinition method)
{
return CreateActionFlowGraph (CreateControlFlowGraph (method));
}
private FlowGraphFactory ()
{
}
}
}
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/CompactFrameworkCompatibility.cs 0000644 0001750 0001750 00000002615 11620326252 031341 0 ustar laney laney //
// FrameworkCompatibility.cs
//
// Author:
// Rodrigo B. de Oliveira (rodrigobamboo@gmail.com)
//
// (C) 2005 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if CF_1_0
namespace System {
class NotImplementedException : System.Exception {
public NotImplementedException (string message) : base (message)
{
}
public NotImplementedException ()
{
}
}
}
#endif
cecil-flowanalysis-0.1~vcs20110809.r1.b34edf6/Cecil.FlowAnalysis/Cecil.FlowAnalysis.csproj 0000644 0001750 0001750 00000017517 11620326252 027676 0 ustar laney laney 
8.0.50727
{ED1BE103-1699-4116-A732-616BEB142EB2}
Local
2.0
Debug
AnyCPU
Cecil.FlowAnalysis
false
Library
Cecil.FlowAnalysis
OnBuildSuccess
bin\Debug\
false
true
DEBUG;TRACE
4096
false
false
false
false
false
4
full
prompt
AllRules.ruleset
bin\Release\
false
false
TRACE
4096
false
true
false
false
false
4
none
prompt
AllRules.ruleset
true
full
false
bin\silverlight_Debug\
DEBUG;TRACE;NET_3_5;NET_4_0;SILVERLIGHT
prompt
4
Silverlight
v4.0
pdbonly
true
bin\silverlight_Release\
TRACE;NET_3_5;NET_4_0;SILVERLIGHT
prompt
4
Silverlight
v4.0
Code
Code
Code
Code
Code
Code
Code
Code
Code
Code
False
.NET Framework 3.5 SP1 Client Profile
false
False
.NET Framework 3.5 SP1
true
False
Windows Installer 3.1
true
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}
Mono.Cecil