/src/capstonenext/arch/PowerPC/PPCPredicates.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* Capstone Disassembly Engine, http://www.capstone-engine.org */ |
2 | | /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */ |
3 | | /* Rot127 <unisono@quyllur.org> 2022-2023 */ |
4 | | /* Automatically translated source file from LLVM. */ |
5 | | |
6 | | /* LLVM-commit: <commit> */ |
7 | | /* LLVM-tag: <tag> */ |
8 | | |
9 | | /* Only small edits allowed. */ |
10 | | /* For multiple similar edits, please create a Patch for the translator. */ |
11 | | |
12 | | /* Capstone's C++ file translator: */ |
13 | | /* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */ |
14 | | |
15 | | //===-- PPCPredicates.h - PPC Branch Predicate Information ------*- C++ -*-===// |
16 | | // |
17 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
18 | | // See https://llvm.org/LICENSE.txt for license information. |
19 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
20 | | // |
21 | | //===----------------------------------------------------------------------===// |
22 | | // |
23 | | // This file describes the PowerPC branch predicates. |
24 | | // |
25 | | //===----------------------------------------------------------------------===// |
26 | | |
27 | | #ifndef CS_PPC_PREDICATES_H |
28 | | #define CS_PPC_PREDICATES_H |
29 | | |
30 | | // GCC #defines PPC on Linux but we use it as our namespace name |
31 | | #include "capstone/ppc.h" |
32 | | #undef PPC |
33 | | |
34 | | // Generated files will use "namespace PPC". To avoid symbol clash, |
35 | | // undefine PPC here. PPC may be predefined on some hosts. |
36 | | #undef PPC |
37 | | |
38 | | // Predicates moved to ppc.h |
39 | | typedef ppc_pred PPC_Predicate; |
40 | | |
41 | | /// Invert the specified predicate. != -> ==, < -> >=. |
42 | | PPC_Predicate InvertPredicate(PPC_Predicate Opcode); |
43 | | /// Assume the condition register is set by MI(a,b), return the predicate if |
44 | | /// we modify the instructions such that condition register is set by MI(b,a). |
45 | | PPC_Predicate getSwappedPredicate(PPC_Predicate Opcode); |
46 | | /// Return the condition without hint bits. |
47 | | static inline unsigned PPC_getPredicateCondition(PPC_Predicate Opcode) |
48 | 0 | { |
49 | 0 | return (unsigned)(Opcode & ~PPC_BR_HINT_MASK); |
50 | 0 | } Unexecuted instantiation: PPCDisassembler.c:PPC_getPredicateCondition Unexecuted instantiation: PPCInstPrinter.c:PPC_getPredicateCondition |
51 | | |
52 | | /// Return the hint bits of the predicate. |
53 | | static inline unsigned PPC_getPredicateHint(PPC_Predicate Opcode) |
54 | 0 | { |
55 | 0 | return (unsigned)(Opcode & PPC_BR_HINT_MASK); |
56 | 0 | } Unexecuted instantiation: PPCDisassembler.c:PPC_getPredicateHint Unexecuted instantiation: PPCInstPrinter.c:PPC_getPredicateHint |
57 | | |
58 | | /// Return predicate consisting of specified condition and hint bits. |
59 | | static inline PPC_Predicate PPC_getPredicate(unsigned Condition, unsigned Hint) |
60 | 0 | { |
61 | 0 | return (PPC_Predicate)((Condition & ~PPC_BR_HINT_MASK) | |
62 | 0 | (Hint & PPC_BR_HINT_MASK)); |
63 | 0 | } Unexecuted instantiation: PPCDisassembler.c:PPC_getPredicate Unexecuted instantiation: PPCInstPrinter.c:PPC_getPredicate |
64 | | |
65 | | #endif // CS_PPC_PREDICATES_H |