Lines Matching defs:ORC
55 DumpORC("dump-orc", cl::desc("dump raw ORC unwind information (sorted)"),
89 cl::desc("print ORC unwind information for instructions"),
122 /// Linux Kernel supports stack unwinding using ORC (oops rewind capability).
123 /// ORC state at every IP can be described by the following data structure.
137 /// Section terminator ORC entry.
140 /// Basic printer for ORC entry. It does not provide the same level of
196 /// Linux ORC sections.
200 /// Size of entries in ORC sections.
207 ORCState ORC; /// Stack unwind info in ORC format.
209 /// ORC entries are sorted by their IPs. Terminator entries (NullORC)
216 return ORC == NullORC && Other.ORC != NullORC;
223 /// Number of entries in the input file ORC sections.
301 /// Read ORC unwind information and annotate instructions.
304 /// Update ORC for functions once CFG is constructed.
307 /// Update ORC data in the binary.
310 /// Validate written ORC tables after binary emission.
374 // Some ORC entries could be linked to alternative instruction
375 // sequences. Hence, we read ORC after .altinstructions.
577 "missing ORC section");
583 "ORC entries number mismatch detected");
599 "out of bounds while reading ORC IP table: %s",
604 << " detected while reading ORC\n";
614 Entry.ORC.SPOffset = (int16_t)OrcDE.getU16(ORCCursor);
615 Entry.ORC.BPOffset = (int16_t)OrcDE.getU16(ORCCursor);
616 Entry.ORC.Info = (int16_t)OrcDE.getU16(ORCCursor);
622 "out of bounds while reading ORC: %s",
625 if (Entry.ORC == NullORC)
638 BC.errs() << "BOLT-WARNING: no binary function found matching ORC 0x"
639 << Twine::utohexstr(IP) << ": " << Entry.ORC << '\n';
653 // instruction and each alternative can have a separate ORC entry.
654 // Since ORC table is shared between all alternative sequences, there's
656 // instruction from the ORC table to avoid ambiguities/conflicts.
660 // As such, we can ignore alternative ORC entries. They will be preserved
674 if (BC.MIB->hasAnnotation(*Inst, "ORC"))
677 "duplicate non-terminal ORC IP 0x%" PRIx64 " in .orc_unwind_ip", IP);
679 BC.MIB->addAnnotation(*Inst, "ORC", Entry.ORC);
682 BC.outs() << "BOLT-INFO: parsed " << NumORCEntries << " ORC entries\n";
685 BC.outs() << "BOLT-INFO: ORC unwind information:\n";
687 BC.outs() << "0x" << Twine::utohexstr(E.IP) << ": " << E.ORC;
694 // Add entries for functions that don't have explicit ORC info at the start.
695 // We'll have the correct info for them even if ORC for the preceding function
708 if (It->ORC == NullORC && It->IP == BF.getAddress()) {
714 NewEntries.push_back({BF.getAddress(), &BF, It->ORC});
715 if (It->ORC != NullORC)
723 BC.outs() << "BOLT-INFO: amended ORC unwind information:\n";
725 BC.outs() << "0x" << Twine::utohexstr(E.IP) << ": " << E.ORC;
739 // Propagate ORC to the rest of the function. We can annotate every
742 // entry. This way, the ORC state can be calculated based on annotations
744 // instructions, we must take care to attach ORC info to the new/deleted ones.
751 BC.MIB->tryGetAnnotationAs<ORCState>(Inst, "ORC");
762 // terminator. Hence, we are looking for the last ORC entry that
772 "ORC info at function entry expected.");
774 if (It->ORC == NullORC && BF.hasORC()) {
775 BC.errs() << "BOLT-WARNING: ORC unwind info excludes prologue for "
781 CurrentState = It->ORC;
782 if (It->ORC != NullORC)
786 // While printing ORC, attach info to every instruction for convenience.
788 BC.MIB->addAnnotation(Inst, "ORC", *CurrentState);
800 // Update ORC sections in-place. As we change the code, the number of ORC
803 // to fit new ORC tables in the reserved space.
818 auto emitORCEntry = [&](const uint64_t IP, const ORCState &ORC,
820 if (LastEmittedORC && ORC == *LastEmittedORC && !Force)
823 LastEmittedORC = ORC;
827 "exceeded the number of allocated ORC entries");
838 if (Error E = UnwindWriter.writeInteger(ORC.SPOffset))
840 if (Error E = UnwindWriter.writeInteger(ORC.BPOffset))
842 if (Error E = UnwindWriter.writeInteger(ORC.Info))
848 // Emit new ORC entries for the emitted function.
854 BC.MIB->tryGetAnnotationAs<ORCState>(Inst, "ORC");
872 // Emit ORC entries for cold fragments. We assume that these fragments are
875 // check that ORC entries are sorted by their addresses.
905 if (Entry.ORC == NullORC && !Entry.BF)
907 if (Error E = emitORCEntry(Entry.IP, Entry.ORC))
912 // Emit all ORC entries for a function referenced by an entry and skip over
913 // the rest of entries for this function by resetting its ORC attribute.
922 << " ORC entries\n");
924 // Populate ORC tables with a terminator entry with max address to match the
948 "out of bounds while reading ORC IP table: %s",
951 assert(IP >= PrevIP && "Unsorted ORC table detected");