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/TargetParser/SubtargetFeature.h"
22
23namespace llvm {
24
25// This namespace holds all of the target specific flags that instruction info
26// tracks.
27namespace LoongArchII {
28enum {
29 MO_None,
30 MO_CALL,
31 MO_CALL_PLT,
32 MO_PCREL_HI,
33 MO_PCREL_LO,
34 MO_PCREL64_LO,
35 MO_PCREL64_HI,
36 MO_GOT_PC_HI,
37 MO_GOT_PC_LO,
38 MO_GOT_PC64_LO,
39 MO_GOT_PC64_HI,
40 MO_LE_HI,
41 MO_LE_LO,
42 MO_LE64_LO,
43 MO_LE64_HI,
44 MO_IE_PC_HI,
45 MO_IE_PC_LO,
46 MO_IE_PC64_LO,
47 MO_IE_PC64_HI,
48 MO_LD_PC_HI,
49 MO_GD_PC_HI,
50 MO_CALL36
51 // TODO: Add more flags.
52};
53} // end namespace LoongArchII
54
55namespace LoongArchABI {
56enum ABI {
57 ABI_ILP32S,
58 ABI_ILP32F,
59 ABI_ILP32D,
60 ABI_LP64S,
61 ABI_LP64F,
62 ABI_LP64D,
63 ABI_Unknown
64};
65
66ABI computeTargetABI(const Triple &TT, StringRef ABIName);
67ABI getTargetABI(StringRef ABIName);
68
69// Returns the register used to hold the stack pointer after realignment.
70MCRegister getBPReg();
71} // end namespace LoongArchABI
72
73} // end namespace llvm
74
75#endif // LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHBASEINFO_H
76

source code of llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.h