Coverage Report

Created: 2024-09-08 06:22

/src/capstonenext/arch/ARM/ARMBaseInfo.c
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: 464bda7750a3ba9e23823fc707d7e7b6fc38438d */
7
/* LLVM-tag: llvmorg-16.0.2-5-g464bda7750a3 */
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
//===-- ARMBaseInfo.cpp - ARM Base encoding information------------===//
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 provides basic encoding and assembly information for ARM.
24
//
25
//===----------------------------------------------------------------------===//
26
#include <capstone/platform.h>
27
#include <stdio.h>
28
#include <stdlib.h>
29
#include <string.h>
30
31
#include "ARMBaseInfo.h"
32
#include "ARMMapping.h"
33
34
#define CONCAT(a, b) CONCAT_(a, b)
35
#define CONCAT_(a, b) a##_##b
36
37
const char *get_pred_mask(ARM_PredBlockMask pred_mask)
38
0
{
39
0
  switch (pred_mask) {
40
0
  default:
41
0
    assert(0 && "pred_mask not handled.");
42
0
  case ARM_T:
43
0
    return "T";
44
0
  case ARM_TT:
45
0
    return "TT";
46
0
  case ARM_TE:
47
0
    return "TE";
48
0
  case ARM_TTT:
49
0
    return "TTT";
50
0
  case ARM_TTE:
51
0
    return "TTE";
52
0
  case ARM_TEE:
53
0
    return "TEE";
54
0
  case ARM_TET:
55
0
    return "TET";
56
0
  case ARM_TTTT:
57
0
    return "TTTT";
58
0
  case ARM_TTTE:
59
0
    return "TTTE";
60
0
  case ARM_TTEE:
61
0
    return "TTEE";
62
0
  case ARM_TTET:
63
0
    return "TTET";
64
0
  case ARM_TEEE:
65
0
    return "TEEE";
66
0
  case ARM_TEET:
67
0
    return "TEET";
68
0
  case ARM_TETT:
69
0
    return "TETT";
70
0
  case ARM_TETE:
71
0
    return "TETE";
72
0
  }
73
0
}
74
75
#define GET_MCLASSSYSREG_IMPL
76
#include "ARMGenSystemRegister.inc"
77
78
// lookup system register using 12-bit SYSm value.
79
// Note: the search is uniqued using M1 mask
80
const ARMSysReg_MClassSysReg *
81
ARMSysReg_lookupMClassSysRegBy12bitSYSmValue(unsigned SYSm)
82
20.2k
{
83
20.2k
  return ARMSysReg_lookupMClassSysRegByM1Encoding12(SYSm);
84
20.2k
}
85
86
// returns APSR with _<bits> qualifier.
87
// Note: ARMv7-M deprecates using MSR APSR without a _<bits> qualifier
88
const ARMSysReg_MClassSysReg *
89
ARMSysReg_lookupMClassSysRegAPSRNonDeprecated(unsigned SYSm)
90
19.5k
{
91
19.5k
  return ARMSysReg_lookupMClassSysRegByM2M3Encoding8((1 << 9) |
92
19.5k
                 (SYSm & 0xFF));
93
19.5k
}
94
95
// lookup system registers using 8-bit SYSm value
96
const ARMSysReg_MClassSysReg *
97
ARMSysReg_lookupMClassSysRegBy8bitSYSmValue(unsigned SYSm)
98
20.5k
{
99
20.5k
  return ARMSysReg_lookupMClassSysRegByM2M3Encoding8((1 << 8) |
100
20.5k
                 (SYSm & 0xFF));
101
20.5k
}