aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/CodeGen/X86/CodeGenCommon.cs
blob: ae83ea80ca98e779103dd66bc47de49ea2fe7fe6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using ARMeilleure.IntermediateRepresentation;

namespace ARMeilleure.CodeGen.X86
{
    static class CodeGenCommon
    {
        public static bool IsLongConst(Operand op)
        {
            long value = op.Type == OperandType.I32 ? op.AsInt32() : op.AsInt64();

            return !ConstFitsOnS32(value);
        }

        private static bool ConstFitsOnS32(long value)
        {
            return value == (int)value;
        }
    }
}