示例#1
0
        StatementList TranslateInstructions(out Dictionary <string, BoogieVariable> temporalVariables)
        {
            InstructionTranslator instTranslator = new InstructionTranslator(this.CHA, methodBody, CFG, inputAssemblies);

            instTranslator.Translate();

            foreach (var v in instTranslator.RemovedVariables)
            {
                methodBody.Variables.Remove(v);
            }

            foreach (var v in instTranslator.AddedVariables)
            {
                methodBody.Variables.Add(v);
            }
            temporalVariables = instTranslator.temporalVariables;
            return(instTranslator.Boogie());
        }
示例#2
0
        private void TranslateInstruction(TranslationContext context, Instruction instruction)
        {
            context.Provider.SourceInstruction = instruction;

            _debugInfo.Inject(context, instruction);
            AddInstructionPrefix(context, instruction);

            context.CastToParamType = true;

            var core = new InstructionTranslator(context);

            core.Translate(instruction);

            var castToParamType = context.CastToParamType;

            var code = context.Code;
            var set  = code.ToArray();

            //we should box receiver for call on boxable types
            BoxReceiver(context, instruction, ref set);

            if (instruction.IsEndOfBasicBlock())
            {
                CastToBlockParam(context);
                PopScope(context.New());
            }

            if (WithSuffix(instruction))
            {
                context.Emit(set);
                if (castToParamType)
                {
                    CastToParamType(context, instruction);
                }
                AddInstructionSuffix(context, instruction);
            }
        }