LLVM API Documentation

HexagonBaseInfo.h
Go to the documentation of this file.
00001 //===-- HexagonBaseInfo.h - Top level definitions for Hexagon --*- C++ -*--===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains small standalone helper functions and enum definitions for
00011 // the Hexagon target useful for the compiler back-end and the MC libraries.
00012 // As such, it deliberately does not include references to LLVM core
00013 // code gen types, passes, etc..
00014 //
00015 //===----------------------------------------------------------------------===//
00016 
00017 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
00018 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
00019 
00020 #include "HexagonMCTargetDesc.h"
00021 #include "llvm/Support/ErrorHandling.h"
00022 
00023 namespace llvm {
00024 
00025 /// HexagonII - This namespace holds all of the target specific flags that
00026 /// instruction info tracks.
00027 ///
00028 namespace HexagonII {
00029   // *** The code below must match HexagonInstrFormat*.td *** //
00030 
00031   // Insn types.
00032   // *** Must match HexagonInstrFormat*.td ***
00033   enum Type {
00034     TypePSEUDO  = 0,
00035     TypeALU32   = 1,
00036     TypeCR      = 2,
00037     TypeJR      = 3,
00038     TypeJ       = 4,
00039     TypeLD      = 5,
00040     TypeST      = 6,
00041     TypeSYSTEM  = 7,
00042     TypeXTYPE   = 8,
00043     TypeMEMOP   = 9,
00044     TypeNV      = 10,
00045     TypePREFIX  = 30, // Such as extenders.
00046     TypeENDLOOP = 31  // Such as end of a HW loop.
00047   };
00048 
00049   enum SubTarget {
00050     HasV2SubT     = 0xf,
00051     HasV2SubTOnly = 0x1,
00052     NoV2SubT      = 0x0,
00053     HasV3SubT     = 0xe,
00054     HasV3SubTOnly = 0x2,
00055     NoV3SubT      = 0x1,
00056     HasV4SubT     = 0xc,
00057     NoV4SubT      = 0x3,
00058     HasV5SubT     = 0x8,
00059     NoV5SubT      = 0x7
00060   };
00061 
00062   enum AddrMode {
00063     NoAddrMode     = 0,  // No addressing mode
00064     Absolute       = 1,  // Absolute addressing mode
00065     AbsoluteSet    = 2,  // Absolute set addressing mode
00066     BaseImmOffset  = 3,  // Indirect with offset
00067     BaseLongOffset = 4,  // Indirect with long offset
00068     BaseRegOffset  = 5,  // Indirect with register offset
00069     PostInc        = 6   // Post increment addressing mode
00070   };
00071 
00072   enum MemAccessSize {
00073     NoMemAccess = 0,            // Not a memory acces instruction.
00074     ByteAccess = 1,             // Byte access instruction (memb).
00075     HalfWordAccess = 2,         // Half word access instruction (memh).
00076     WordAccess = 3,             // Word access instruction (memw).
00077     DoubleWordAccess = 4        // Double word access instruction (memd)
00078   };
00079 
00080   // MCInstrDesc TSFlags
00081   // *** Must match HexagonInstrFormat*.td ***
00082   enum {
00083     // This 5-bit field describes the insn type.
00084     TypePos  = 0,
00085     TypeMask = 0x1f,
00086 
00087     // Solo instructions.
00088     SoloPos  = 5,
00089     SoloMask = 0x1,
00090     // Packed only with A or X-type instructions.
00091     SoloAXPos  = 6,
00092     SoloAXMask = 0x1,
00093     // Only A-type instruction in first slot or nothing.
00094     SoloAin1Pos  = 7,
00095     SoloAin1Mask = 0x1,
00096 
00097     // Predicated instructions.
00098     PredicatedPos  = 8,
00099     PredicatedMask = 0x1,
00100     PredicatedFalsePos  = 9,
00101     PredicatedFalseMask = 0x1,
00102     PredicatedNewPos  = 10,
00103     PredicatedNewMask = 0x1,
00104     PredicateLatePos  = 11,
00105     PredicateLateMask = 0x1,
00106 
00107     // New-Value consumer instructions.
00108     NewValuePos  = 12,
00109     NewValueMask = 0x1,
00110     // New-Value producer instructions.
00111     hasNewValuePos  = 13,
00112     hasNewValueMask = 0x1,
00113     // Which operand consumes or produces a new value.
00114     NewValueOpPos  = 14,
00115     NewValueOpMask = 0x7,
00116     // Stores that can become new-value stores.
00117     mayNVStorePos  = 17,
00118     mayNVStoreMask = 0x1,
00119     // New-value store instructions.
00120     NVStorePos  = 18,
00121     NVStoreMask = 0x1,
00122     // Loads that can become current-value loads.
00123     mayCVLoadPos  = 19,
00124     mayCVLoadMask = 0x1,
00125     // Current-value load instructions.
00126     CVLoadPos  = 20,
00127     CVLoadMask = 0x1,
00128 
00129     // Extendable insns.
00130     ExtendablePos  = 21,
00131     ExtendableMask = 0x1,
00132     // Insns must be extended.
00133     ExtendedPos  = 22,
00134     ExtendedMask = 0x1,
00135     // Which operand may be extended.
00136     ExtendableOpPos  = 23,
00137     ExtendableOpMask = 0x7,
00138     // Signed or unsigned range.
00139     ExtentSignedPos  = 26,
00140     ExtentSignedMask = 0x1,
00141     // Number of bits of range before extending operand.
00142     ExtentBitsPos  = 27,
00143     ExtentBitsMask = 0x1f,
00144     // Alignment power-of-two before extending operand.
00145     ExtentAlignPos  = 32,
00146     ExtentAlignMask = 0x3,
00147 
00148     // Valid subtargets
00149     validSubTargetPos  = 34,
00150     validSubTargetMask = 0xf,
00151 
00152     // Addressing mode for load/store instructions.
00153     AddrModePos  = 40,
00154     AddrModeMask = 0x7,
00155     // Access size for load/store instructions.
00156     MemAccessSizePos = 43,
00157     MemAccesSizeMask = 0x7,
00158 
00159     // Branch predicted taken.
00160     TakenPos = 47,
00161     TakenMask = 0x1,
00162 
00163     // Floating-point instructions.
00164     FPPos  = 48,
00165     FPMask = 0x1
00166   };
00167 
00168   // *** The code above must match HexagonInstrFormat*.td *** //
00169 
00170   // Hexagon specific MO operand flag mask.
00171   enum HexagonMOTargetFlagVal {
00172     //===------------------------------------------------------------------===//
00173     // Hexagon Specific MachineOperand flags.
00174     MO_NO_FLAG,
00175 
00176     HMOTF_ConstExtended = 1,
00177 
00178     /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
00179     /// Used for computing a global address for PIC compilations
00180     MO_PCREL,
00181 
00182     /// MO_GOT - Indicates a GOT-relative relocation
00183     MO_GOT,
00184 
00185     // Low or high part of a symbol.
00186     MO_LO16, MO_HI16,
00187 
00188     // Offset from the base of the SDA.
00189     MO_GPREL
00190   };
00191 
00192 } // End namespace HexagonII.
00193 
00194 } // End namespace llvm.
00195 
00196 #endif