SystemZ.h revision 251607
1251607Sdim//==- SystemZ.h - Top-Level Interface for SystemZ representation -*- C++ -*-==//
2251607Sdim//
3251607Sdim//                     The LLVM Compiler Infrastructure
4251607Sdim//
5251607Sdim// This file is distributed under the University of Illinois Open Source
6251607Sdim// License. See LICENSE.TXT for details.
7251607Sdim//
8251607Sdim//===----------------------------------------------------------------------===//
9251607Sdim//
10251607Sdim// This file contains the entry points for global functions defined in
11251607Sdim// the LLVM SystemZ backend.
12251607Sdim//
13251607Sdim//===----------------------------------------------------------------------===//
14251607Sdim
15251607Sdim#ifndef SYSTEMZ_H
16251607Sdim#define SYSTEMZ_H
17251607Sdim
18251607Sdim#include "MCTargetDesc/SystemZMCTargetDesc.h"
19251607Sdim#include "llvm/Support/CodeGen.h"
20251607Sdim
21251607Sdimnamespace llvm {
22251607Sdim  class SystemZTargetMachine;
23251607Sdim  class FunctionPass;
24251607Sdim
25251607Sdim  namespace SystemZ {
26251607Sdim    // Condition-code mask values.
27251607Sdim    const unsigned CCMASK_0 = 1 << 3;
28251607Sdim    const unsigned CCMASK_1 = 1 << 2;
29251607Sdim    const unsigned CCMASK_2 = 1 << 1;
30251607Sdim    const unsigned CCMASK_3 = 1 << 0;
31251607Sdim    const unsigned CCMASK_ANY = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;
32251607Sdim
33251607Sdim    // Condition-code mask assignments for floating-point comparisons.
34251607Sdim    const unsigned CCMASK_CMP_EQ = CCMASK_0;
35251607Sdim    const unsigned CCMASK_CMP_LT = CCMASK_1;
36251607Sdim    const unsigned CCMASK_CMP_GT = CCMASK_2;
37251607Sdim    const unsigned CCMASK_CMP_UO = CCMASK_3;
38251607Sdim    const unsigned CCMASK_CMP_NE = CCMASK_CMP_LT | CCMASK_CMP_GT;
39251607Sdim    const unsigned CCMASK_CMP_LE = CCMASK_CMP_EQ | CCMASK_CMP_LT;
40251607Sdim    const unsigned CCMASK_CMP_GE = CCMASK_CMP_EQ | CCMASK_CMP_GT;
41251607Sdim    const unsigned CCMASK_CMP_O  = CCMASK_ANY ^ CCMASK_CMP_UO;
42251607Sdim
43251607Sdim    // Return true if Val fits an LLILL operand.
44251607Sdim    static inline bool isImmLL(uint64_t Val) {
45251607Sdim      return (Val & ~0x000000000000ffffULL) == 0;
46251607Sdim    }
47251607Sdim
48251607Sdim    // Return true if Val fits an LLILH operand.
49251607Sdim    static inline bool isImmLH(uint64_t Val) {
50251607Sdim      return (Val & ~0x00000000ffff0000ULL) == 0;
51251607Sdim    }
52251607Sdim
53251607Sdim    // Return true if Val fits an LLIHL operand.
54251607Sdim    static inline bool isImmHL(uint64_t Val) {
55251607Sdim      return (Val & ~0x00000ffff00000000ULL) == 0;
56251607Sdim    }
57251607Sdim
58251607Sdim    // Return true if Val fits an LLIHH operand.
59251607Sdim    static inline bool isImmHH(uint64_t Val) {
60251607Sdim      return (Val & ~0xffff000000000000ULL) == 0;
61251607Sdim    }
62251607Sdim
63251607Sdim    // Return true if Val fits an LLILF operand.
64251607Sdim    static inline bool isImmLF(uint64_t Val) {
65251607Sdim      return (Val & ~0x00000000ffffffffULL) == 0;
66251607Sdim    }
67251607Sdim
68251607Sdim    // Return true if Val fits an LLIHF operand.
69251607Sdim    static inline bool isImmHF(uint64_t Val) {
70251607Sdim      return (Val & ~0xffffffff00000000ULL) == 0;
71251607Sdim    }
72251607Sdim  }
73251607Sdim
74251607Sdim  FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM,
75251607Sdim                                     CodeGenOpt::Level OptLevel);
76251607Sdim} // end namespace llvm;
77251607Sdim#endif
78