docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
utils.h File Reference

Utility functions for working with types. More...

#include <cassert>
#include <memory>
#include <unordered_map>
#include <vector>
#include "sdfg/function.h"
#include "sdfg/structured_sdfg.h"
#include "sdfg/symbolic/symbolic.h"
#include "sdfg/types/structure.h"
#include "sdfg/types/type.h"

Go to the source code of this file.

Namespaces

namespace  sdfg
namespace  sdfg::data_flow
namespace  sdfg::types

Functions

std::unique_ptr< types::IType > sdfg::types::infer_type (const sdfg::Function &function, const types::IType &type, const data_flow::Subset &subset)
 Infers the type resulting from accessing a subset of data.
std::unique_ptr< types::IType > sdfg::types::recombine_array_type (const types::IType &type, uint depth, const types::IType &inner_type)
 Reconstructs an array type with a new inner element type.
const IType & sdfg::types::peel_to_innermost_element (const IType &type, int follow_ptr=PEEL_TO_INNERMOST_ELEMENT_FOLLOW_ONLY_OUTER_PTR)
 Returns the innermost element type of a (potentially multi-dimensional) array.
symbolic::Expression sdfg::types::get_contiguous_element_size (const types::IType &type, bool allow_comp_time_eval=true)
 Returns the size in bytes of one contiguous element.
symbolic::Expression sdfg::types::get_type_size (const types::IType &type, bool allow_comp_time_eval=true)
 Returns the size of a type in bytes.
const types::IType * sdfg::types::peel_to_next_element (const types::IType &type)
 Returns the next element type inside an array/pointer/reference.
bool sdfg::types::is_contiguous_type (const types::IType &type, StructuredSDFG &sdfg)
 Checks if a type is contiguous in memory.
PrimitiveType sdfg::types::get_primitive_type_to_hold_upper_bound (const symbolic::Expression &expr)
 Return a good primitive type that can hold the expressions maximum value.
PrimitiveType sdfg::types::get_primitive_type_to_hold_lower_bound (const symbolic::Expression &expr)
 Return a good primitive type that can hold the expressions minimum value.
PrimitiveType sdfg::types::get_primitive_type_to_hold (PrimitiveType a, PrimitiveType b)
 Return the primitive type that can hold the contents of both a and b without any risk of loss (respecting C-style signed-overflow is undefined and need not be considered.

Variables

constexpr int sdfg::types::PEEL_TO_INNERMOST_ELEMENT_FOLLOW_ONLY_OUTER_PTR = -100
 Special value indicating to follow only an outermost pointer when peeling.

Detailed Description

Utility functions for working with types.

This file provides various utility functions for type manipulation, inspection, and analysis including type inference, size calculation, and type decomposition.