ScEpTIC.llvmir_parser package

Submodules

ScEpTIC.llvmir_parser.sections_divider module

ScEpTIC.llvmir_parser.sections_divider.divide_into_sections(text, force_extraction=False)

Divides code into sections

Document structure (in order):
  • Headers (source file name, target datalayout, target triple)

  • Custom Types (Struct and Union) Definitions

  • Global Variables Definitions

  • Function Definitions

  • Function’s Attributes Definitions

  • Debug Informations

ScEpTIC.llvmir_parser.sections_divider.extract_function_body(text)

Extracts and returns the function body. Returns also the number of the latest parsed line.

ScEpTIC.llvmir_parser.sections_divider.function_def_elements_extractor(text)

Extract the function_definition section (both definition and body). Acts like simple_elements_extractor, but only extracts function defs.

ScEpTIC.llvmir_parser.sections_divider.get_elements_lines(text, verification_function)

Returns the line number of the elements on which verification_function returns true.

ScEpTIC.llvmir_parser.sections_divider.remove_lines(text, lines)

Removes lines that have already been parsed.

ScEpTIC.llvmir_parser.sections_divider.simple_elements_extractor(text, verification_function)

Extract the section composed by simple elements of the same type. An element is simple if its contained inside a single line of code. The type of the elements is given by the verification_function. It returns als the lines that have not been parsed.

ScEpTIC.llvmir_parser.token_generator module

ScEpTIC.llvmir_parser.token_generator.collapse_switch_statement(text)

Properly treats the switch statement. Is is over multiple lines, so it collapses them into a single one. To recognise the paramenters on the new line, SWITCH_NEW_LINE_MARKER is used.

ScEpTIC.llvmir_parser.token_generator.get_symbols_from_file(file)

Returns a list of lines. Each line is represented as a list of different recognizable tokens

ScEpTIC.llvmir_parser.token_generator.get_symbols_from_line(line)

Return a list of symbols

ScEpTIC.llvmir_parser.token_generator.remove_comment_from_line(line)

Removes comments from a line

ScEpTIC.llvmir_parser.token_generator.remove_unrelevant_spaces(line)

Removes all unrelevant spaces from the line.

Module contents

ScEpTIC.llvmir_parser.parse_file(file, set_logging_level=None, log_section_content=False)

Parses a .ll file and returns the AST