CBMC
|
Class for saving the internal state of the conversion process. More...
#include <expr2statement_list.h>
Public Member Functions | |
expr2stlt (const namespacet &ns) | |
Creates a new instance of the converter. More... | |
std::string | convert (const exprt &expr) |
Invokes the conversion process for the given expression and calls itself recursively in the process. More... | |
Private Member Functions | |
void | convert (const and_exprt &expr) |
Converts the given AND expression to human-readable STL code. More... | |
void | convert (const or_exprt &expr) |
Converts the given OR expression to human-readable STL code. More... | |
void | convert (const xor_exprt &expr) |
Converts the given XOR expression to human-readable STL code. More... | |
void | convert (const notequal_exprt &expr) |
Converts the given notequal (!=) expression to human-readable STL code. More... | |
void | convert (const equal_exprt &expr) |
Converts the given equal (==) expression to human-readable STL code. More... | |
void | convert (const not_exprt &expr) |
Converts the given NOT expression to human-readable STL code. More... | |
void | convert (const symbol_exprt &expr) |
Converts the given symbol expression to human-readable STL code. More... | |
void | convert_multiary_bool (std::vector< exprt > &operands, const char operation) |
Iterates through all the given operands and converts them depending on the operation. More... | |
void | convert_multiary_bool_operands (const std::vector< exprt > &operands, const char operation) |
Iterates through all the given operands and converts them depending on the operation. More... | |
void | convert_bool_operand (const exprt &op) |
Converts a single boolean operand and introduces an additional nesting layer if needed. More... | |
void | convert_first_non_trivial_operand (std::vector< exprt > &operands) |
Iterates through all the given operands in search for the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol). More... | |
irep_idt | id_shorthand (const irep_idt &identifier) |
Returns the given identifier in a form that is compatible with STL by looking up the symbol or cutting the scope when needed. More... | |
Private Attributes | |
bool | inside_bit_string |
Internal representation of the FC bit in STL. More... | |
bool | is_reference |
Flag to specify if the next symbol to convert is a reference to a variable. More... | |
const namespacet & | ns |
Contains the symbol table of the current program to convert. More... | |
std::stringstream | result |
Used for saving intermediate results of the conversion process. More... | |
Class for saving the internal state of the conversion process.
Definition at line 40 of file expr2statement_list.h.
|
explicit |
Creates a new instance of the converter.
ns | Namespace containing the symbols of the program to convert. |
Definition at line 123 of file expr2statement_list.cpp.
|
private |
Converts the given AND expression to human-readable STL code.
If the expression marks the beginning of a bit string, the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol) is being converted first. This reduces nesting.
expr | AND expression to convert. |
Definition at line 154 of file expr2statement_list.cpp.
|
private |
Converts the given equal (==) expression to human-readable STL code.
If the expression marks the beginning of a bit string, the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol) is being converted first. This reduces nesting.
expr | Equal expression to convert. |
Definition at line 178 of file expr2statement_list.cpp.
std::string expr2stlt::convert | ( | const exprt & | expr | ) |
Invokes the conversion process for the given expression and calls itself recursively in the process.
expr | Expression to convert. Operands of this expression will be converted as well via recursion. |
Definition at line 128 of file expr2statement_list.cpp.
|
private |
Converts the given NOT expression to human-readable STL code.
This function may only be called in the case of a new bit string. If the NOT expression wraps a symbol it is negated and loaded on the RLO via a simple AN instruction. In the case of a more complex expression, the expression is being converted first and negated afterwards.
expr | Not expression to convert. |
Definition at line 185 of file expr2statement_list.cpp.
|
private |
Converts the given notequal (!=) expression to human-readable STL code.
If the expression marks the beginning of a bit string, the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol) is being converted first. This reduces nesting.
expr | Notequal expression to convert. |
Definition at line 172 of file expr2statement_list.cpp.
|
private |
Converts the given OR expression to human-readable STL code.
If the expression marks the beginning of a bit string, the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol) is being converted first. This reduces nesting.
expr | OR expression to convert. |
Definition at line 160 of file expr2statement_list.cpp.
|
private |
Converts the given symbol expression to human-readable STL code.
This function also checks if the symbol should be a reference and adds the additional code if needed.
expr | Symbol expression to convert. |
Definition at line 207 of file expr2statement_list.cpp.
|
private |
Converts the given XOR expression to human-readable STL code.
If the expression marks the beginning of a bit string, the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol) is being converted first. This reduces nesting.
expr | XOR expression to convert. |
Definition at line 166 of file expr2statement_list.cpp.
|
private |
Converts a single boolean operand and introduces an additional nesting layer if needed.
Definition at line 249 of file expr2statement_list.cpp.
|
private |
Iterates through all the given operands in search for the first non-trivial operand (that encloses all expressions which are not a symbol or a negation of a symbol).
If found, removes the operand from the list and converts it first. This is used to avoid unnecessary nesting.
[out] | operands | List of operands. Gets modified by this function if it includes a non-trivial operand. |
Definition at line 267 of file expr2statement_list.cpp.
|
private |
Iterates through all the given operands and converts them depending on the operation.
Performs a simplification by rearranging the operands if appropriate.
[out] | operands | Operands of any multiary instruction. |
operation | Character specifying the operation in STL. |
Definition at line 217 of file expr2statement_list.cpp.
|
private |
Iterates through all the given operands and converts them depending on the operation.
operands | Operands of any multiary instruction. |
operation | Character specifying the operation in STL. |
Definition at line 230 of file expr2statement_list.cpp.
Returns the given identifier in a form that is compatible with STL by looking up the symbol or cutting the scope when needed.
identifier | Identifier that should be converted. |
Definition at line 291 of file expr2statement_list.cpp.
|
private |
Internal representation of the FC bit in STL.
Used to track if the current boolean operation is part of another.
Definition at line 44 of file expr2statement_list.h.
|
private |
Flag to specify if the next symbol to convert is a reference to a variable.
Definition at line 48 of file expr2statement_list.h.
|
private |
Contains the symbol table of the current program to convert.
Definition at line 51 of file expr2statement_list.h.
|
private |
Used for saving intermediate results of the conversion process.
Definition at line 54 of file expr2statement_list.h.