Skip to content

Commit

Permalink
Add function entry point API. (#624)
Browse files Browse the repository at this point in the history
* Add function entry point API.

* Modify return type of get_current_entry_point
  • Loading branch information
zhangyang2057 authored Aug 22, 2022
1 parent e3bd2eb commit 8baf43a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/nncase/codegen/module_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class NNCASE_API module_builder
section *find_section(std::string_view section_name);
void merge_to_rdata_section(std::string_view from);
function_call_id function_id(ir::graph *graph);
std::streampos get_current_entry_point();
void set_current_entry_point(std::streampos pos);
void set_current_function_text_end(std::streampos pos);

Expand Down
5 changes: 5 additions & 0 deletions src/codegen/module_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ function_call_id module_builder::function_id(ir::graph *graph)
throw std::invalid_argument("Can't find graph " + graph->name() + " in modules");
}

std::streampos module_builder::get_current_entry_point()
{
return entry_points_.at(current_function_);
}

void module_builder::set_current_entry_point(std::streampos pos)
{
entry_points_[current_function_] = pos;
Expand Down

0 comments on commit 8baf43a

Please sign in to comment.