1//===-- Error.cpp -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "Error.h"
10#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
11
12#ifdef LLVM_ON_UNIX
13#include "llvm/Support/SystemZ/zOSSupport.h"
14#include <string.h>
15#endif // LLVM_ON_UNIX
16
17namespace llvm {
18namespace exegesis {
19
20char ClusteringError::ID;
21
22void ClusteringError::log(raw_ostream &OS) const { OS << Msg; }
23
24std::error_code ClusteringError::convertToErrorCode() const {
25 return inconvertibleErrorCode();
26}
27
28char SnippetExecutionFailure::ID;
29
30std::error_code SnippetExecutionFailure::convertToErrorCode() const {
31 return inconvertibleErrorCode();
32}
33
34char SnippetSegmentationFault::ID;
35
36void SnippetSegmentationFault::log(raw_ostream &OS) const {
37 OS << "The snippet encountered a segmentation fault at address "
38 << Twine::utohexstr(Val: Address);
39}
40
41char SnippetSignal::ID;
42
43void SnippetSignal::log(raw_ostream &OS) const {
44 OS << "snippet crashed while running";
45#ifdef LLVM_ON_UNIX
46 OS << ": " << strsignal(sig: SignalNumber);
47#else
48 (void)SignalNumber;
49#endif // LLVM_ON_UNIX
50}
51
52char PerfCounterNotFullyEnabled::ID;
53
54std::error_code PerfCounterNotFullyEnabled::convertToErrorCode() const {
55 return inconvertibleErrorCode();
56}
57
58void PerfCounterNotFullyEnabled::log(raw_ostream &OS) const {
59 OS << "The perf counter was not scheduled on the CPU the entire time.";
60}
61
62} // namespace exegesis
63} // namespace llvm
64