xref: /freebsd/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYBaseInfo.h (revision 271171e0d97b88ba2a7c3bf750c9672b484c1c13)
1 //===-- CSKYBaseInfo.h - Top level definitions for CSKY ---*- C++ -*-------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains small standalone helper functions and enum definitions for
10 // the CSKY target useful for the compiler back-end and the MC libraries.
11 // As such, it deliberately does not include references to LLVM core
12 // code gen types, passes, etc..
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYBASEINFO_H
17 #define LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYBASEINFO_H
18 
19 #include "MCTargetDesc/CSKYMCTargetDesc.h"
20 #include "llvm/MC/MCInstrDesc.h"
21 
22 namespace llvm {
23 
24 // CSKYII - This namespace holds all of the target specific flags that
25 // instruction info tracks. All definitions must match CSKYInstrFormats.td.
26 namespace CSKYII {
27 
28 enum AddrMode {
29   AddrModeNone = 0,
30   AddrMode32B = 1,   // ld32.b, ld32.bs, st32.b, st32.bs, +4kb
31   AddrMode32H = 2,   // ld32.h, ld32.hs, st32.h, st32.hs, +8kb
32   AddrMode32WD = 3,  // ld32.w, st32.w, ld32.d, st32.d, +16kb
33   AddrMode16B = 4,   // ld16.b, +32b
34   AddrMode16H = 5,   // ld16.h, +64b
35   AddrMode16W = 6,   // ld16.w, +128b or +1kb
36   AddrMode32SDF = 7, // flds, fldd, +1kb
37 };
38 
39 // CSKY Specific MachineOperand Flags.
40 enum TOF {
41   MO_None = 0,
42   MO_ADDR32,
43   MO_GOT32,
44   MO_GOTOFF,
45   MO_PLT32,
46   MO_ADDR_HI16,
47   MO_ADDR_LO16,
48 
49   // Used to differentiate between target-specific "direct" flags and "bitmask"
50   // flags. A machine operand can only have one "direct" flag, but can have
51   // multiple "bitmask" flags.
52   MO_DIRECT_FLAG_MASK = 15
53 };
54 
55 enum {
56   AddrModeMask = 0x1f,
57 };
58 
59 } // namespace CSKYII
60 
61 namespace CSKYOp {
62 enum OperandType : unsigned {
63   OPERAND_BARESYMBOL = MCOI::OPERAND_FIRST_TARGET,
64   OPERAND_CONSTPOOL
65 };
66 } // namespace CSKYOp
67 
68 } // namespace llvm
69 
70 #endif // LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYBASEINFO_H
71