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