LLVM API Documentation

SystemZ.h
Go to the documentation of this file.
00001 //==- SystemZ.h - Top-Level Interface for SystemZ representation -*- 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 the entry points for global functions defined in
00011 // the LLVM SystemZ backend.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZ_H
00016 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZ_H
00017 
00018 #include "MCTargetDesc/SystemZMCTargetDesc.h"
00019 #include "llvm/Support/CodeGen.h"
00020 
00021 namespace llvm {
00022 class SystemZTargetMachine;
00023 class FunctionPass;
00024 
00025 namespace SystemZ {
00026 // Condition-code mask values.
00027 const unsigned CCMASK_0 = 1 << 3;
00028 const unsigned CCMASK_1 = 1 << 2;
00029 const unsigned CCMASK_2 = 1 << 1;
00030 const unsigned CCMASK_3 = 1 << 0;
00031 const unsigned CCMASK_ANY = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;
00032 
00033 // Condition-code mask assignments for integer and floating-point
00034 // comparisons.
00035 const unsigned CCMASK_CMP_EQ = CCMASK_0;
00036 const unsigned CCMASK_CMP_LT = CCMASK_1;
00037 const unsigned CCMASK_CMP_GT = CCMASK_2;
00038 const unsigned CCMASK_CMP_NE = CCMASK_CMP_LT | CCMASK_CMP_GT;
00039 const unsigned CCMASK_CMP_LE = CCMASK_CMP_EQ | CCMASK_CMP_LT;
00040 const unsigned CCMASK_CMP_GE = CCMASK_CMP_EQ | CCMASK_CMP_GT;
00041 
00042 // Condition-code mask assignments for floating-point comparisons only.
00043 const unsigned CCMASK_CMP_UO = CCMASK_3;
00044 const unsigned CCMASK_CMP_O  = CCMASK_ANY ^ CCMASK_CMP_UO;
00045 
00046 // All condition-code values produced by comparisons.
00047 const unsigned CCMASK_ICMP = CCMASK_0 | CCMASK_1 | CCMASK_2;
00048 const unsigned CCMASK_FCMP = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;
00049 
00050 // Condition-code mask assignments for CS.
00051 const unsigned CCMASK_CS_EQ = CCMASK_0;
00052 const unsigned CCMASK_CS_NE = CCMASK_1;
00053 const unsigned CCMASK_CS    = CCMASK_0 | CCMASK_1;
00054 
00055 // Condition-code mask assignments for a completed SRST loop.
00056 const unsigned CCMASK_SRST_FOUND    = CCMASK_1;
00057 const unsigned CCMASK_SRST_NOTFOUND = CCMASK_2;
00058 const unsigned CCMASK_SRST          = CCMASK_1 | CCMASK_2;
00059 
00060 // Condition-code mask assignments for TEST UNDER MASK.
00061 const unsigned CCMASK_TM_ALL_0       = CCMASK_0;
00062 const unsigned CCMASK_TM_MIXED_MSB_0 = CCMASK_1;
00063 const unsigned CCMASK_TM_MIXED_MSB_1 = CCMASK_2;
00064 const unsigned CCMASK_TM_ALL_1       = CCMASK_3;
00065 const unsigned CCMASK_TM_SOME_0      = CCMASK_TM_ALL_1 ^ CCMASK_ANY;
00066 const unsigned CCMASK_TM_SOME_1      = CCMASK_TM_ALL_0 ^ CCMASK_ANY;
00067 const unsigned CCMASK_TM_MSB_0       = CCMASK_0 | CCMASK_1;
00068 const unsigned CCMASK_TM_MSB_1       = CCMASK_2 | CCMASK_3;
00069 const unsigned CCMASK_TM             = CCMASK_ANY;
00070 
00071 // The position of the low CC bit in an IPM result.
00072 const unsigned IPM_CC = 28;
00073 
00074 // Mask assignments for PFD.
00075 const unsigned PFD_READ  = 1;
00076 const unsigned PFD_WRITE = 2;
00077 
00078 // Return true if Val fits an LLILL operand.
00079 static inline bool isImmLL(uint64_t Val) {
00080   return (Val & ~0x000000000000ffffULL) == 0;
00081 }
00082 
00083 // Return true if Val fits an LLILH operand.
00084 static inline bool isImmLH(uint64_t Val) {
00085   return (Val & ~0x00000000ffff0000ULL) == 0;
00086 }
00087 
00088 // Return true if Val fits an LLIHL operand.
00089 static inline bool isImmHL(uint64_t Val) {
00090   return (Val & ~0x00000ffff00000000ULL) == 0;
00091 }
00092 
00093 // Return true if Val fits an LLIHH operand.
00094 static inline bool isImmHH(uint64_t Val) {
00095   return (Val & ~0xffff000000000000ULL) == 0;
00096 }
00097 
00098 // Return true if Val fits an LLILF operand.
00099 static inline bool isImmLF(uint64_t Val) {
00100   return (Val & ~0x00000000ffffffffULL) == 0;
00101 }
00102 
00103 // Return true if Val fits an LLIHF operand.
00104 static inline bool isImmHF(uint64_t Val) {
00105   return (Val & ~0xffffffff00000000ULL) == 0;
00106 }
00107 } // end namespace SystemZ
00108 
00109 FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM,
00110                                    CodeGenOpt::Level OptLevel);
00111 FunctionPass *createSystemZElimComparePass(SystemZTargetMachine &TM);
00112 FunctionPass *createSystemZShortenInstPass(SystemZTargetMachine &TM);
00113 FunctionPass *createSystemZLongBranchPass(SystemZTargetMachine &TM);
00114 } // end namespace llvm
00115 
00116 #endif