Chris Lattner | 8c6a41e | 2006-11-17 22:10:59 +0000 | [diff] [blame] | 1 | //===-- PPCPredicates.h - PPC Branch Predicate Information ------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Chris Lattner | 8c6a41e | 2006-11-17 22:10:59 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file describes the PowerPC branch predicates. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H |
| 15 | #define LLVM_TARGET_POWERPC_PPCPREDICATES_H |
| 16 | |
Rafael Espindola | fb8ac2d | 2012-12-20 05:13:09 +0000 | [diff] [blame] | 17 | // GCC #defines PPC on Linux but we use it as our namespace name |
| 18 | #undef PPC |
| 19 | |
Sylvestre Ledru | 37ef20d | 2013-03-17 12:40:42 +0000 | [diff] [blame] | 20 | // Generated files will use "namespace PPC". To avoid symbol clash, |
| 21 | // undefine PPC here. PPC may be predefined on some hosts. |
| 22 | #undef PPC |
| 23 | |
Chris Lattner | 8c6a41e | 2006-11-17 22:10:59 +0000 | [diff] [blame] | 24 | namespace llvm { |
| 25 | namespace PPC { |
| 26 | /// Predicate - These are "(BI << 5) | BO" for various predicates. |
| 27 | enum Predicate { |
Chris Lattner | 8c6a41e | 2006-11-17 22:10:59 +0000 | [diff] [blame] | 28 | PRED_LT = (0 << 5) | 12, |
| 29 | PRED_LE = (1 << 5) | 4, |
| 30 | PRED_EQ = (2 << 5) | 12, |
| 31 | PRED_GE = (0 << 5) | 4, |
| 32 | PRED_GT = (1 << 5) | 12, |
| 33 | PRED_NE = (2 << 5) | 4, |
| 34 | PRED_UN = (3 << 5) | 12, |
| 35 | PRED_NU = (3 << 5) | 4 |
| 36 | }; |
| 37 | |
| 38 | /// Invert the specified predicate. != -> ==, < -> >=. |
| 39 | Predicate InvertPredicate(Predicate Opcode); |
Hal Finkel | 0f64e21 | 2013-04-20 05:16:26 +0000 | [diff] [blame^] | 40 | |
| 41 | /// Assume the condition register is set by MI(a,b), return the predicate if |
| 42 | /// we modify the instructions such that condition register is set by MI(b,a). |
| 43 | Predicate getSwappedPredicate(Predicate Opcode); |
Chris Lattner | 8c6a41e | 2006-11-17 22:10:59 +0000 | [diff] [blame] | 44 | } |
| 45 | } |
| 46 | |
| 47 | #endif |