Esempio n. 1
0
        /// <summary>Provides the canonical Architecture form for a given architecture sub architecture pair</summary>
        /// <param name="archType">Architecture type</param>
        /// <param name="subArch">Sub Architecture type</param>
        /// <returns>Canonical <see cref="ArchType"/></returns>
        /// <remarks>
        /// Some architectures, particularly ARM variants, have multiple sub-architecture types that
        /// have a canonical form (i.e. Arch=<see cref="ArchType.Arm"/>; SubArch=<see cref="SubArchType.ARMSubArch_v7m"/>;
        /// has the Canonical Arch of <see cref="ArchType.Thumb"/>). This method retrieves the canonical Arch
        /// for a given architecture,SubArchitecture pair.
        /// </remarks>
        public static ArchType GetCanonicalArchForSubArch(ArchType archType, SubArchType subArch)
        {
            archType.ValidateDefined(nameof(archType));
            subArch.ValidateDefined(nameof(subArch));
            switch (archType)
            {
            case ArchType.Kalimba:
                switch (subArch)
                {
                case SubArchType.NoSubArch:
                case SubArchType.KalimbaSubArch_v3:
                case SubArchType.KalimbaSubArch_v4:
                case SubArchType.KalimbaSubArch_v5:
                    return(ArchType.Kalimba);

                default:
                    return(ArchType.UnknownArch);
                }

            case ArchType.Arm:
            case ArchType.Armeb:
                switch (subArch)
                {
                case SubArchType.ARMSubArch_v6m:
                    return(archType == ArchType.Armeb ? ArchType.Thumbeb : ArchType.Thumb);

                case SubArchType.KalimbaSubArch_v3:
                case SubArchType.KalimbaSubArch_v4:
                case SubArchType.KalimbaSubArch_v5:
                    return(ArchType.UnknownArch);

                default:
                    return(archType);
                }

            default:
                return(archType);
            }
        }
Esempio n. 2
0
 /// <summary>Retrieves the canonical name for an architecture sub type</summary>
 /// <param name="subArchType">Architecture sub type</param>
 /// <returns>String name for the architecture sub type</returns>
 public static string GetCanonicalName(SubArchType subArchType)
 => LibLLVMTripleGetSubArchTypeName(( LibLLVMTripleSubArchType )subArchType) ?? string.Empty;