xref: /freebsd/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1 //= LoongArchBaseInfo.cpp - 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 implements helper functions for the LoongArch target useful for the
10 // compiler back-end and the MC libraries.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "LoongArchBaseInfo.h"
15 #include "llvm/ADT/ArrayRef.h"
16 #include "llvm/ADT/Triple.h"
17 #include "llvm/MC/MCSubtargetInfo.h"
18 
19 namespace llvm {
20 
21 namespace LoongArchABI {
22 
23 ABI getTargetABI(StringRef ABIName) {
24   auto TargetABI = StringSwitch<ABI>(ABIName)
25                        .Case("ilp32s", ABI_ILP32S)
26                        .Case("ilp32f", ABI_ILP32F)
27                        .Case("ilp32d", ABI_ILP32D)
28                        .Case("lp64s", ABI_LP64S)
29                        .Case("lp64f", ABI_LP64F)
30                        .Case("lp64d", ABI_LP64D)
31                        .Default(ABI_Unknown);
32   return TargetABI;
33 }
34 
35 // FIXME: other register?
36 MCRegister getBPReg() { return LoongArch::R31; }
37 
38 } // end namespace LoongArchABI
39 
40 } // end namespace llvm
41