예제 #1
0
        WamInstructionRegister GetNextPermanentRegister(string name)
        {
            var instructionRegister = new WamInstructionRegister(WamInstructionRegisterTypes.Permanent, _nextPermanentRegisterId++);

            _variableAssignments.Add(name, instructionRegister);

            var variableAttribute = new WamInstructionStreamVariableAttribute(
                InstructionStreamBuilder.NextIndex,
                name,
                instructionRegister);

            InstructionStreamBuilder.AddAttribute(variableAttribute);
            return(instructionRegister);
        }
        public Dictionary <int, string> GetPermanentVariableAssignments()
        {
            Dictionary <int, string> result = new Dictionary <int, string>();

            foreach (WamInstructionStreamAttribute attribute in Attributes)
            {
                WamInstructionStreamVariableAttribute variableAttribute = attribute as WamInstructionStreamVariableAttribute;
                if (variableAttribute != null &&
                    variableAttribute.Register.Type == WamInstructionRegisterTypes.Permanent)
                {
                    result.Add(variableAttribute.Register.Id, variableAttribute.Name);
                }
            }

            return(result);
        }
예제 #3
0
        private WamInstructionRegister GetNextPermanentRegister(string name)
        {
            WamInstructionRegister instructionRegister = new WamInstructionRegister(WamInstructionRegisterTypes.Permanent, m_nextPermanentRegisterId++);

            m_variableAssignments.Add(name, instructionRegister);

            WamInstructionStreamVariableAttribute variableAttribute = new WamInstructionStreamVariableAttribute(
                InstructionStreamBuilder.NextIndex,
                name,
                instructionRegister);
            InstructionStreamBuilder.AddAttribute(variableAttribute);

            return instructionRegister;
        }