Exemple #1
0
        private void DereferenceFromRegister(GenericBrotherAction action, Register source)
        {
            if (source.BitSize != Value.BitSize)
            {
                throw new ArgumentException($"Action only allowed with registers of identical size; {source} does not match {Value}");
            }

            action(source, Value);
        }
        private void DereferenceToRegister(Register target, GenericBrotherAction action)
        {
            if (target.BitSize != Value.BitSize)
            {
                throw new ArgumentException($"Action only allowed with registers of identical size; {target} does not match {Value}");
            }

            action(target, Value);
        }
Exemple #3
0
        public void DereferenceFromRegister(
            CodeGen codeGen,
            Register source,
            ILinkingInfo fixer,
            GenericBrotherAction brotherAction,
            GenericToDrefAction drefAction,
            GenericToDref2Action dref2Action,
            GenericToDref3Action dref3Action,
            GenericToDref4Action dref4Action
            )
        {
            switch (Kind)
            {
            case ResultKind.Value:
                DereferenceFromRegister(brotherAction, source);
                return;

            case ResultKind.Pointer:
                DereferenceFromRegister(drefAction, source);
                return;

            case ResultKind.Pointer2:
                DereferenceFromRegister(dref2Action, source);
                return;

            case ResultKind.Pointer3:
                DereferenceFromRegister(dref3Action, source);
                return;

            case ResultKind.Offset:
                DereferenceFromRegister(codeGen, source, dref4Action, fixer);
                return;

            default:
                throw new NotImplementedException($"{nameof(ExpressionResult)}: {nameof(GenerateMoveTo)} has not implemented kind: {Kind}");
            }
        }