aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/CodeGen/X86/CodeGenCommon.cs
blob: 237ecee4e076c7564dc6332d1fc5e5f0f9d66bb4 (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;
        }
    }
}