Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions llvm/include/llvm/TableGen/Record.h
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,12 @@ class Record {
ArrayRef<SMLoc> getLoc() const { return Locs; }
void appendLoc(SMLoc Loc) { Locs.push_back(Loc); }

// Returns the location of the "top" def or defm that instantiated this
// concrete record. For a record defined using `def`, this is the location of
// the def. For a record defined using `defm`, this is the location of the
// topmost/outermost defm that lead to the instantiation of this record.
SMLoc getTopDefLoc() const { return Locs.back(); }

ArrayRef<SMLoc> getForwardDeclarationLocs() const {
return ForwardDeclarationLocs;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
OS.indent(40 - Int.EnumName.size());
OS << formatv(
" // {} ({})\n", Int.Name,
SrcMgr.getFormattedLocationNoOffset(Int.TheDef->getLoc().front()));
SrcMgr.getFormattedLocationNoOffset(Int.TheDef->getTopDefLoc()));
}

// Emit num_intrinsics into the target neutral enum.
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/InstrInfoEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ void InstrInfoEmitter::emitEnums(
for (const CodeGenInstruction *Inst : NumberedInstructions) {
OS << " " << left_justify(Inst->getName(), MaxNameSize) << " = "
<< Target.getInstrIntValue(Inst->TheDef) << ", // "
<< SrcMgr.getFormattedLocationNoOffset(Inst->TheDef->getLoc().front())
<< SrcMgr.getFormattedLocationNoOffset(Inst->TheDef->getTopDefLoc())
<< '\n';
}
OS << " INSTRUCTION_LIST_END = " << NumberedInstructions.size() << '\n';
Expand Down