LLVM  8.0.1
PPCPredicates.cpp
Go to the documentation of this file.
1 //===-- PPCPredicates.cpp - PPC Branch Predicate Information --------------===//
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 implements the PowerPC branch predicates.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "PPCPredicates.h"
16 #include <cassert>
17 using namespace llvm;
18 
20  switch (Opcode) {
21  case PPC::PRED_EQ: return PPC::PRED_NE;
22  case PPC::PRED_NE: return PPC::PRED_EQ;
23  case PPC::PRED_LT: return PPC::PRED_GE;
24  case PPC::PRED_GE: return PPC::PRED_LT;
25  case PPC::PRED_GT: return PPC::PRED_LE;
26  case PPC::PRED_LE: return PPC::PRED_GT;
27  case PPC::PRED_NU: return PPC::PRED_UN;
28  case PPC::PRED_UN: return PPC::PRED_NU;
45 
46  // Simple predicates for single condition-register bits.
49  }
50  llvm_unreachable("Unknown PPC branch opcode!");
51 }
52 
54  switch (Opcode) {
55  case PPC::PRED_EQ: return PPC::PRED_EQ;
56  case PPC::PRED_NE: return PPC::PRED_NE;
57  case PPC::PRED_LT: return PPC::PRED_GT;
58  case PPC::PRED_GE: return PPC::PRED_LE;
59  case PPC::PRED_GT: return PPC::PRED_LT;
60  case PPC::PRED_LE: return PPC::PRED_GE;
61  case PPC::PRED_NU: return PPC::PRED_NU;
62  case PPC::PRED_UN: return PPC::PRED_UN;
79 
80  case PPC::PRED_BIT_SET:
82  llvm_unreachable("Invalid use of bit predicate code");
83  }
84  llvm_unreachable("Unknown PPC branch opcode!");
85 }
86 
This class represents lattice values for constants.
Definition: AllocatorList.h:24
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
Definition: PPCPredicates.h:27
Predicate InvertPredicate(Predicate Opcode)
Invert the specified predicate. != -> ==, < -> >=.
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...