LLVM  14.0.0git
OrcError.cpp
Go to the documentation of this file.
1 //===---------------- OrcError.cpp - Error codes for ORC ------------------===//
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 // Error codes for ORC.
10 //
11 //===----------------------------------------------------------------------===//
12 
16 
17 #include <type_traits>
18 
19 using namespace llvm;
20 using namespace llvm::orc;
21 
22 namespace {
23 
24 // FIXME: This class is only here to support the transition to llvm::Error. It
25 // will be removed once this transition is complete. Clients should prefer to
26 // deal with the Error value directly, rather than converting to error_code.
27 class OrcErrorCategory : public std::error_category {
28 public:
29  const char *name() const noexcept override { return "orc"; }
30 
31  std::string message(int condition) const override {
32  switch (static_cast<OrcErrorCode>(condition)) {
34  return "Unknown ORC error";
36  return "Duplicate symbol definition";
38  return "JIT symbol not found";
40  return "Remote allocator does not exist";
42  return "Remote allocator Id already in use";
44  return "Remote mprotect call references unallocated memory";
46  return "Remote indirect stubs owner does not exist";
48  return "Remote indirect stubs owner Id already in use";
50  return "RPC connection closed";
52  return "Could not negotiate RPC function";
54  return "RPC response abandoned";
56  return "Unexpected RPC call";
58  return "Unexpected RPC response";
60  return "Unknown error returned from remote RPC function "
61  "(Use StringError to get error message)";
63  return "Unknown resource handle";
65  return "MissingSymbolsDefinitions";
67  return "UnexpectedSymbolDefinitions";
68  }
69  llvm_unreachable("Unhandled error code");
70  }
71 };
72 
73 static ManagedStatic<OrcErrorCategory> OrcErrCat;
74 } // namespace
75 
76 namespace llvm {
77 namespace orc {
78 
80 char JITSymbolNotFound::ID = 0;
81 
82 std::error_code orcError(OrcErrorCode ErrCode) {
84  return std::error_code(static_cast<UT>(ErrCode), *OrcErrCat);
85 }
86 
89 
90 std::error_code DuplicateDefinition::convertToErrorCode() const {
92 }
93 
95  OS << "Duplicate definition of symbol '" << SymbolName << "'";
96 }
97 
98 const std::string &DuplicateDefinition::getSymbolName() const {
99  return SymbolName;
100 }
101 
103  : SymbolName(std::move(SymbolName)) {}
104 
105 std::error_code JITSymbolNotFound::convertToErrorCode() const {
107  return std::error_code(static_cast<UT>(OrcErrorCode::JITSymbolNotFound),
108  *OrcErrCat);
109 }
110 
112  OS << "Could not find symbol '" << SymbolName << "'";
113 }
114 
115 const std::string &JITSymbolNotFound::getSymbolName() const {
116  return SymbolName;
117 }
118 
119 } // namespace orc
120 } // namespace llvm
llvm::orc::DuplicateDefinition::getSymbolName
const std::string & getSymbolName() const
Definition: OrcError.cpp:98
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::orc::JITSymbolNotFound::log
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Definition: OrcError.cpp:111
llvm::orc::JITSymbolNotFound::ID
static char ID
Definition: OrcError.h:61
llvm::orc::OrcErrorCode::JITSymbolNotFound
@ JITSymbolNotFound
ErrorHandling.h
llvm::orc::OrcErrorCode::UnknownORCError
@ UnknownORCError
ManagedStatic.h
llvm::orc::OrcErrorCode::RPCConnectionClosed
@ RPCConnectionClosed
llvm::orc::OrcErrorCode::DuplicateDefinition
@ DuplicateDefinition
llvm::orc::OrcErrorCode::RemoteIndirectStubsOwnerDoesNotExist
@ RemoteIndirectStubsOwnerDoesNotExist
llvm::orc::JITSymbolNotFound::getSymbolName
const std::string & getSymbolName() const
Definition: OrcError.cpp:115
llvm::orc::orcError
std::error_code orcError(OrcErrorCode ErrCode)
Definition: OrcError.cpp:82
llvm::orc::OrcErrorCode::RemoteAllocatorIdAlreadyInUse
@ RemoteAllocatorIdAlreadyInUse
llvm::orc::OrcErrorCode::RPCCouldNotNegotiateFunction
@ RPCCouldNotNegotiateFunction
llvm::orc
Definition: CompileOnDemandLayer.h:57
llvm::ManagedStatic
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83
llvm::orc::OrcErrorCode::UnexpectedSymbolDefinitions
@ UnexpectedSymbolDefinitions
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::orc::DuplicateDefinition::ID
static char ID
Definition: OrcError.h:49
llvm::orc::OrcErrorCode::RPCResponseAbandoned
@ RPCResponseAbandoned
llvm::orc::OrcErrorCode
OrcErrorCode
Definition: OrcError.h:24
type
AMD64 Optimization Manual has some nice information about optimizing integer multiplication by a constant How much of it applies to Intel s X86 implementation There are definite trade offs to xmm0 cvttss2siq rdx jb L3 subss xmm0 rax cvttss2siq rdx xorq rdx rax ret instead of xmm1 cvttss2siq rcx movaps xmm2 subss xmm2 cvttss2siq rax rdx xorq rax ucomiss xmm0 cmovb rax ret Seems like the jb branch has high likelihood of being taken It would have saved a few instructions It s not possible to reference and DH registers in an instruction requiring REX prefix divb and mulb both produce results in AH If isel emits a CopyFromReg which gets turned into a movb and that can be allocated a r8b r15b To get around isel emits a CopyFromReg from AX and then right shift it down by and truncate it It s not pretty but it works We need some register allocation magic to make the hack go which would often require a callee saved register Callees usually need to keep this value live for most of their body so it doesn t add a significant burden on them We currently implement this in however this is suboptimal because it means that it would be quite awkward to implement the optimization for callers A better implementation would be to relax the LLVM IR rules for sret arguments to allow a function with an sret argument to have a non void return type
Definition: README-X86-64.txt:70
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::orc::OrcErrorCode::RemoteAllocatorDoesNotExist
@ RemoteAllocatorDoesNotExist
llvm::orc::OrcErrorCode::UnknownResourceHandle
@ UnknownResourceHandle
llvm::orc::OrcErrorCode::RemoteMProtectAddrUnrecognized
@ RemoteMProtectAddrUnrecognized
message
message(STATUS "Targeting ${t}") add_subdirectory($
Definition: CMakeLists.txt:33
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1609
llvm::orc::OrcErrorCode::RemoteIndirectStubsOwnerIdAlreadyInUse
@ RemoteIndirectStubsOwnerIdAlreadyInUse
llvm::orc::JITSymbolNotFound::convertToErrorCode
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
Definition: OrcError.cpp:105
llvm::orc::JITSymbolNotFound::JITSymbolNotFound
JITSymbolNotFound(std::string SymbolName)
Definition: OrcError.cpp:102
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::orc::DuplicateDefinition::log
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Definition: OrcError.cpp:94
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78
llvm::AMDGPU::HSAMD::Kernel::Key::SymbolName
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Definition: AMDGPUMetadata.h:381
llvm::orc::OrcErrorCode::UnexpectedRPCCall
@ UnexpectedRPCCall
std
Definition: BitVector.h:838
llvm::orc::OrcErrorCode::UnknownErrorCodeFromRemote
@ UnknownErrorCodeFromRemote
llvm::orc::OrcErrorCode::UnexpectedRPCResponse
@ UnexpectedRPCResponse
llvm::orc::DuplicateDefinition::DuplicateDefinition
DuplicateDefinition(std::string SymbolName)
Definition: OrcError.cpp:87
llvm::orc::DuplicateDefinition::convertToErrorCode
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
Definition: OrcError.cpp:90
llvm::orc::OrcErrorCode::MissingSymbolDefinitions
@ MissingSymbolDefinitions
error_category
static ManagedStatic< _object_error_category > error_category
Definition: Error.cpp:76
OrcError.h