未验证 提交 dbd9743a 编写于 作者: C Candy2Tang 提交者: GitHub

Refine interface of hlir::framework::Instruction (#56123)

* Refine interface of hlir::framework::Instruction

* fix client usage
上级 4569ae13
......@@ -365,7 +365,7 @@ void Instruction::Run(
// }
}
std::string Instruction::DumpInstruction() {
std::string Instruction::DumpInstruction() const {
std::stringstream ss;
ss << "Instruction {" << std::endl;
for (size_t i = 0; i < fn_names_.size(); ++i) {
......
......@@ -132,13 +132,17 @@ class Instruction {
int size() { return fn_ptrs_.size(); }
std::string DumpInstruction();
std::string DumpInstruction() const;
std::vector<std::vector<std::string>> GetInArgs() { return in_args_; }
std::vector<std::vector<std::string>> GetOutArgs() { return out_args_; }
const std::vector<std::vector<std::string>>& GetInArgs() const {
return in_args_;
}
const std::vector<std::vector<std::string>>& GetOutArgs() const {
return out_args_;
}
void ClearInArgs() { in_args_.clear(); }
void ClearOutArgs() { out_args_.clear(); }
std::vector<std::string> GetFnNames() { return fn_names_; }
const std::vector<std::string>& GetFnNames() const { return fn_names_; }
void AddInArgs(const std::vector<std::string>& in_args) {
in_args_.push_back(in_args);
}
......
......@@ -140,9 +140,9 @@ void Program::Export(const std::vector<std::string>& persistent_vars,
int instplaceholder = writeplaceholder(4 * 3, insnum, f);
int findex = 0;
for (auto& ins : instrs_) {
auto in_args = ins->GetInArgs();
auto out_args = ins->GetOutArgs();
auto fn_names = ins->GetFnNames();
auto& in_args = ins->GetInArgs();
auto& out_args = ins->GetOutArgs();
auto& fn_names = ins->GetFnNames();
for (int i = 0; i < fn_names.size(); i++, findex++) {
std::vector<std::string> all_args(in_args[i].begin(), in_args[i].end());
all_args.insert(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册