1 //=- LoongArchBaseInfo.h - Top level definitions for LoongArch MC -*- 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 enum definitions and helper function
10 // definitions for the LoongArch target useful for the compiler back-end and the
11 // MC libraries.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHBASEINFO_H
15 #define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHBASEINFO_H
16 
17 #include "MCTargetDesc/LoongArchMCTargetDesc.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ADT/StringSwitch.h"
20 #include "llvm/MC/MCInstrDesc.h"
21 #include "llvm/MC/SubtargetFeature.h"
22 
23 namespace llvm {
24 
25 // This namespace holds all of the target specific flags that instruction info
26 // tracks.
27 namespace LoongArchII {
28 enum {
29   MO_None,
30   MO_CALL,
31   MO_CALL_PLT,
32   MO_PCREL_HI,
33   MO_PCREL_LO,
34   MO_GOT_PC_HI,
35   MO_GOT_PC_LO,
36   MO_LE_HI,
37   MO_LE_LO,
38   MO_IE_PC_HI,
39   MO_IE_PC_LO,
40   MO_LD_PC_HI,
41   MO_GD_PC_HI,
42   // TODO: Add more flags.
43 };
44 } // end namespace LoongArchII
45 
46 namespace LoongArchABI {
47 enum ABI {
48   ABI_ILP32S,
49   ABI_ILP32F,
50   ABI_ILP32D,
51   ABI_LP64S,
52   ABI_LP64F,
53   ABI_LP64D,
54   ABI_Unknown
55 };
56 
57 ABI getTargetABI(StringRef ABIName);
58 
59 // Returns the register used to hold the stack pointer after realignment.
60 MCRegister getBPReg();
61 } // end namespace LoongArchABI
62 
63 } // end namespace llvm
64 
65 #endif // LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHBASEINFO_H
66