Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:22

0001 //===-- llvm/BinaryFormat/XCOFF.h - The XCOFF file format -------*- C++/-*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines manifest constants for the XCOFF object file format.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_BINARYFORMAT_XCOFF_H
0014 #define LLVM_BINARYFORMAT_XCOFF_H
0015 
0016 #include <stddef.h>
0017 #include <stdint.h>
0018 
0019 namespace llvm {
0020 class StringRef;
0021 template <unsigned> class SmallString;
0022 template <typename T> class Expected;
0023 
0024 namespace XCOFF {
0025 
0026 // Constants used in the XCOFF definition.
0027 
0028 constexpr size_t FileNamePadSize = 6;
0029 constexpr size_t NameSize = 8;
0030 constexpr size_t AuxFileEntNameSize = 14;
0031 constexpr size_t FileHeaderSize32 = 20;
0032 constexpr size_t FileHeaderSize64 = 24;
0033 constexpr size_t AuxFileHeaderSize32 = 72;
0034 constexpr size_t AuxFileHeaderSize64 = 110;
0035 constexpr size_t AuxFileHeaderSizeShort = 28;
0036 constexpr size_t SectionHeaderSize32 = 40;
0037 constexpr size_t SectionHeaderSize64 = 72;
0038 constexpr size_t SymbolTableEntrySize = 18;
0039 constexpr size_t RelocationSerializationSize32 = 10;
0040 constexpr size_t RelocationSerializationSize64 = 14;
0041 constexpr size_t ExceptionSectionEntrySize32 = 6;
0042 constexpr size_t ExceptionSectionEntrySize64 = 10;
0043 constexpr uint16_t RelocOverflow = 65535;
0044 constexpr uint8_t AllocRegNo = 31;
0045 
0046 enum ReservedSectionNum : int16_t { N_DEBUG = -2, N_ABS = -1, N_UNDEF = 0 };
0047 
0048 enum MagicNumber : uint16_t { XCOFF32 = 0x01DF, XCOFF64 = 0x01F7 };
0049 
0050 // Masks for packing/unpacking the r_rsize field of relocations.
0051 
0052 // The msb is used to indicate if the bits being relocated are signed or
0053 // unsigned.
0054 static constexpr uint8_t XR_SIGN_INDICATOR_MASK = 0x80;
0055 // The 2nd msb is used to indicate that the binder has replaced/modified the
0056 // original instruction.
0057 static constexpr uint8_t XR_FIXUP_INDICATOR_MASK = 0x40;
0058 // The remaining bits specify the bit length of the relocatable reference
0059 // minus one.
0060 static constexpr uint8_t XR_BIASED_LENGTH_MASK = 0x3f;
0061 
0062 // This field only exists in the XCOFF64 definition.
0063 enum AuxHeaderFlags64 : uint16_t {
0064   SHR_SYMTAB = 0x8000,  ///< At exec time, create shared symbol table for program
0065                         ///< (main program only).
0066   FORK_POLICY = 0x4000, ///< Forktree policy specified (main program only).
0067   FORK_COR = 0x2000     ///< If _AOUT_FORK_POLICY is set, specify copy-on-reference
0068                         ///< if this bit is set. Specify copy-on- write otherwise.
0069                         ///< If _AOUT_FORK_POLICY is 0, this bit is reserved for
0070                         ///< future use and should be set to 0.
0071 };
0072 
0073 enum XCOFFInterpret : uint16_t {
0074   OLD_XCOFF_INTERPRET = 1,
0075   NEW_XCOFF_INTERPRET = 2
0076 };
0077 
0078 enum FileFlag : uint16_t {
0079   F_RELFLG = 0x0001,    ///< relocation info stripped from file
0080   F_EXEC = 0x0002,      ///< file is executable (i.e., it
0081                         ///< has a loader section)
0082   F_LNNO = 0x0004,      ///< line numbers stripped from file
0083   F_LSYMS = 0x0008,     ///< local symbols stripped from file
0084   F_FDPR_PROF = 0x0010, ///< file was profiled with FDPR
0085   F_FDPR_OPTI = 0x0020, ///< file was reordered with FDPR
0086   F_DSA = 0x0040,       ///< file uses Dynamic Segment Allocation (32-bit
0087                         ///< only)
0088   F_DEP_1 = 0x0080,     ///< Data Execution Protection bit 1
0089   F_VARPG = 0x0100,     ///< executable requests using variable size pages
0090   F_LPTEXT = 0x0400,    ///< executable requires large pages for text
0091   F_LPDATA = 0x0800,    ///< executable requires large pages for data
0092   F_DYNLOAD = 0x1000,   ///< file is dynamically loadable and
0093                         ///< executable (equivalent to F_EXEC on AIX)
0094   F_SHROBJ = 0x2000,    ///< file is a shared object
0095   F_LOADONLY =
0096       0x4000,      ///< file can be loaded by the system loader, but it is
0097                    ///< ignored by the linker if it is a member of an archive.
0098   F_DEP_2 = 0x8000 ///< Data Execution Protection bit 2
0099 };
0100 
0101 // x_smclas field of x_csect from system header: /usr/include/syms.h
0102 /// Storage Mapping Class definitions.
0103 enum StorageMappingClass : uint8_t {
0104   //     READ ONLY CLASSES
0105   XMC_PR = 0,      ///< Program Code
0106   XMC_RO = 1,      ///< Read Only Constant
0107   XMC_DB = 2,      ///< Debug Dictionary Table
0108   XMC_GL = 6,      ///< Global Linkage (Interfile Interface Code)
0109   XMC_XO = 7,      ///< Extended Operation (Pseudo Machine Instruction)
0110   XMC_SV = 8,      ///< Supervisor Call (32-bit process only)
0111   XMC_SV64 = 17,   ///< Supervisor Call for 64-bit process
0112   XMC_SV3264 = 18, ///< Supervisor Call for both 32- and 64-bit processes
0113   XMC_TI = 12,     ///< Traceback Index csect
0114   XMC_TB = 13,     ///< Traceback Table csect
0115 
0116   //       READ WRITE CLASSES
0117   XMC_RW = 5,   ///< Read Write Data
0118   XMC_TC0 = 15, ///< TOC Anchor for TOC Addressability
0119   XMC_TC = 3,   ///< General TOC item
0120   XMC_TD = 16,  ///< Scalar data item in the TOC
0121   XMC_DS = 10,  ///< Descriptor csect
0122   XMC_UA = 4,   ///< Unclassified - Treated as Read Write
0123   XMC_BS = 9,   ///< BSS class (uninitialized static internal)
0124   XMC_UC = 11,  ///< Un-named Fortran Common
0125 
0126   XMC_TL = 20, ///< Initialized thread-local variable
0127   XMC_UL = 21, ///< Uninitialized thread-local variable
0128   XMC_TE = 22  ///< Symbol mapped at the end of TOC
0129 };
0130 
0131 // Flags for defining the section type. Masks for use with the (signed, 32-bit)
0132 // s_flags field of the section header structure, selecting for values in the
0133 // lower 16 bits. Defined in the system header `scnhdr.h`.
0134 enum SectionTypeFlags : int32_t {
0135   STYP_PAD = 0x0008,
0136   STYP_DWARF = 0x0010,
0137   STYP_TEXT = 0x0020,
0138   STYP_DATA = 0x0040,
0139   STYP_BSS = 0x0080,
0140   STYP_EXCEPT = 0x0100,
0141   STYP_INFO = 0x0200,
0142   STYP_TDATA = 0x0400,
0143   STYP_TBSS = 0x0800,
0144   STYP_LOADER = 0x1000,
0145   STYP_DEBUG = 0x2000,
0146   STYP_TYPCHK = 0x4000,
0147   STYP_OVRFLO = 0x8000
0148 };
0149 
0150 /// Values for defining the section subtype of sections of type STYP_DWARF as
0151 /// they would appear in the (signed, 32-bit) s_flags field of the section
0152 /// header structure, contributing to the 16 most significant bits. Defined in
0153 /// the system header `scnhdr.h`.
0154 enum DwarfSectionSubtypeFlags : int32_t {
0155   SSUBTYP_DWINFO = 0x1'0000,  ///< DWARF info section
0156   SSUBTYP_DWLINE = 0x2'0000,  ///< DWARF line section
0157   SSUBTYP_DWPBNMS = 0x3'0000, ///< DWARF pubnames section
0158   SSUBTYP_DWPBTYP = 0x4'0000, ///< DWARF pubtypes section
0159   SSUBTYP_DWARNGE = 0x5'0000, ///< DWARF aranges section
0160   SSUBTYP_DWABREV = 0x6'0000, ///< DWARF abbrev section
0161   SSUBTYP_DWSTR = 0x7'0000,   ///< DWARF str section
0162   SSUBTYP_DWRNGES = 0x8'0000, ///< DWARF ranges section
0163   SSUBTYP_DWLOC = 0x9'0000,   ///< DWARF loc section
0164   SSUBTYP_DWFRAME = 0xA'0000, ///< DWARF frame section
0165   SSUBTYP_DWMAC = 0xB'0000    ///< DWARF macinfo section
0166 };
0167 
0168 // STORAGE CLASSES, n_sclass field of syment.
0169 // The values come from `storclass.h` and `dbxstclass.h`.
0170 enum StorageClass : uint8_t {
0171   // Storage classes used for symbolic debugging symbols.
0172   C_FILE = 103,  // File name
0173   C_BINCL = 108, // Beginning of include file
0174   C_EINCL = 109, // Ending of include file
0175   C_GSYM = 128,  // Global variable
0176   C_STSYM = 133, // Statically allocated symbol
0177   C_BCOMM = 135, // Beginning of common block
0178   C_ECOMM = 137, // End of common block
0179   C_ENTRY = 141, // Alternate entry
0180   C_BSTAT = 143, // Beginning of static block
0181   C_ESTAT = 144, // End of static block
0182   C_GTLS = 145,  // Global thread-local variable
0183   C_STTLS = 146, // Static thread-local variable
0184 
0185   // Storage classes used for DWARF symbols.
0186   C_DWARF = 112, // DWARF section symbol
0187 
0188   // Storage classes used for absolute symbols.
0189   C_LSYM = 129,  // Automatic variable allocated on stack
0190   C_PSYM = 130,  // Argument to subroutine allocated on stack
0191   C_RSYM = 131,  // Register variable
0192   C_RPSYM = 132, // Argument to function or procedure stored in register
0193   C_ECOML = 136, // Local member of common block
0194   C_FUN = 142,   // Function or procedure
0195 
0196   // Storage classes used for undefined external symbols or
0197   // symbols of general sections.
0198   C_EXT = 2,       // External symbol
0199   C_WEAKEXT = 111, // Weak external symbol
0200 
0201   // Storage classes used for symbols of general sections.
0202   C_NULL = 0,
0203   C_STAT = 3,     // Static
0204   C_BLOCK = 100,  // ".bb" or ".eb"
0205   C_FCN = 101,    // ".bf" or ".ef"
0206   C_HIDEXT = 107, // Un-named external symbol
0207   C_INFO = 110,   // Comment string in .info section
0208   C_DECL = 140,   // Declaration of object (type)
0209 
0210   // Storage classes - Obsolete/Undocumented.
0211   C_AUTO = 1,     // Automatic variable
0212   C_REG = 4,      // Register variable
0213   C_EXTDEF = 5,   // External definition
0214   C_LABEL = 6,    // Label
0215   C_ULABEL = 7,   // Undefined label
0216   C_MOS = 8,      // Member of structure
0217   C_ARG = 9,      // Function argument
0218   C_STRTAG = 10,  // Structure tag
0219   C_MOU = 11,     // Member of union
0220   C_UNTAG = 12,   // Union tag
0221   C_TPDEF = 13,   // Type definition
0222   C_USTATIC = 14, // Undefined static
0223   C_ENTAG = 15,   // Enumeration tag
0224   C_MOE = 16,     // Member of enumeration
0225   C_REGPARM = 17, // Register parameter
0226   C_FIELD = 18,   // Bit field
0227   C_EOS = 102,    // End of structure
0228   C_LINE = 104,
0229   C_ALIAS = 105,  // Duplicate tag
0230   C_HIDDEN = 106, // Special storage class for external
0231   C_EFCN = 255,   // Physical end of function
0232 
0233   // Storage classes - reserved
0234   C_TCSYM = 134 // Reserved
0235 };
0236 
0237 // Flags for defining the symbol type. Values to be encoded into the lower 3
0238 // bits of the (unsigned, 8-bit) x_smtyp field of csect auxiliary symbol table
0239 // entries. Defined in the system header `syms.h`.
0240 enum SymbolType : uint8_t {
0241   XTY_ER = 0, ///< External reference.
0242   XTY_SD = 1, ///< Csect definition for initialized storage.
0243   XTY_LD = 2, ///< Label definition.
0244               ///< Defines an entry point to an initialized csect.
0245   XTY_CM = 3  ///< Common csect definition. For uninitialized storage.
0246 };
0247 
0248 /// Values for visibility as they would appear when encoded in the high 4 bits
0249 /// of the 16-bit unsigned n_type field of symbol table entries. Valid for
0250 /// 32-bit XCOFF only when the vstamp in the auxiliary header is greater than 1.
0251 enum VisibilityType : uint16_t {
0252   SYM_V_UNSPECIFIED = 0x0000,
0253   SYM_V_INTERNAL = 0x1000,
0254   SYM_V_HIDDEN = 0x2000,
0255   SYM_V_PROTECTED = 0x3000,
0256   SYM_V_EXPORTED = 0x4000
0257 };
0258 
0259 constexpr uint16_t VISIBILITY_MASK = 0x7000;
0260 
0261 // Relocation types, defined in `/usr/include/reloc.h`.
0262 enum RelocationType : uint8_t {
0263   R_POS = 0x00, ///< Positive relocation. Provides the address of the referenced
0264                 ///< symbol.
0265   R_RL = 0x0c,  ///< Positive indirect load relocation. Modifiable instruction.
0266   R_RLA = 0x0d, ///< Positive load address relocation. Modifiable instruction.
0267 
0268   R_NEG = 0x01, ///< Negative relocation. Provides the negative of the address
0269                 ///< of the referenced symbol.
0270   R_REL = 0x02, ///< Relative to self relocation. Provides a displacement value
0271                 ///< between the address of the referenced symbol and the
0272                 ///< address being relocated.
0273 
0274   R_TOC = 0x03, ///< Relative to the TOC relocation. Provides a displacement
0275                 ///< that is the difference between the address of the
0276                 ///< referenced symbol and the TOC anchor csect.
0277   R_TRL = 0x12, ///< TOC relative indirect load relocation. Similar to R_TOC,
0278                 ///< but not modifiable instruction.
0279 
0280   R_TRLA =
0281       0x13, ///< Relative to the TOC or to the thread-local storage base
0282             ///< relocation. Compilers are not permitted to generate this
0283             ///< relocation type. It is the result of a reversible
0284             ///< transformation by the linker of an R_TOC relation that turned a
0285             ///< load instruction into an add-immediate instruction.
0286 
0287   R_GL = 0x05, ///< Global linkage-external TOC address relocation. Provides the
0288                ///< address of the external TOC associated with a defined
0289                ///< external symbol.
0290   R_TCL = 0x06, ///< Local object TOC address relocation. Provides the address
0291                 ///< of the local TOC entry of a defined external symbol.
0292 
0293   R_REF = 0x0f, ///< A non-relocating relocation. Used to prevent the binder
0294                 ///< from garbage collecting a csect (such as code used for
0295                 ///< dynamic initialization of non-local statics) for which
0296                 ///< another csect has an implicit dependency.
0297 
0298   R_BA = 0x08, ///< Branch absolute relocation. Provides the address of the
0299                ///< referenced symbol. References a non-modifiable instruction.
0300   R_BR = 0x0a, ///< Branch relative to self relocation. Provides the
0301                ///< displacement that is the difference between the address of
0302                ///< the referenced symbol and the address of the referenced
0303                ///< branch instruction. References a non-modifiable instruction.
0304   R_RBA = 0x18, ///< Branch absolute relocation. Similar to R_BA but
0305                 ///< references a modifiable instruction.
0306   R_RBR = 0x1a, ///< Branch relative to self relocation. Similar to the R_BR
0307                 ///< relocation type, but references a modifiable instruction.
0308 
0309   R_TLS = 0x20,    ///< General-dynamic reference to TLS symbol.
0310   R_TLS_IE = 0x21, ///< Initial-exec reference to TLS symbol.
0311   R_TLS_LD = 0x22, ///< Local-dynamic reference to TLS symbol.
0312   R_TLS_LE = 0x23, ///< Local-exec reference to TLS symbol.
0313   R_TLSM = 0x24,  ///< Module reference to TLS. Provides a handle for the module
0314                   ///< containing the referenced symbol.
0315   R_TLSML = 0x25, ///< Module reference to the local TLS storage.
0316 
0317   R_TOCU = 0x30, ///< Relative to TOC upper. Specifies the high-order 16 bits of
0318                  ///< a large code model TOC-relative relocation.
0319   R_TOCL = 0x31 ///< Relative to TOC lower. Specifies the low-order 16 bits of a
0320                 ///< large code model TOC-relative relocation.
0321 };
0322 
0323 enum CFileStringType : uint8_t {
0324   XFT_FN = 0,  ///< Specifies the source-file name.
0325   XFT_CT = 1,  ///< Specifies the compiler time stamp.
0326   XFT_CV = 2,  ///< Specifies the compiler version number.
0327   XFT_CD = 128 ///< Specifies compiler-defined information.
0328 };
0329 
0330 enum CFileLangId : uint8_t {
0331   TB_C = 0,        ///< C language.
0332   TB_Fortran = 1,  ///< Fortran language.
0333   TB_CPLUSPLUS = 9 ///< C++ language.
0334 };
0335 
0336 // XCOFF specific CPU IDs, defined in AIX OS header: `/usr/include/aouthdr.h`.
0337 enum CFileCpuId : uint8_t {
0338   TCPU_INVALID = 0, ///< Invalid id - assumes POWER for old objects.
0339   TCPU_PPC = 1,     ///< PowerPC common architecture 32 bit mode.
0340   TCPU_PPC64 = 2,   ///< PowerPC common architecture 64-bit mode.
0341   TCPU_COM = 3,     ///< POWER and PowerPC architecture common.
0342   TCPU_PWR = 4,     ///< POWER common architecture objects.
0343   TCPU_ANY = 5,     ///< Mixture of any incompatable POWER
0344                     ///< and PowerPC architecture implementations.
0345   TCPU_601 = 6,     ///< 601 implementation of PowerPC architecture.
0346   TCPU_603 = 7,     ///< 603 implementation of PowerPC architecture.
0347   TCPU_604 = 8,     ///< 604 implementation of PowerPC architecture.
0348 
0349   // The following are PowerPC 64-bit architectures.
0350   TCPU_620 = 16,
0351   TCPU_A35 = 17,
0352   TCPU_PWR5 = 18,
0353   TCPU_970 = 19,
0354   TCPU_PWR6 = 20,
0355   TCPU_PWR5X = 22,
0356   TCPU_PWR6E = 23,
0357   TCPU_PWR7 = 24,
0358   TCPU_PWR8 = 25,
0359   TCPU_PWR9 = 26,
0360   TCPU_PWR10 = 27,
0361 
0362   TCPU_PWRX = 224 ///< RS2 implementation of POWER architecture.
0363 };
0364 
0365 enum SymbolAuxType : uint8_t {
0366   AUX_EXCEPT = 255, ///< Identifies an exception auxiliary entry.
0367   AUX_FCN = 254,    ///< Identifies a function auxiliary entry.
0368   AUX_SYM = 253,    ///< Identifies a symbol auxiliary entry.
0369   AUX_FILE = 252,   ///< Identifies a file auxiliary entry.
0370   AUX_CSECT = 251,  ///< Identifies a csect auxiliary entry.
0371   AUX_SECT = 250    ///< Identifies a SECT auxiliary entry.
0372 };                  // 64-bit XCOFF file only.
0373 
0374 StringRef getMappingClassString(XCOFF::StorageMappingClass SMC);
0375 StringRef getRelocationTypeString(XCOFF::RelocationType Type);
0376 StringRef getTCPUString(XCOFF::CFileCpuId TCPU);
0377 Expected<SmallString<32>> parseParmsType(uint32_t Value, unsigned FixedParmsNum,
0378                                          unsigned FloatingParmsNum);
0379 Expected<SmallString<32>> parseParmsTypeWithVecInfo(uint32_t Value,
0380                                                     unsigned FixedParmsNum,
0381                                                     unsigned FloatingParmsNum,
0382                                                     unsigned VectorParmsNum);
0383 Expected<SmallString<32>> parseVectorParmsType(uint32_t Value,
0384                                                unsigned ParmsNum);
0385 
0386 struct TracebackTable {
0387   enum LanguageID : uint8_t {
0388     C,
0389     Fortran,
0390     Pascal,
0391     Ada,
0392     PL1,
0393     Basic,
0394     Lisp,
0395     Cobol,
0396     Modula2,
0397     CPlusPlus,
0398     Rpg,
0399     PL8,
0400     PLIX = PL8,
0401     Assembly,
0402     Java,
0403     ObjectiveC
0404   };
0405   // Byte 1
0406   static constexpr uint32_t VersionMask = 0xFF00'0000;
0407   static constexpr uint8_t VersionShift = 24;
0408 
0409   // Byte 2
0410   static constexpr uint32_t LanguageIdMask = 0x00FF'0000;
0411   static constexpr uint8_t LanguageIdShift = 16;
0412 
0413   // Byte 3
0414   static constexpr uint32_t IsGlobaLinkageMask = 0x0000'8000;
0415   static constexpr uint32_t IsOutOfLineEpilogOrPrologueMask = 0x0000'4000;
0416   static constexpr uint32_t HasTraceBackTableOffsetMask = 0x0000'2000;
0417   static constexpr uint32_t IsInternalProcedureMask = 0x0000'1000;
0418   static constexpr uint32_t HasControlledStorageMask = 0x0000'0800;
0419   static constexpr uint32_t IsTOClessMask = 0x0000'0400;
0420   static constexpr uint32_t IsFloatingPointPresentMask = 0x0000'0200;
0421   static constexpr uint32_t IsFloatingPointOperationLogOrAbortEnabledMask =
0422       0x0000'0100;
0423 
0424   // Byte 4
0425   static constexpr uint32_t IsInterruptHandlerMask = 0x0000'0080;
0426   static constexpr uint32_t IsFunctionNamePresentMask = 0x0000'0040;
0427   static constexpr uint32_t IsAllocaUsedMask = 0x0000'0020;
0428   static constexpr uint32_t OnConditionDirectiveMask = 0x0000'001C;
0429   static constexpr uint32_t IsCRSavedMask = 0x0000'0002;
0430   static constexpr uint32_t IsLRSavedMask = 0x0000'0001;
0431   static constexpr uint8_t OnConditionDirectiveShift = 2;
0432 
0433   // Byte 5
0434   static constexpr uint32_t IsBackChainStoredMask = 0x8000'0000;
0435   static constexpr uint32_t IsFixupMask = 0x4000'0000;
0436   static constexpr uint32_t FPRSavedMask = 0x3F00'0000;
0437   static constexpr uint32_t FPRSavedShift = 24;
0438 
0439   // Byte 6
0440   static constexpr uint32_t HasExtensionTableMask = 0x0080'0000;
0441   static constexpr uint32_t HasVectorInfoMask = 0x0040'0000;
0442   static constexpr uint32_t GPRSavedMask = 0x003F'0000;
0443   static constexpr uint32_t GPRSavedShift = 16;
0444 
0445   // Byte 7
0446   static constexpr uint32_t NumberOfFixedParmsMask = 0x0000'FF00;
0447   static constexpr uint8_t NumberOfFixedParmsShift = 8;
0448 
0449   // Byte 8
0450   static constexpr uint32_t NumberOfFloatingPointParmsMask = 0x0000'00FE;
0451   static constexpr uint32_t HasParmsOnStackMask = 0x0000'0001;
0452   static constexpr uint8_t NumberOfFloatingPointParmsShift = 1;
0453 
0454   // Masks to select leftmost bits for decoding parameter type information.
0455   // Bit to use when vector info is not presented.
0456   static constexpr uint32_t ParmTypeIsFloatingBit = 0x8000'0000;
0457   static constexpr uint32_t ParmTypeFloatingIsDoubleBit = 0x4000'0000;
0458   // Bits to use when vector info is presented.
0459   static constexpr uint32_t ParmTypeIsFixedBits = 0x0000'0000;
0460   static constexpr uint32_t ParmTypeIsVectorBits = 0x4000'0000;
0461   static constexpr uint32_t ParmTypeIsFloatingBits = 0x8000'0000;
0462   static constexpr uint32_t ParmTypeIsDoubleBits = 0xC000'0000;
0463   static constexpr uint32_t ParmTypeMask = 0xC000'0000;
0464 
0465   // Vector extension
0466   static constexpr uint16_t NumberOfVRSavedMask = 0xFC00;
0467   static constexpr uint16_t IsVRSavedOnStackMask = 0x0200;
0468   static constexpr uint16_t HasVarArgsMask = 0x0100;
0469   static constexpr uint8_t NumberOfVRSavedShift = 10;
0470 
0471   static constexpr uint16_t NumberOfVectorParmsMask = 0x00FE;
0472   static constexpr uint16_t HasVMXInstructionMask = 0x0001;
0473   static constexpr uint8_t NumberOfVectorParmsShift = 1;
0474 
0475   static constexpr uint32_t ParmTypeIsVectorCharBit = 0x0000'0000;
0476   static constexpr uint32_t ParmTypeIsVectorShortBit = 0x4000'0000;
0477   static constexpr uint32_t ParmTypeIsVectorIntBit = 0x8000'0000;
0478   static constexpr uint32_t ParmTypeIsVectorFloatBit = 0xC000'0000;
0479 
0480   static constexpr uint8_t WidthOfParamType = 2;
0481 };
0482 
0483 // Extended Traceback table flags.
0484 enum ExtendedTBTableFlag : uint8_t {
0485   TB_OS1 = 0x80,         ///< Reserved for OS use.
0486   TB_RESERVED = 0x40,    ///< Reserved for compiler.
0487   TB_SSP_CANARY = 0x20,  ///< stack smasher canary present on stack.
0488   TB_OS2 = 0x10,         ///< Reserved for OS use.
0489   TB_EH_INFO = 0x08,     ///< Exception handling info present.
0490   TB_LONGTBTABLE2 = 0x01 ///< Additional tbtable extension exists.
0491 };
0492 
0493 StringRef getNameForTracebackTableLanguageId(TracebackTable::LanguageID LangId);
0494 SmallString<32> getExtendedTBTableFlagString(uint8_t Flag);
0495 XCOFF::CFileCpuId getCpuID(StringRef CPU);
0496 
0497 struct CsectProperties {
0498   CsectProperties(StorageMappingClass SMC, SymbolType ST)
0499       : MappingClass(SMC), Type(ST) {}
0500   StorageMappingClass MappingClass;
0501   SymbolType Type;
0502 };
0503 
0504 } // end namespace XCOFF
0505 } // end namespace llvm
0506 
0507 #endif