ScEpTIC.llvmir_parser.sections_parser package¶
Submodules¶
ScEpTIC.llvmir_parser.sections_parser.attributes_groups module¶
-
ScEpTIC.llvmir_parser.sections_parser.attributes_groups.
is_attributes_group
(text)¶ Return if the line represents an attributes group.
-
ScEpTIC.llvmir_parser.sections_parser.attributes_groups.
parse_attributes_group
(text)¶ Parses a line containing a list of attributes and returns the id of the attributes group and the attributes themselves. Valued attributes will be represented as a list [‘attribute_name’, ‘attribute_value’]
-
ScEpTIC.llvmir_parser.sections_parser.attributes_groups.
parse_attributes_groups_section
(text, log_section_content=False)¶ Parse and return the attributes groups section, using parse_attributes_group. attributes #0 = { alwaysinline alignstack=4 …}
ScEpTIC.llvmir_parser.sections_parser.custom_types module¶
-
ScEpTIC.llvmir_parser.sections_parser.custom_types.
is_custom_type
(text)¶ Returns if the current line is a type definition.
-
ScEpTIC.llvmir_parser.sections_parser.custom_types.
parse_custom_type_definition
(text)¶ Parses and returns a type declaration.
-
ScEpTIC.llvmir_parser.sections_parser.custom_types.
parse_custom_types_section
(text, log_section_content=False)¶ Parses and returns the custom types section, using parse_custom_type_definition. %type_type.type_name = type { type_name (, type_name)* }
-
ScEpTIC.llvmir_parser.sections_parser.custom_types.
parse_name_and_type
(text)¶ Parses and returns the type (union or struct) and the name of the new declared type.
-
ScEpTIC.llvmir_parser.sections_parser.custom_types.
parse_type_composition
(text, is_from_function=False)¶ Parses and return the type composition of the type declaration. Elements are parsed using the global_var “parse_type” implementation.
ScEpTIC.llvmir_parser.sections_parser.function module¶
-
ScEpTIC.llvmir_parser.sections_parser.function.
extract_type_and_attributes
(text)¶ This function separates parameter attributes from the parameter type.
-
ScEpTIC.llvmir_parser.sections_parser.function.
get_function_attributes_group
(text)¶ Returns the list of attributes groups the function has.
-
ScEpTIC.llvmir_parser.sections_parser.function.
handle_llvm_dbg
(instruction, body)¶ Handles the llvm.dbg function. It just appends metadata to the designed instruction.
-
ScEpTIC.llvmir_parser.sections_parser.function.
is_function_declaration
(text)¶ Returns if a given line is a function declaration.
-
ScEpTIC.llvmir_parser.sections_parser.function.
is_function_definition
(text)¶ Returns if a given line is a function definition.
-
ScEpTIC.llvmir_parser.sections_parser.function.
is_label
(text)¶ Returns if a line represents a label. [‘;’, ‘<’, ‘label’, ‘>’, ‘:’, ‘17’, ‘:’, ‘;’, ‘preds’, ‘=’, ‘%’, ‘7’]
-
ScEpTIC.llvmir_parser.sections_parser.function.
is_llvm_dbg
(instruction, check_if_string=True)¶ Returns if an instruction is a call to a llvm.dbg function.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_function_arguments
(text)¶ Returns the list of the arguments of the function.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_function_body
(text, declaration)¶ Parses and returns the function body as a list of instructions.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_function_declaration
(text)¶ Parses a line containing a function intestation and returns it.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_function_declarations_section
(text, log_section_content=False)¶ Parses and returns the function declaration section, using parse_function_definition. <define|declare> [linkage] [PreemptionSpecifier] [visibility] [DLLStorageClass]
[cconv] [ret attrs] <ResultType> @<FunctionName> ([argument list]) [(unnamed_addr|local_unnamed_addr)] [fn Attrs] [section “name”] [comdat [($name)]] [align N] [gc] [prefix Constant] [prologue Constant] [personality Constant] (!name !N)* { … }
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_function_definition
(declaration, body)¶ Parses and returns a function definition, which consists in the function declaration and the function body.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_function_definition_section
(text, log_section_content=False)¶ Parses and returns the function definition section, using parse_function_definition and parse_function_body.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_label
(text)¶ Parses a label.
-
ScEpTIC.llvmir_parser.sections_parser.function.
parse_return_type
(text)¶ Parses the return type of the function. Returns a list representing the types returned by the function and the delimiter of the type definition. Uses both custom_types and global_vars parse functions
ScEpTIC.llvmir_parser.sections_parser.global_vars module¶
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
is_global_var_def
(text)¶ Returns if the current line is a global variable definition.
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
is_valid_initial_val
(text)¶ Verify if text is a valid initial_val. Admitted initial_vals:
0.00e+000
0.0
null
zeroinitial_val
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_align_attribute
(text)¶ Check and returns the value of the align attribute. If not present, returns false
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_array_def
(text)¶ Returns the type of the array and its dimensionality
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_array_initial_val
(text)¶ Parses the array initial value and returns it. It also works for vectors. It can be a list of values or a list of sub-lists. It is a list (n-dimension, as the array initialization vector).
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_base_type
(text, is_function_return_type=False, is_function_attr=False)¶ Returns the base type of a variable (type and bits)
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_comdat_attribute
(text)¶ Check and returns the value of the comdat attribute. If not present, returns false
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_global_var
(text)¶ Parses a line containing the definition of a global variable and returns it.
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_global_vars_section
(text, log_section_content=False)¶ Parses and returns the global variables section, using parse_global_var. @<GlobalVarName> = [Linkage] [PreemptionSpecifier] [Visibility]
[DLLStorageClass] [ThreadLocal] [(unnamed_addr|local_unnamed_addr)] [AddrSpace] [ExternallyInitialized] <global | constant> <Type> [<initial_valConstant>] [, section “name”] [, comdat [($name)]] [, align <Alignment>] (, !name !N)*
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_main_attributes
(text)¶ Parses the main and mandatory attributes of the variable (type, initial value). Returns a dictionary containing the relevant information of the variable.
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_section_attribute
(text)¶ Check and returns the value of the section attribute. If not present, returns false
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_type
(text, is_function_return_type=False, is_function_attr=False)¶ Parses and returns the type of a given operand/variable.
-
ScEpTIC.llvmir_parser.sections_parser.global_vars.
parse_type_and_initial_val
(text)¶ Returns the type and the initial_val (if any) of the variable
ScEpTIC.llvmir_parser.sections_parser.headers module¶
-
ScEpTIC.llvmir_parser.sections_parser.headers.
get_source_file_name
(text)¶ Parses a line containing the source file name and returns it
-
ScEpTIC.llvmir_parser.sections_parser.headers.
get_target_datalayout
(text)¶ Parses a line containing the target datalayout and returns its elements
-
ScEpTIC.llvmir_parser.sections_parser.headers.
get_target_triple
(text)¶ Parses a line containing the target triple / architecture and returns it
-
ScEpTIC.llvmir_parser.sections_parser.headers.
is_header
(text)¶ Return if the line represents an header
-
ScEpTIC.llvmir_parser.sections_parser.headers.
is_header_section
(text)¶ Return if the first 3 lines represents the headers
-
ScEpTIC.llvmir_parser.sections_parser.headers.
is_source_file_name
(text)¶ Return if parsed line represents source_filename
-
ScEpTIC.llvmir_parser.sections_parser.headers.
is_target_datalayout
(text)¶ Return if parsed line represents target_datalayout
-
ScEpTIC.llvmir_parser.sections_parser.headers.
is_target_triple
(text)¶ Return if parsed line represents target_triple
-
ScEpTIC.llvmir_parser.sections_parser.headers.
parse_header_section
(text, log_section_content=False)¶ Parses the header section and returns a dictionary containing parsed values
ScEpTIC.llvmir_parser.sections_parser.metadata module¶
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
get_element_metadata
(text, elem_name, return_index=False)¶ Returns the metadata associated to other instructions a line of llvm code.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
get_metadata_body
(text)¶ Returns the metadata body (text after = ).
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
get_metadata_body_arg_list
(text, do_split=True)¶ Returns the argument list of a metadata “function”.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
get_metadata_right_side
(text)¶ Remove useless tokens from metadata.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
is_metadata
(text)¶ Returns if parsed line represents metadata.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
parse_metadata
(text)¶ Parses and returns a line containing metadata information.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
parse_metadata_body
(text, metadata_name)¶ Parses and returns the body of a metadata. It returns a Metadata object.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
parse_metadata_collection
(text, metadata_name, raise_exception=True)¶ Parses a metadata collection and returns it. !id = {!elem (, !elem)*}
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
parse_metadata_function
(text, metadata_name)¶ Parses all type of metadata functions and returns the parsed metadata function.
-
ScEpTIC.llvmir_parser.sections_parser.metadata.
parse_metadata_section
(text, log_section_content=False)¶ Parses and returns the metadata section, using parse_metadata. !name = [distinct] !(…)