LLVM 20.0.0git
LoongArchBaseInfo.h
Go to the documentation of this file.
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
18#include "llvm/ADT/StringRef.h"
20#include "llvm/MC/MCInstrDesc.h"
22
23namespace llvm {
24
25// This namespace holds all of the target specific flags that instruction info
26// tracks.
27namespace LoongArchII {
28enum {
57 // TODO: Add more flags.
58};
59
60// Target-specific flags of LAInst.
61// All definitions must match LoongArchInstrFormats.td.
62enum {
63 // Whether the instruction's rd is normally required to differ from rj and
64 // rk, in the way the 3-register atomic memory operations behave
65 // (Section 2.2.7.1 and 2.2.7.2, LoongArch Reference Manual Volume 1 v1.10;
66 // while Section 2.2.7.3 lacked similar description for the AMCAS
67 // instructions, at least the INE exception is still signaled on Loongson
68 // 3A6000 when its rd == rj).
69 //
70 // Used for generating diagnostics for assembler input that violate the
71 // constraint. As described on the manual, the covered instructions require
72 // rd != rj && rd != rk to work as intended.
75
76 // Whether the instruction belongs to the AMCAS family.
79};
80
81/// \returns true if this instruction's rd is normally required to differ
82/// from rj and rk, in the way 3-register atomic memory operations behave.
83static inline bool isSubjectToAMORdConstraint(uint64_t TSFlags) {
84 return TSFlags & IsSubjectToAMORdConstraintMask;
85}
86
87/// \returns true if this instruction belongs to the AMCAS family.
88static inline bool isAMCAS(uint64_t TSFlags) { return TSFlags & IsAMCASMask; }
89} // end namespace LoongArchII
90
91namespace LoongArchABI {
92enum ABI {
101
102ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits,
103 StringRef ABIName);
104ABI getTargetABI(StringRef ABIName);
105
106// Returns the register used to hold the stack pointer after realignment.
108} // end namespace LoongArchABI
109
110} // end namespace llvm
111
112#endif // LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHBASEINFO_H
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Container class for subtarget features.
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits, StringRef ABIName)
ABI getTargetABI(StringRef ABIName)
static bool isAMCAS(uint64_t TSFlags)
static bool isSubjectToAMORdConstraint(uint64_t TSFlags)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18