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 {
60 // TODO: Add more flags.
61};
62
63// Target-specific flags of LAInst.
64// All definitions must match LoongArchInstrFormats.td.
65enum {
66 // Whether the instruction's rd is normally required to differ from rj and
67 // rk, in the way the 3-register atomic memory operations behave
68 // (Section 2.2.7.1 and 2.2.7.2, LoongArch Reference Manual Volume 1 v1.10;
69 // while Section 2.2.7.3 lacked similar description for the AMCAS
70 // instructions, at least the INE exception is still signaled on Loongson
71 // 3A6000 when its rd == rj).
72 //
73 // Used for generating diagnostics for assembler input that violate the
74 // constraint. As described on the manual, the covered instructions require
75 // rd != rj && rd != rk to work as intended.
78
79 // Whether the instruction belongs to the AMCAS family.
82};
83
84/// \returns true if this instruction's rd is normally required to differ
85/// from rj and rk, in the way 3-register atomic memory operations behave.
86static inline bool isSubjectToAMORdConstraint(uint64_t TSFlags) {
87 return TSFlags & IsSubjectToAMORdConstraintMask;
88}
89
90/// \returns true if this instruction belongs to the AMCAS family.
91static inline bool isAMCAS(uint64_t TSFlags) { return TSFlags & IsAMCASMask; }
92} // end namespace LoongArchII
93
94namespace LoongArchABI {
95enum ABI {
104
105ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits,
106 StringRef ABIName);
107ABI getTargetABI(StringRef ABIName);
108
109// Returns the register used to hold the stack pointer after realignment.
111} // end namespace LoongArchABI
112
113} // end namespace llvm
114
115#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