mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
[FaultMaps] Move FaultMapParser to Object/
Summary: That way llvm-objdump can rely on it without adding an extra dependency on CodeGen. This change duplicates the FaultKind enum and the code that serializes it to a string. I could not figure out a way to get around this without adding a new dependency to Object Reviewers: rafael, ab Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10619 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -112,39 +112,3 @@ const char *FaultMaps::faultTypeToString(FaultMaps::FaultKind FT) {
|
||||
return "FaultingLoad";
|
||||
}
|
||||
}
|
||||
|
||||
raw_ostream &llvm::
|
||||
operator<<(raw_ostream &OS,
|
||||
const FaultMapParser::FunctionFaultInfoAccessor &FFI) {
|
||||
OS << "Fault kind: "
|
||||
<< FaultMaps::faultTypeToString((FaultMaps::FaultKind)FFI.getFaultKind())
|
||||
<< ", faulting PC offset: " << FFI.getFaultingPCOffset()
|
||||
<< ", handling PC offset: " << FFI.getHandlerPCOffset();
|
||||
return OS;
|
||||
}
|
||||
|
||||
raw_ostream &llvm::
|
||||
operator<<(raw_ostream &OS, const FaultMapParser::FunctionInfoAccessor &FI) {
|
||||
OS << "FunctionAddress: " << format_hex(FI.getFunctionAddr(), 8)
|
||||
<< ", NumFaultingPCs: " << FI.getNumFaultingPCs() << "\n";
|
||||
for (unsigned i = 0, e = FI.getNumFaultingPCs(); i != e; ++i)
|
||||
OS << FI.getFunctionFaultInfoAt(i) << "\n";
|
||||
return OS;
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const FaultMapParser &FMP) {
|
||||
OS << "Version: " << format_hex(FMP.getFaultMapVersion(), 2) << "\n";
|
||||
OS << "NumFunctions: " << FMP.getNumFunctions() << "\n";
|
||||
|
||||
if (FMP.getNumFunctions() == 0)
|
||||
return OS;
|
||||
|
||||
FaultMapParser::FunctionInfoAccessor FI;
|
||||
|
||||
for (unsigned i = 0, e = FMP.getNumFunctions(); i != e; ++i) {
|
||||
FI = (i == 0) ? FMP.getFirstFunctionInfo() : FI.getNextFunctionInfo();
|
||||
OS << FI;
|
||||
}
|
||||
|
||||
return OS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user