mirror of https://github.com/Nonannet/copapy.git
code style fixed
This commit is contained in:
parent
52f5b28017
commit
79f1fc80a9
5
.flake8
5
.flake8
|
|
@ -13,8 +13,7 @@ exclude =
|
||||||
build,
|
build,
|
||||||
dist,
|
dist,
|
||||||
.conda,
|
.conda,
|
||||||
.venv,
|
.venv
|
||||||
tests/autogenerated_*
|
|
||||||
|
|
||||||
# Enable specific plugins or options
|
# Enable specific plugins or options
|
||||||
# Example: Enabling flake8-docstrings
|
# Example: Enabling flake8-docstrings
|
||||||
|
|
@ -22,4 +21,4 @@ select = C,E,F,W,D
|
||||||
|
|
||||||
# Specify custom error codes to ignore or enable
|
# Specify custom error codes to ignore or enable
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
tests/*: D
|
tests/*: D, E712
|
||||||
|
|
@ -62,10 +62,12 @@ def get_last_call_in_function(func: elf_symbol) -> int:
|
||||||
assert reloc, f'No call function in stencil function {func.name}.'
|
assert reloc, f'No call function in stencil function {func.name}.'
|
||||||
return reloc.fields['r_offset'] - func.fields['st_value'] - reloc.fields['r_addend'] - LENGTH_CALL_INSTRUCTION
|
return reloc.fields['r_offset'] - func.fields['st_value'] - reloc.fields['r_addend'] - LENGTH_CALL_INSTRUCTION
|
||||||
|
|
||||||
|
|
||||||
def symbol_is_stencil(sym: elf_symbol) -> bool:
|
def symbol_is_stencil(sym: elf_symbol) -> bool:
|
||||||
return (sym.info == 'STT_FUNC' and len(sym.relocations) > 0 and
|
return (sym.info == 'STT_FUNC' and len(sym.relocations) > 0 and
|
||||||
sym.relocations[-1].symbol.info == 'STT_NOTYPE')
|
sym.relocations[-1].symbol.info == 'STT_NOTYPE')
|
||||||
|
|
||||||
|
|
||||||
class stencil_database():
|
class stencil_database():
|
||||||
"""A class for loading and querying a stencil database from an ELF object file
|
"""A class for loading and querying a stencil database from an ELF object file
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ if __name__ == "__main__":
|
||||||
rel_entr_point = dr.read_int()
|
rel_entr_point = dr.read_int()
|
||||||
print(f"ENTRY_POINT rel_entr_point={rel_entr_point}")
|
print(f"ENTRY_POINT rel_entr_point={rel_entr_point}")
|
||||||
elif com == Command.RUN_PROG:
|
elif com == Command.RUN_PROG:
|
||||||
print(f"RUN_PROG")
|
print("RUN_PROG")
|
||||||
elif com == Command.READ_DATA:
|
elif com == Command.READ_DATA:
|
||||||
offs = dr.read_int()
|
offs = dr.read_int()
|
||||||
size = dr.read_int()
|
size = dr.read_int()
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ stencil_func_prefix = '__attribute__((naked)) ' # Remove callee prolog
|
||||||
|
|
||||||
stack_size = 64
|
stack_size = 64
|
||||||
|
|
||||||
|
|
||||||
def get_aux_funcs() -> str:
|
def get_aux_funcs() -> str:
|
||||||
return f"""
|
return f"""
|
||||||
{entry_func_prefix}int entry_function_shell(){{
|
{entry_func_prefix}int entry_function_shell(){{
|
||||||
|
|
@ -17,8 +18,8 @@ def get_aux_funcs() -> str:
|
||||||
result_int(0);
|
result_int(0);
|
||||||
return 1;
|
return 1;
|
||||||
}}
|
}}
|
||||||
""" + \
|
|
||||||
"""
|
""" + """
|
||||||
__attribute__((noinline)) int floor_div(float arg1, float arg2) {
|
__attribute__((noinline)) int floor_div(float arg1, float arg2) {
|
||||||
float x = arg1 / arg2;
|
float x = arg1 / arg2;
|
||||||
int i = (int)x;
|
int i = (int)x;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue