LLVM  7.0.0svn
RISCVBaseInfo.h
Go to the documentation of this file.
1 //===-- RISCVBaseInfo.h - Top level definitions for RISCV MC ----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains small standalone enum definitions for the RISCV target
11 // useful for the compiler back-end and the MC libraries.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVBASEINFO_H
15 #define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVBASEINFO_H
16 
17 #include "RISCVMCTargetDesc.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ADT/StringSwitch.h"
20 
21 namespace llvm {
22 
23 // RISCVII - This namespace holds all of the target specific flags that
24 // instruction info tracks. All definitions must match RISCVInstrFormats.td.
25 namespace RISCVII {
26 enum {
44 
46 };
47 
48 enum {
53 };
54 } // namespace RISCVII
55 
56 // Describes the predecessor/successor bits used in the FENCE instruction.
57 namespace RISCVFenceField {
58 enum FenceField {
59  I = 8,
60  O = 4,
61  R = 2,
62  W = 1
63 };
64 }
65 
66 // Describes the supported floating point rounding mode encodings.
67 namespace RISCVFPRndMode {
69  RNE = 0,
70  RTZ = 1,
71  RDN = 2,
72  RUP = 3,
73  RMM = 4,
74  DYN = 7,
75  Invalid
76 };
77 
79  switch (RndMode) {
80  default:
81  llvm_unreachable("Unknown floating point rounding mode");
83  return "rne";
85  return "rtz";
87  return "rdn";
89  return "rup";
91  return "rmm";
93  return "dyn";
94  }
95 }
96 
98  return StringSwitch<RoundingMode>(Str)
99  .Case("rne", RISCVFPRndMode::RNE)
100  .Case("rtz", RISCVFPRndMode::RTZ)
101  .Case("rdn", RISCVFPRndMode::RDN)
102  .Case("rup", RISCVFPRndMode::RUP)
103  .Case("rmm", RISCVFPRndMode::RMM)
104  .Case("dyn", RISCVFPRndMode::DYN)
106 }
107 } // namespace RISCVFPRndMode
108 } // namespace llvm
109 
110 #endif
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
static RoundingMode stringToRoundingMode(StringRef Str)
Definition: RISCVBaseInfo.h:97
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
Definition: StringSwitch.h:203
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:43
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:70
#define I(x, y, z)
Definition: MD5.cpp:58
static StringRef roundingModeToString(RoundingMode RndMode)
Definition: RISCVBaseInfo.h:78
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49