Skip to content

Commit

Permalink
feat: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlekcahdp4 committed Oct 21, 2024
1 parent ba3913c commit 8eb62fc
Show file tree
Hide file tree
Showing 2 changed files with 564 additions and 83 deletions.
9 changes: 9 additions & 0 deletions lib/llvm-api-gen/llvm-api-gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,18 @@ void generate_special_instr(const Instruction &instr, raw_ostream &os,
llvm_unreachable("unknown special instr");
}

std::string get_instr_comment(const Instruction &instr) {
std::string comment = "/*\n";
raw_string_ostream os(comment);
instr.print(os);
os << "\n*/\n";
return comment;
}

std::string create_instr(const Instruction &instr, generation_context &ctx) {
std::string instr_str;
raw_string_ostream os(instr_str);
os << get_instr_comment(instr);
auto *bb = instr.getParent();
os << formatv("{0}.SetInsertPoint(bb_{1});\n", builder,
ctx.get_value_idx(*bb));
Expand Down
Loading

0 comments on commit 8eb62fc

Please sign in to comment.