LLVM  14.0.0git
LanaiCondCode.h
Go to the documentation of this file.
1 // The encoding used for conditional codes used in BR instructions
2 
3 #ifndef LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
4 #define LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
5 
7 
8 namespace llvm {
9 namespace LPCC {
10 enum CondCode {
11  ICC_T = 0, // true
12  ICC_F = 1, // false
13  ICC_HI = 2, // high
14  ICC_UGT = 2, // unsigned greater than
15  ICC_LS = 3, // low or same
16  ICC_ULE = 3, // unsigned less than or equal
17  ICC_CC = 4, // carry cleared
18  ICC_ULT = 4, // unsigned less than
19  ICC_CS = 5, // carry set
20  ICC_UGE = 5, // unsigned greater than or equal
21  ICC_NE = 6, // not equal
22  ICC_EQ = 7, // equal
23  ICC_VC = 8, // oVerflow cleared
24  ICC_VS = 9, // oVerflow set
25  ICC_PL = 10, // plus
26  ICC_MI = 11, // minus
27  ICC_GE = 12, // greater than or equal
28  ICC_LT = 13, // less than
29  ICC_GT = 14, // greater than
30  ICC_LE = 15, // less than or equal
32 };
33 
35  switch (CC) {
36  case LPCC::ICC_T:
37  return "t"; // true
38  case LPCC::ICC_F:
39  return "f"; // false
40  case LPCC::ICC_NE:
41  return "ne"; // not equal
42  case LPCC::ICC_EQ:
43  return "eq"; // equal
44  case LPCC::ICC_VC:
45  return "vc"; // oVerflow cleared
46  case LPCC::ICC_VS:
47  return "vs"; // oVerflow set
48  case LPCC::ICC_PL:
49  return "pl"; // plus
50  case LPCC::ICC_MI:
51  return "mi"; // minus
52  case LPCC::ICC_GE:
53  return "ge"; // greater than or equal
54  case LPCC::ICC_LT:
55  return "lt"; // less than
56  case LPCC::ICC_GT:
57  return "gt"; // greater than
58  case LPCC::ICC_LE:
59  return "le"; // less than or equal
60  case LPCC::ICC_UGT:
61  return "ugt"; // high | unsigned greater than
62  case LPCC::ICC_ULE:
63  return "ule"; // low or same | unsigned less or equal
64  case LPCC::ICC_ULT:
65  return "ult"; // carry cleared | unsigned less than
66  case LPCC::ICC_UGE:
67  return "uge"; // carry set | unsigned than or equal
68  default:
69  llvm_unreachable("Invalid cond code");
70  }
71 }
72 
75  .EndsWith("f", LPCC::ICC_F)
76  .EndsWith("hi", LPCC::ICC_HI)
77  .EndsWith("ugt", LPCC::ICC_UGT)
78  .EndsWith("ls", LPCC::ICC_LS)
79  .EndsWith("ule", LPCC::ICC_ULE)
80  .EndsWith("cc", LPCC::ICC_CC)
81  .EndsWith("ult", LPCC::ICC_ULT)
82  .EndsWith("cs", LPCC::ICC_CS)
83  .EndsWith("uge", LPCC::ICC_UGE)
84  .EndsWith("ne", LPCC::ICC_NE)
85  .EndsWith("eq", LPCC::ICC_EQ)
86  .EndsWith("vc", LPCC::ICC_VC)
87  .EndsWith("vs", LPCC::ICC_VS)
88  .EndsWith("pl", LPCC::ICC_PL)
89  .EndsWith("mi", LPCC::ICC_MI)
90  .EndsWith("ge", LPCC::ICC_GE)
91  .EndsWith("lt", LPCC::ICC_LT)
92  .EndsWith("gt", LPCC::ICC_GT)
93  .EndsWith("le", LPCC::ICC_LE)
94  .EndsWith("t", LPCC::ICC_T) // Has to be after others with suffix t
96 }
97 } // namespace LPCC
98 } // namespace llvm
99 
100 #endif // LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
llvm::LPCC::ICC_UGT
@ ICC_UGT
Definition: LanaiCondCode.h:14
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::StringSwitch::Default
LLVM_NODISCARD R Default(T Value)
Definition: StringSwitch.h:181
llvm::LPCC::ICC_LE
@ ICC_LE
Definition: LanaiCondCode.h:30
llvm::StringSwitch::EndsWith
StringSwitch & EndsWith(StringLiteral S, T Value)
Definition: StringSwitch.h:74
llvm::LPCC::ICC_UGE
@ ICC_UGE
Definition: LanaiCondCode.h:20
llvm::LPCC::lanaiCondCodeToString
static StringRef lanaiCondCodeToString(LPCC::CondCode CC)
Definition: LanaiCondCode.h:34
llvm::LPCC::ICC_EQ
@ ICC_EQ
Definition: LanaiCondCode.h:22
llvm::LPCC::ICC_CC
@ ICC_CC
Definition: LanaiCondCode.h:17
llvm::LPCC::CondCode
CondCode
Definition: LanaiCondCode.h:10
llvm::LPCC::ICC_GE
@ ICC_GE
Definition: LanaiCondCode.h:27
llvm::LPCC::ICC_LS
@ ICC_LS
Definition: LanaiCondCode.h:15
llvm::LPCC::ICC_HI
@ ICC_HI
Definition: LanaiCondCode.h:13
llvm::LPCC::ICC_LT
@ ICC_LT
Definition: LanaiCondCode.h:28
llvm::LPCC::ICC_GT
@ ICC_GT
Definition: LanaiCondCode.h:29
llvm::LPCC::suffixToLanaiCondCode
static CondCode suffixToLanaiCondCode(StringRef S)
Definition: LanaiCondCode.h:73
llvm::LPCC::ICC_ULT
@ ICC_ULT
Definition: LanaiCondCode.h:18
llvm::LPCC::ICC_MI
@ ICC_MI
Definition: LanaiCondCode.h:26
llvm::LPCC::ICC_PL
@ ICC_PL
Definition: LanaiCondCode.h:25
llvm::LPCC::ICC_F
@ ICC_F
Definition: LanaiCondCode.h:12
llvm::LPCC::ICC_VS
@ ICC_VS
Definition: LanaiCondCode.h:24
llvm::LPCC::ICC_NE
@ ICC_NE
Definition: LanaiCondCode.h:21
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::LPCC::ICC_ULE
@ ICC_ULE
Definition: LanaiCondCode.h:16
llvm::LPCC::UNKNOWN
@ UNKNOWN
Definition: LanaiCondCode.h:31
StringSwitch.h
llvm::LPCC::ICC_CS
@ ICC_CS
Definition: LanaiCondCode.h:19
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:42
llvm::LPCC::ICC_T
@ ICC_T
Definition: LanaiCondCode.h:11
llvm::LPCC::ICC_VC
@ ICC_VC
Definition: LanaiCondCode.h:23