File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ void deepCopyBasicBlocks(
169169
170170} // namespace
171171
172+ Function::Function (const hir::Function* hir_func) : hir_func_{hir_func} {}
173+
172174int Function::allocateId () {
173175 return next_id_++;
174176}
@@ -254,4 +256,8 @@ void Function::sortBasicBlocks() {
254256 basic_blocks_ = sorter.getSortedBlocks ();
255257}
256258
259+ const hir::Function* Function::hirFunc () const {
260+ return hir_func_;
261+ }
262+
257263} // namespace jit::lir
Original file line number Diff line number Diff line change 77#include < deque>
88#include < vector>
99
10+ namespace jit ::hir {
11+ class Function ;
12+ }
13+
1014namespace jit ::lir {
1115
1216class Function {
@@ -16,6 +20,8 @@ class Function {
1620 int end_bb;
1721 };
1822
23+ explicit Function (const hir::Function* hir_func = nullptr );
24+
1925 // Allocate a new ID for a basic block or an instruction.
2026 int allocateId ();
2127
@@ -54,7 +60,11 @@ class Function {
5460
5561 void sortBasicBlocks ();
5662
63+ const hir::Function* hirFunc () const ;
64+
5765 private:
66+ const hir::Function* hir_func_;
67+
5868 // The containers below hold all the basic blocks for the Function. The deque
5969 // holds the actual data for blocks and the vector holds their (eventually)
6070 // sorted order.
Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ void LIRGenerator::AnalyzeCopies() {
283283std::unique_ptr<jit::lir::Function> LIRGenerator::TranslateFunction () {
284284 AnalyzeCopies ();
285285
286- auto function = std::make_unique<jit::lir::Function>();
286+ auto function = std::make_unique<jit::lir::Function>(func_ );
287287 lir_func_ = function.get ();
288288
289289 // generate entry block and exit block
Original file line number Diff line number Diff line change @@ -359,11 +359,10 @@ void LIRInliner::resolveReturnValue() {
359359}
360360
361361std::string_view LIRInliner::callerName () {
362- const hir::Instr* hir_call = call_instr_->origin ();
363- if (hir_call == nullptr ) {
364- return " <unnamed LIR function>" ;
362+ if (auto hir_func = caller_->hirFunc ()) {
363+ return hir_func->fullname ;
365364 }
366- return hir_call-> block ()-> cfg -> func -> fullname ;
365+ return " <unnamed LIR function> " ;
367366}
368367
369368} // namespace jit::lir
You can’t perform that action at this time.
0 commit comments