LLVM  14.0.0git
PPCPredicates.cpp
Go to the documentation of this file.
1 //===-- PPCPredicates.cpp - PPC Branch Predicate Information --------------===//
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 the PowerPC branch predicates.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "PPCPredicates.h"
15 #include <cassert>
16 using namespace llvm;
17 
19  switch (Opcode) {
20  case PPC::PRED_EQ: return PPC::PRED_NE;
21  case PPC::PRED_NE: return PPC::PRED_EQ;
22  case PPC::PRED_LT: return PPC::PRED_GE;
23  case PPC::PRED_GE: return PPC::PRED_LT;
24  case PPC::PRED_GT: return PPC::PRED_LE;
25  case PPC::PRED_LE: return PPC::PRED_GT;
26  case PPC::PRED_NU: return PPC::PRED_UN;
27  case PPC::PRED_UN: return PPC::PRED_NU;
44 
45  // Simple predicates for single condition-register bits.
48  }
49  llvm_unreachable("Unknown PPC branch opcode!");
50 }
51 
53  switch (Opcode) {
54  case PPC::PRED_EQ: return PPC::PRED_EQ;
55  case PPC::PRED_NE: return PPC::PRED_NE;
56  case PPC::PRED_LT: return PPC::PRED_GT;
57  case PPC::PRED_GE: return PPC::PRED_LE;
58  case PPC::PRED_GT: return PPC::PRED_LT;
59  case PPC::PRED_LE: return PPC::PRED_GE;
60  case PPC::PRED_NU: return PPC::PRED_NU;
61  case PPC::PRED_UN: return PPC::PRED_UN;
78 
79  case PPC::PRED_BIT_SET:
81  llvm_unreachable("Invalid use of bit predicate code");
82  }
83  llvm_unreachable("Unknown PPC branch opcode!");
84 }
85 
llvm::PPC::PRED_GT_PLUS
@ PRED_GT_PLUS
Definition: PPCPredicates.h:47
llvm::PPC::PRED_UN_PLUS
@ PRED_UN_PLUS
Definition: PPCPredicates.h:49
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::PPC::PRED_LT
@ PRED_LT
Definition: PPCPredicates.h:27
llvm::PPC::PRED_GE
@ PRED_GE
Definition: PPCPredicates.h:30
ErrorHandling.h
llvm::PPC::PRED_LE_MINUS
@ PRED_LE_MINUS
Definition: PPCPredicates.h:36
llvm::PPC::getSwappedPredicate
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...
llvm::PPC::InvertPredicate
Predicate InvertPredicate(Predicate Opcode)
Invert the specified predicate. != -> ==, < -> >=.
llvm::PPC::PRED_NE_PLUS
@ PRED_NE_PLUS
Definition: PPCPredicates.h:48
llvm::PPC::PRED_GT
@ PRED_GT
Definition: PPCPredicates.h:31
llvm::PPC::PRED_UN_MINUS
@ PRED_UN_MINUS
Definition: PPCPredicates.h:41
llvm::PPC::PRED_NU_MINUS
@ PRED_NU_MINUS
Definition: PPCPredicates.h:42
llvm::PPC::PRED_BIT_SET
@ PRED_BIT_SET
Definition: PPCPredicates.h:57
llvm::PPC::PRED_LE_PLUS
@ PRED_LE_PLUS
Definition: PPCPredicates.h:44
llvm::PPC::PRED_GT_MINUS
@ PRED_GT_MINUS
Definition: PPCPredicates.h:39
llvm::PPC::PRED_BIT_UNSET
@ PRED_BIT_UNSET
Definition: PPCPredicates.h:58
llvm::PPC::PRED_LE
@ PRED_LE
Definition: PPCPredicates.h:28
llvm::PPC::PRED_NU_PLUS
@ PRED_NU_PLUS
Definition: PPCPredicates.h:50
llvm::PPC::PRED_EQ
@ PRED_EQ
Definition: PPCPredicates.h:29
llvm::PPC::Predicate
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
Definition: PPCPredicates.h:26
llvm::PPC::PRED_GE_MINUS
@ PRED_GE_MINUS
Definition: PPCPredicates.h:38
llvm::PPC::PRED_NE_MINUS
@ PRED_NE_MINUS
Definition: PPCPredicates.h:40
llvm::PPC::PRED_GE_PLUS
@ PRED_GE_PLUS
Definition: PPCPredicates.h:46
llvm::PPC::PRED_NE
@ PRED_NE
Definition: PPCPredicates.h:32
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::PPC::PRED_NU
@ PRED_NU
Definition: PPCPredicates.h:34
llvm::PPC::PRED_EQ_PLUS
@ PRED_EQ_PLUS
Definition: PPCPredicates.h:45
llvm::PPC::PRED_LT_PLUS
@ PRED_LT_PLUS
Definition: PPCPredicates.h:43
llvm::PPC::PRED_EQ_MINUS
@ PRED_EQ_MINUS
Definition: PPCPredicates.h:37
llvm::PPC::PRED_UN
@ PRED_UN
Definition: PPCPredicates.h:33
llvm::PPC::PRED_LT_MINUS
@ PRED_LT_MINUS
Definition: PPCPredicates.h:35
PPCPredicates.h