| 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 | |
| 17 | namespace llvm { |
| 18 | namespace exegesis { |
| 19 | |
| 20 | char ClusteringError::ID; |
| 21 | |
| 22 | void ClusteringError::log(raw_ostream &OS) const { OS << Msg; } |
| 23 | |
| 24 | std::error_code ClusteringError::convertToErrorCode() const { |
| 25 | return inconvertibleErrorCode(); |
| 26 | } |
| 27 | |
| 28 | char SnippetExecutionFailure::ID; |
| 29 | |
| 30 | std::error_code SnippetExecutionFailure::convertToErrorCode() const { |
| 31 | return inconvertibleErrorCode(); |
| 32 | } |
| 33 | |
| 34 | char SnippetSegmentationFault::ID; |
| 35 | |
| 36 | void SnippetSegmentationFault::log(raw_ostream &OS) const { |
| 37 | OS << "The snippet encountered a segmentation fault at address " |
| 38 | << Twine::utohexstr(Val: Address); |
| 39 | } |
| 40 | |
| 41 | char SnippetSignal::ID; |
| 42 | |
| 43 | void 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 | |
| 52 | char PerfCounterNotFullyEnabled::ID; |
| 53 | |
| 54 | std::error_code PerfCounterNotFullyEnabled::convertToErrorCode() const { |
| 55 | return inconvertibleErrorCode(); |
| 56 | } |
| 57 | |
| 58 | void 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 |