public void FindUsesAndDefines() { Defines = new List <String>(); Uses = new List <String>(); if (Kind == CStatement.Kinds.Assignment && Op1.Kind == CStatement.OperandKinds.Variable) { Defines.Add(Op1.Name); } else { if (Op1 != null) { List <String> uses = Op1.GetUses(); if (uses != null) { Uses.AddRange(uses); } } } if (Op2 != null) { List <String> uses = Op2.GetUses(); if (uses != null) { Uses.AddRange(uses); } } if (Condition != null) { if (Condition.Op1 != null) { List <String> uses = Condition.Op1.GetUses(); if (uses != null) { Uses.AddRange(uses); } } if (Condition.Op2 != null) { List <String> uses = Condition.Op2.GetUses(); if (uses != null) { Uses.AddRange(uses); } } } if (BranchDestinationRegister != null) { Uses.Add(BranchDestinationRegister); } if (Kind == Kinds.Call) { Defines.AddRange(new String[] { "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" }); if (CalledFunction != null && CalledFunction.ArgCount != -1) { for (int i = 0; i < CalledFunction.ArgCount; i++) { Uses.Add("r" + (i + 3)); } } else { Uses.AddRange(new String[] { "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" }); } } }