Skip to content

Commit

Permalink
Emit textual description instead of empty code block when there is no…
Browse files Browse the repository at this point in the history
… overloaded variants for the function group

Signed-off-by: eop Chen <[email protected]>
  • Loading branch information
eopXD committed Aug 28, 2023
1 parent abf671c commit b72fb04
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions rvv-intrinsic-generator/rvv_intrinsic_gen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ def __init__(self, f, is_all_in_one, has_tail_policy):
super().__init__()
self.is_all_in_one = is_all_in_one
self.has_tail_policy = has_tail_policy
# This is used under OverloadedDocGenerator::function_group to emit
# text description when all intrinsics under op_list does not have an
# overloaded variants.
self.do_not_have_overloaded_variant = False
if self.is_all_in_one:
self.fd = f
else:
Expand Down Expand Up @@ -228,6 +232,10 @@ def function_group(self, template, title, link, op_list, type_list, sew_list,
s = "Intrinsics here don't have a policy variant.\n"
self.write(s)
return
if self.do_not_have_overloaded_variant:
self.write("Intrinsics here don't have an overloaded variant.\n")
return

super().function_group(template, title, link, op_list, type_list, sew_list,
lmul_list, decorator_list)

Expand Down Expand Up @@ -270,6 +278,15 @@ def write_title(self, text, link):
else:
self.fd.write("\n[[overloaded-" + link + "]]\n=== " + text + "\n")

def function_group(self, template, title, link, op_list, type_list, sew_list,
lmul_list, decorator_list):
self.do_not_have_overloaded_variant = True
for op in op_list:
if Generator.is_support_overloaded(op):
self.do_not_have_overloaded_variant = False
super().function_group(template, title, link, op_list, type_list, sew_list,
lmul_list, decorator_list)

def func(self, inst_info, name, return_type, **kwargs):
func_name = Generator.func_name(name)
if not Generator.is_support_overloaded(name, **kwargs):
Expand Down

0 comments on commit b72fb04

Please sign in to comment.