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