LLVM  11.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 
This class represents lattice values for constants.
Definition: AllocatorList.h:23
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
Definition: PPCPredicates.h:26
Predicate InvertPredicate(Predicate Opcode)
Invert the specified predicate. != -> ==, < -> >=.