ScEpTIC.AST.elements package¶
Subpackages¶
- ScEpTIC.AST.elements.instructions package
- Submodules
- ScEpTIC.AST.elements.instructions.binary_operation module
- ScEpTIC.AST.elements.instructions.conversion module
- ScEpTIC.AST.elements.instructions.memory_operations module
- ScEpTIC.AST.elements.instructions.other_operations module
- ScEpTIC.AST.elements.instructions.termination_instructions module
- Module contents
Submodules¶
ScEpTIC.AST.elements.function module¶
-
class
ScEpTIC.AST.elements.function.
Function
(name, return_type, arguments, attr_groups, metadata)¶ Bases:
object
AST node representing a function. Contains the function’s definition and body.
-
adjust_alloca_ticks
()¶ This method sets all the ticks for alloca operations equal to 0, except for the last one. Alloca operations are merged together during datalayout into a single ebp increment. The last alloca is the one with tick = 1 for skipping the entire alloca section when running in intermittent execution (otherwise multiple alloca operations might be run, but the result would be wrong)
-
attach_body
(body)¶ Sets the body of a function definition and creates the mapping between instruction id and labels.
-
declarations
= {}¶
-
elements
= {}¶
-
property
first_basic_block_id
¶ Returns the id of the first basic block. If the function has some arguments, each argument is mapped starting from %0 to %(#args - 1) The first basic block label will be %(#args)
-
get_ignore
()¶ Returns a list of register names to be ignored by register allocation. For a function corresponds to the registers used to pass the parameters, which are from %0 to %(n-1) (n = number of arguments).
-
get_instruction_id
(label)¶ Returns the instruction which has a given label.
-
update_labels
()¶ Updates the label-instruction mappings
-
ScEpTIC.AST.elements.global_var module¶
ScEpTIC.AST.elements.instruction module¶
-
class
ScEpTIC.AST.elements.instruction.
Instruction
¶ Bases:
object
Generic AST Instruction
-
get_defs
()¶ Returns a list of registers defined by this instruction. Usually its len will be 1 or 0. (used by register allocation)
-
get_ignore
()¶ Returns a list of register names to be ignored by register allocation.
-
get_input_lookup
()¶ Returns the input lookup data for the current operation
-
get_uses
()¶ Returns a list containing the names of the registers used by this instruction. (used by register allocation)
-
property
instruction_type
¶ Returns the instruction type
-
replace_reg_name
(old_reg_name, new_reg_name)¶ Skeleton. Replaces the name of a register used by the instruction with a new one. (used by register allocation)
-
run
()¶ Executes the operation and the target assignment.
-
save_in_target_register
(value)¶ Saves a given value in the target register of the instruction, if present.
-
tick_count
= 1¶
-
ScEpTIC.AST.elements.metadata module¶
-
class
ScEpTIC.AST.elements.metadata.
Metadata
(name, metadata_type, metadata_function_name, values, includes)¶ Bases:
object
AST node for LLVM metadata
-
elements
= {}¶
-
static
fancy_format
(metadata)¶ Formats the metadata and returns it
-
retrieve
()¶ Resolve metadata tree and return only relevant metadata information
-
ScEpTIC.AST.elements.types module¶
-
class
ScEpTIC.AST.elements.types.
BaseType
(base_type, bits)¶ Bases:
object
AST node of LLVM Base Type NOTE: enum data type doesn’t appear because it is directly resolved and converted in int by the llvm front-end.
-
class
ScEpTIC.AST.elements.types.
CustomType
(fullname, ct_type, name, type_composition)¶ Bases:
object
AST node representing a LLVM custom type
-
elements
= {}¶
-
get_memory_composition
()¶ Returns a list of lists, in which each element is a memory composition of the represented type.
-
-
class
ScEpTIC.AST.elements.types.
Type
(is_pointer, pointer_level, is_array, array_composition, is_vector, vector_dimension, is_base_type, custom_type_name, is_ct_defined, custom_type_def, base_type)¶ Bases:
object
AST node representing a LLVM generic type (Array, Vector, Pointer, Custom Type)
-
address_dimension
= 0¶
-
classmethod
empty
()¶ Creates an empty type.
-
static
flat_composition
(composition, lst)¶ flatterns a memory composition, turning it into a single list of dimensions array: [2, 32] -> [32, 32] array of struct: [3, [[3, 8], [1, 32]]] -> [8, 8, 8, 32, 8, 8, 8, 32, 8, 8, 8, 32]
-
get_memory_composition
(flat_composition=False)¶ Returns the memory composition of the Type, which is a list [a, b] with a representing the number of elements and b representing the size of each element. b can be a list of memory composition in case the Type refers to a customtype.
-
ScEpTIC.AST.elements.value module¶
-
class
ScEpTIC.AST.elements.value.
Value
(value_class, operand_value, value_type)¶ Bases:
object
AST node for data representation (immediate, register data, etc)
-
static
convert_bin_to_sint
(val)¶ Converts a number in binary format to its equivalent signed decimal.
-
static
convert_bin_to_uint
(val)¶ Converts a number in binary format to its equivalent unsigned decimal.
-
static
convert_sint_to_bin
(val, bits)¶ Converts a signed integer to its binary representation, using a certain number of bits
-
static
convert_sint_to_sint
(val, bits)¶ Convert a signed integer to a signed integer, using a maximum number of bits.
-
static
convert_sint_to_uint
(val, bits)¶ Converts a number in signed integer form to its equivalent unsigned integer.
-
static
convert_uint_to_bin
(val, bits)¶ Converts an unsigned integer to its binary representation. For how data is represented, it is the same as converting a signed integer to binary.
-
static
convert_uint_to_sint
(val, bits)¶ Converts a number in unsigned integer form to its equivalent signed integer.
-
get_input_lookup
()¶ Returns the input lookup information for the current Value object.
-
get_uses
()¶ Returns a list containing the names of the registers used by this value. (used by register allocation)
-
get_val
()¶ Retrieve and returns the value represented by the object.
-
replace_reg_name
(old_reg_name, new_reg_name)¶ Replaces the name of a register contained in this Value object. (used by register allocation)
-
static