source: rtems-tools/tester/covoar/Target_aarch64.cc @ d9454ca

Last change on this file since d9454ca was d9454ca, checked in by Alex White <alex.white@…>, on Feb 24, 2021 at 9:53:22 PM

covoar: Add aarch64 target

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*! @file Target_aarch64.cc
2 *  @brief Target_aarch64 Implementation
3 *
4 *  This file contains the implementation of the base class for
5 *  functions supporting target unique functionallity.
6 */
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include <unistd.h>
12
13#include <rld.h>
14
15#include "Target_aarch64.h"
16
17namespace Target {
18
19  Target_aarch64::Target_aarch64( std::string targetName ):
20    TargetBase( targetName )
21  {
22    conditionalBranchInstructions.push_back("cbnz");
23    conditionalBranchInstructions.push_back("cbz");
24    conditionalBranchInstructions.push_back("tbnz");
25    conditionalBranchInstructions.push_back("tbz");
26    conditionalBranchInstructions.push_back("b.eq");
27    conditionalBranchInstructions.push_back("b.ne");
28    conditionalBranchInstructions.push_back("b.cs");
29    conditionalBranchInstructions.push_back("b.hs");
30    conditionalBranchInstructions.push_back("b.cc");
31    conditionalBranchInstructions.push_back("b.lo");
32    conditionalBranchInstructions.push_back("b.mi");
33    conditionalBranchInstructions.push_back("b.pl");
34    conditionalBranchInstructions.push_back("b.vs");
35    conditionalBranchInstructions.push_back("b.vc");
36    conditionalBranchInstructions.push_back("b.hi");
37    conditionalBranchInstructions.push_back("b.ls");
38    conditionalBranchInstructions.push_back("b.ge");
39    conditionalBranchInstructions.push_back("b.lt");
40    conditionalBranchInstructions.push_back("b.gt");
41    conditionalBranchInstructions.push_back("b.le");
42
43    conditionalBranchInstructions.sort();
44  }
45
46  Target_aarch64::~Target_aarch64()
47  {
48  }
49
50  bool Target_aarch64::isNopLine(
51    const char* const line,
52    int&              size
53  )
54  {
55    if (!strcmp( &line[strlen(line)-3], "nop")) {
56      size = 4;
57      return true;
58    }
59
60    if (!strncmp( &line[strlen(line)-6], "udf", 3)) {
61      size = 4;
62      return true;
63    }
64
65    // On ARM, there are literal tables at the end of methods.
66    // We need to avoid them.
67    if (!strncmp( &line[strlen(line)-10], ".byte", 5)) {
68      size = 1;
69      return true;
70    }
71    if (!strncmp( &line[strlen(line)-13], ".short", 6)) {
72      size = 2;
73      return true;
74    }
75    if (!strncmp( &line[strlen(line)-16], ".word", 5)) {
76      size = 4;
77      return true;
78    }
79
80    return false;
81  }
82
83  bool Target_aarch64::isBranch(
84      const char* instruction
85  )
86  {
87    throw rld::error(
88      "DETERMINE BRANCH INSTRUCTIONS FOR THIS ARCHITECTURE! -- fix me",
89      "Target_aarch64::isBranch"
90    );
91  }
92
93  TargetBase *Target_aarch64_Constructor(
94    std::string          targetName
95  )
96  {
97    return new Target_aarch64( targetName );
98  }
99
100}
Note: See TracBrowser for help on using the repository browser.