Skip to content

MemoryInfoExpression

INCLUDE FILE
#include "Expression/MemoryInfoExpression.h"

class MemoryInfoExpression

Represents an expression that provides information about memory.

DEFINITION
class MemoryInfoExpression;

enum InfoType

DEFINITION
enum InfoType;
VALUEDESCRIPTION
MEMORY_SIZE
MEMORY_START
MEMORY_END

constructor MemoryInfoExpression

DEFINITION
MemoryInfoExpression ( const Location & location,
Output * output,
InfoType  info_type,
uint64_t  bank = 0 );
PARAMETERDESCRIPTION
location
output
info_type
bank

method createstatic

DEFINITION
static Expression  create ( const Location & location,
Output * output,
InfoType  info_type,
uint64_t  bank = 0 );
PARAMETERDESCRIPTION
location
output
info_type
bank
RETURNSDESCRIPTION
Expression

method evaluatevirtual

Evaluate the expression in the given context.

The default implementation calls evaluate() on all sub-expressions using traverse(), and then calls evaluate_process().

Errors during evaluation should either be reported via DiagnosticOutput and result in the expression being marked as invalid, or an exception should be thrown.

DEFINITION
virtual std::optional< Expression >  evaluate ( const EvaluationContext & context );
PARAMETERDESCRIPTION
context

The evaluation context.

RETURNSDESCRIPTION
std::optional< Expression >

The Expression to replace this expression with, {} if no replacement is needed.

method has_valueconst virtual

Check if the value of the expression is known.

The default implementation returns true if value() returns a value, false otherwise. If the value is expensive to compute, subclasses may override this method to provide a more efficient implementation.

DEFINITION
virtual bool  has_value ( ) const;
RETURNSDESCRIPTION
bool

true if the value is known, false otherwise.

method serialize_subconst virtual protected

Serialize the expression to a stream.

This method must be implemented by derived classes.

DEFINITION
virtual void  serialize_sub ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

The stream to serialize to.

method typeconst virtual

Get the type of the expression's value.

The default implementation returns the type of the value of the expression if it is known, or {} otherwise. Subclasses should override this method if they can determine the type of the expression without knowing the exact value of the expression.

DEFINITION
virtual std::optional< Value::Type >  type ( ) const;
RETURNSDESCRIPTION
std::optional< Value::Type >

The type of the expression's value if it can be determined, {} otherwise.

method valueconst virtual

Get the value of the expression if it is known.

Subclasses should override this method. The default implementation returns {}.

DEFINITION
virtual std::optional< Value >  value ( ) const;
RETURNSDESCRIPTION
std::optional< Value >

The value of the expression, if it is known.

member bankprivate

DEFINITION
uint64_t  bank;

member info_typeprivate

DEFINITION
InfoType  info_type;

member outputprivate

DEFINITION
Output * output;