Halide  12.0.1
Halide compiler and libraries
Halide::Internal::CodeGen_C Class Reference

This class emits C++ code equivalent to a halide Stmt. More...

#include <CodeGen_C.h>

Inherits Halide::Internal::IRPrinter.

Classes

struct  Allocation
 

Public Types

enum  OutputKind {
  CHeader , CPlusPlusHeader , CImplementation , CPlusPlusImplementation ,
  CExternDecl , CPlusPlusExternDecl
}
 

Public Member Functions

 CodeGen_C (std::ostream &dest, const Target &target, OutputKind output_kind=CImplementation, const std::string &include_guard="")
 Initialize a C code generator pointing at a particular output stream (e.g. More...
 
 ~CodeGen_C () override
 
void compile (const Module &module)
 Emit the declarations contained in the module as C code. More...
 
const Targetget_target () const
 The target we're generating code for. More...
 
- Public Member Functions inherited from Halide::Internal::IRPrinter
 IRPrinter (std::ostream &)
 Construct an IRPrinter pointed at a given output stream (e.g. More...
 
void print (const Expr &)
 emit an expression on the output stream More...
 
void print_no_parens (const Expr &)
 Emit an expression on the output stream without enclosing parens. More...
 
void print (const Stmt &)
 emit a statement on the output stream More...
 
void print_list (const std::vector< Expr > &exprs)
 emit a comma delimited list of exprs, without any leading or trailing punctuation. More...
 
- Public Member Functions inherited from Halide::Internal::IRVisitor
 IRVisitor ()=default
 
virtual ~IRVisitor ()=default
 

Static Public Member Functions

static void test ()
 
- Static Public Member Functions inherited from Halide::Internal::IRPrinter
static void test ()
 

Protected Types

enum class  IntegerSuffixStyle { PlainC = 0 , OpenCL = 1 , HLSL = 2 }
 
enum  AppendSpaceIfNeeded { DoNotAppendSpace , AppendSpace }
 

Protected Member Functions

virtual void compile (const LoweredFunc &func)
 Emit a declaration. More...
 
virtual void compile (const Buffer<> &buffer)
 
std::string print_expr (const Expr &)
 Emit an expression as an assignment, then return the id of the resulting var. More...
 
std::string print_cast_expr (const Type &, const Expr &)
 Like print_expr, but cast the Expr to the given Type. More...
 
void print_stmt (const Stmt &)
 Emit a statement. More...
 
void create_assertion (const std::string &id_cond, const Expr &message)
 
void create_assertion (const Expr &cond, const Expr &message)
 
Expr scalarize_vector_reduce (const VectorReduce *op)
 
virtual std::string print_type (Type, AppendSpaceIfNeeded space_option=DoNotAppendSpace)
 Emit the C name for a halide type. More...
 
virtual std::string print_reinterpret (Type, const Expr &)
 Emit a statement to reinterpret an expression as another type. More...
 
virtual std::string print_name (const std::string &)
 Emit a version of a string that is a valid identifier in C (. More...
 
virtual void add_vector_typedefs (const std::set< Type > &vector_types)
 Add typedefs for vector types. More...
 
virtual std::string print_extern_call (const Call *op)
 Bottleneck to allow customization of calls to generic Extern/PureExtern calls. More...
 
std::string print_scalarized_expr (const Expr &e)
 Convert a vector Expr into a series of scalar Exprs, then reassemble into vector of original type. More...
 
virtual std::string print_assignment (Type t, const std::string &rhs)
 Emit an SSA-style assignment, and set id to the freshly generated name. More...
 
void print_heap_free (const std::string &alloc_name)
 Emit free for the heap allocation. More...
 
bool is_header ()
 Return true if only generating an interface, which may be extern "C" or C++. More...
 
bool is_extern_decl ()
 Return true if only generating an interface, which may be extern "C" or C++. More...
 
bool is_header_or_extern_decl ()
 Return true if only generating an interface, which may be extern "C" or C++. More...
 
bool is_c_plus_plus_interface ()
 Return true if generating C++ linkage. More...
 
void open_scope ()
 Open a new C scope (i.e. More...
 
void close_scope (const std::string &comment)
 Close a C scope (i.e. More...
 
void forward_declare_type_if_needed (const Type &t)
 If the Type is a handle type, emit a forward-declaration for it if we haven't already. More...
 
void set_name_mangling_mode (NameMangling mode)
 
void visit (const Variable *) override
 
void visit (const IntImm *) override
 
void visit (const UIntImm *) override
 
void visit (const StringImm *) override
 
void visit (const FloatImm *) override
 
void visit (const Cast *) override
 
void visit (const Add *) override
 
void visit (const Sub *) override
 
void visit (const Mul *) override
 
void visit (const Div *) override
 
void visit (const Mod *) override
 
void visit (const Max *) override
 
void visit (const Min *) override
 
void visit (const EQ *) override
 
void visit (const NE *) override
 
void visit (const LT *) override
 
void visit (const LE *) override
 
void visit (const GT *) override
 
void visit (const GE *) override
 
void visit (const And *) override
 
void visit (const Or *) override
 
void visit (const Not *) override
 
void visit (const Call *) override
 
void visit (const Select *) override
 
void visit (const Load *) override
 
void visit (const Store *) override
 
void visit (const Let *) override
 
void visit (const LetStmt *) override
 
void visit (const AssertStmt *) override
 
void visit (const ProducerConsumer *) override
 
void visit (const For *) override
 
void visit (const Ramp *) override
 
void visit (const Broadcast *) override
 
void visit (const Provide *) override
 
void visit (const Allocate *) override
 
void visit (const Free *) override
 
void visit (const Realize *) override
 
void visit (const IfThenElse *) override
 
void visit (const Evaluate *) override
 
void visit (const Shuffle *) override
 
void visit (const Prefetch *) override
 
void visit (const Fork *) override
 
void visit (const Acquire *) override
 
void visit (const Atomic *) override
 
void visit (const VectorReduce *) override
 
void visit_binop (Type t, const Expr &a, const Expr &b, const char *op)
 
void visit_relop (Type t, const Expr &a, const Expr &b, const char *scalar_op, const char *vector_op)
 
void visit (const IntImm *) override
 
void visit (const UIntImm *) override
 
void visit (const FloatImm *) override
 
void visit (const StringImm *) override
 
void visit (const Cast *) override
 
void visit (const Variable *) override
 
void visit (const Add *) override
 
void visit (const Sub *) override
 
void visit (const Mul *) override
 
void visit (const Div *) override
 
void visit (const Mod *) override
 
void visit (const Min *) override
 
void visit (const Max *) override
 
void visit (const EQ *) override
 
void visit (const NE *) override
 
void visit (const LT *) override
 
void visit (const LE *) override
 
void visit (const GT *) override
 
void visit (const GE *) override
 
void visit (const And *) override
 
void visit (const Or *) override
 
void visit (const Not *) override
 
void visit (const Select *) override
 
void visit (const Load *) override
 
void visit (const Ramp *) override
 
void visit (const Broadcast *) override
 
void visit (const Call *) override
 
void visit (const Let *) override
 
void visit (const LetStmt *) override
 
void visit (const AssertStmt *) override
 
void visit (const ProducerConsumer *) override
 
void visit (const For *) override
 
void visit (const Acquire *) override
 
void visit (const Store *) override
 
void visit (const Provide *) override
 
void visit (const Allocate *) override
 
void visit (const Free *) override
 
void visit (const Realize *) override
 
void visit (const Block *) override
 
void visit (const Fork *) override
 
void visit (const IfThenElse *) override
 
void visit (const Evaluate *) override
 
void visit (const Shuffle *) override
 
void visit (const VectorReduce *) override
 
void visit (const Prefetch *) override
 
void visit (const Atomic *) override
 
- Protected Member Functions inherited from Halide::Internal::IRPrinter
Indentation get_indent () const
 
void open ()
 Either emits "(" or "", depending on the value of implicit_parens. More...
 
void close ()
 Either emits ")" or "", depending on the value of implicit_parens. More...
 
void print_lets (const Let *let)
 A helper for printing a chain of lets with line breaks. More...
 
void visit (const IntImm *) override
 
void visit (const UIntImm *) override
 
void visit (const FloatImm *) override
 
void visit (const StringImm *) override
 
void visit (const Cast *) override
 
void visit (const Variable *) override
 
void visit (const Add *) override
 
void visit (const Sub *) override
 
void visit (const Mul *) override
 
void visit (const Div *) override
 
void visit (const Mod *) override
 
void visit (const Min *) override
 
void visit (const Max *) override
 
void visit (const EQ *) override
 
void visit (const NE *) override
 
void visit (const LT *) override
 
void visit (const LE *) override
 
void visit (const GT *) override
 
void visit (const GE *) override
 
void visit (const And *) override
 
void visit (const Or *) override
 
void visit (const Not *) override
 
void visit (const Select *) override
 
void visit (const Load *) override
 
void visit (const Ramp *) override
 
void visit (const Broadcast *) override
 
void visit (const Call *) override
 
void visit (const Let *) override
 
void visit (const LetStmt *) override
 
void visit (const AssertStmt *) override
 
void visit (const ProducerConsumer *) override
 
void visit (const For *) override
 
void visit (const Acquire *) override
 
void visit (const Store *) override
 
void visit (const Provide *) override
 
void visit (const Allocate *) override
 
void visit (const Free *) override
 
void visit (const Realize *) override
 
void visit (const Block *) override
 
void visit (const Fork *) override
 
void visit (const IfThenElse *) override
 
void visit (const Evaluate *) override
 
void visit (const Shuffle *) override
 
void visit (const VectorReduce *) override
 
void visit (const Prefetch *) override
 
void visit (const Atomic *) override
 

Static Protected Member Functions

template<typename T >
static std::string with_sep (const std::vector< T > &v, const std::string &sep)
 
template<typename T >
static std::string with_commas (const std::vector< T > &v)
 

Protected Attributes

IntegerSuffixStyle integer_suffix_style = IntegerSuffixStyle::PlainC
 How to emit 64-bit integer constants. More...
 
std::string id
 An ID for the most recently generated ssa variable. More...
 
Target target
 The target being generated for. More...
 
OutputKind output_kind
 Controls whether this instance is generating declarations or definitions and whether the interface us extern "C" or C++. More...
 
std::map< std::string, std::string > cache
 A cache of generated values in scope. More...
 
Scope< Allocationallocations
 Track the types of allocations to avoid unnecessary casts. More...
 
Scope heap_allocations
 Track which allocations actually went on the heap. More...
 
bool have_user_context
 True if there is a void * __user_context parameter in the arguments. More...
 
bool extern_c_open
 Track current calling convention scope. More...
 
bool uses_gpu_for_loops
 True if at least one gpu-based for loop is used. More...
 
std::set< const halide_handle_cplusplus_type * > forward_declared
 Track which handle types have been forward-declared already. More...
 
bool inside_atomic_mutex_node
 Are we inside an atomic node that uses mutex locks? This is used for detecting deadlocks from nested atomics. More...
 
bool emit_atomic_stores
 Emit atomic store instructions? More...
 
bool using_vector_typedefs
 true if add_vector_typedefs() has been called. More...
 
- Protected Attributes inherited from Halide::Internal::IRPrinter
std::ostream & stream
 The stream on which we're outputting. More...
 
int indent = 0
 The current indentation level, useful for pretty-printing statements. More...
 
bool implicit_parens = false
 Certain expressions do not need parens around them, e.g. More...
 
Scope known_type
 The symbols whose types can be inferred from values printed already. More...
 

Detailed Description

This class emits C++ code equivalent to a halide Stmt.

It's mostly the same as an IRPrinter, but it's wrapped in a function definition, and some things are handled differently to be valid C++.

Definition at line 27 of file CodeGen_C.h.

Member Enumeration Documentation

◆ OutputKind

Enumerator
CHeader 
CPlusPlusHeader 
CImplementation 
CPlusPlusImplementation 
CExternDecl 
CPlusPlusExternDecl 

Definition at line 29 of file CodeGen_C.h.

◆ IntegerSuffixStyle

Enumerator
PlainC 
OpenCL 
HLSL 

Definition at line 57 of file CodeGen_C.h.

◆ AppendSpaceIfNeeded

Enumerator
DoNotAppendSpace 
AppendSpace 

Definition at line 99 of file CodeGen_C.h.

Constructor & Destructor Documentation

◆ CodeGen_C()

Halide::Internal::CodeGen_C::CodeGen_C ( std::ostream &  dest,
const Target target,
OutputKind  output_kind = CImplementation,
const std::string &  include_guard = "" 
)

Initialize a C code generator pointing at a particular output stream (e.g.

a file, or std::cout)

◆ ~CodeGen_C()

Halide::Internal::CodeGen_C::~CodeGen_C ( )
override

Member Function Documentation

◆ compile() [1/3]

void Halide::Internal::CodeGen_C::compile ( const Module module)

Emit the declarations contained in the module as C code.

◆ get_target()

const Target& Halide::Internal::CodeGen_C::get_target ( ) const
inline

The target we're generating code for.

Definition at line 50 of file CodeGen_C.h.

References target.

◆ test()

static void Halide::Internal::CodeGen_C::test ( )
static

◆ compile() [2/3]

virtual void Halide::Internal::CodeGen_C::compile ( const LoweredFunc func)
protectedvirtual

Emit a declaration.

◆ compile() [3/3]

virtual void Halide::Internal::CodeGen_C::compile ( const Buffer<> &  buffer)
protectedvirtual

◆ print_expr()

std::string Halide::Internal::CodeGen_C::print_expr ( const Expr )
protected

Emit an expression as an assignment, then return the id of the resulting var.

◆ print_cast_expr()

std::string Halide::Internal::CodeGen_C::print_cast_expr ( const Type ,
const Expr  
)
protected

Like print_expr, but cast the Expr to the given Type.

◆ print_stmt()

void Halide::Internal::CodeGen_C::print_stmt ( const Stmt )
protected

Emit a statement.

◆ create_assertion() [1/2]

void Halide::Internal::CodeGen_C::create_assertion ( const std::string &  id_cond,
const Expr message 
)
protected

◆ create_assertion() [2/2]

void Halide::Internal::CodeGen_C::create_assertion ( const Expr cond,
const Expr message 
)
protected

◆ scalarize_vector_reduce()

Expr Halide::Internal::CodeGen_C::scalarize_vector_reduce ( const VectorReduce op)
protected

◆ print_type()

virtual std::string Halide::Internal::CodeGen_C::print_type ( Type  ,
AppendSpaceIfNeeded  space_option = DoNotAppendSpace 
)
protectedvirtual

Emit the C name for a halide type.

If space_option is AppendSpace, and there should be a space between the type and the next token, one is appended. (This allows both "int foo" and "Foo *foo" to be formatted correctly. Otherwise the latter is "Foo * foo".)

◆ print_reinterpret()

virtual std::string Halide::Internal::CodeGen_C::print_reinterpret ( Type  ,
const Expr  
)
protectedvirtual

Emit a statement to reinterpret an expression as another type.

◆ print_name()

virtual std::string Halide::Internal::CodeGen_C::print_name ( const std::string &  )
protectedvirtual

Emit a version of a string that is a valid identifier in C (.

is replaced with _)

◆ add_vector_typedefs()

virtual void Halide::Internal::CodeGen_C::add_vector_typedefs ( const std::set< Type > &  vector_types)
protectedvirtual

Add typedefs for vector types.

Not needed for OpenCL, might use different syntax for other C-like languages.

◆ print_extern_call()

virtual std::string Halide::Internal::CodeGen_C::print_extern_call ( const Call op)
protectedvirtual

Bottleneck to allow customization of calls to generic Extern/PureExtern calls.


◆ print_scalarized_expr()

std::string Halide::Internal::CodeGen_C::print_scalarized_expr ( const Expr e)
protected

Convert a vector Expr into a series of scalar Exprs, then reassemble into vector of original type.


◆ print_assignment()

virtual std::string Halide::Internal::CodeGen_C::print_assignment ( Type  t,
const std::string &  rhs 
)
protectedvirtual

Emit an SSA-style assignment, and set id to the freshly generated name.

Return id.

◆ print_heap_free()

void Halide::Internal::CodeGen_C::print_heap_free ( const std::string &  alloc_name)
protected

Emit free for the heap allocation.

◆ is_header()

bool Halide::Internal::CodeGen_C::is_header ( )
inlineprotected

Return true if only generating an interface, which may be extern "C" or C++.

Definition at line 134 of file CodeGen_C.h.

References CHeader, CPlusPlusHeader, and output_kind.

Referenced by is_header_or_extern_decl().

◆ is_extern_decl()

bool Halide::Internal::CodeGen_C::is_extern_decl ( )
inlineprotected

Return true if only generating an interface, which may be extern "C" or C++.

Definition at line 140 of file CodeGen_C.h.

References CExternDecl, CPlusPlusExternDecl, and output_kind.

Referenced by is_header_or_extern_decl().

◆ is_header_or_extern_decl()

bool Halide::Internal::CodeGen_C::is_header_or_extern_decl ( )
inlineprotected

Return true if only generating an interface, which may be extern "C" or C++.

Definition at line 146 of file CodeGen_C.h.

References is_extern_decl(), and is_header().

◆ is_c_plus_plus_interface()

bool Halide::Internal::CodeGen_C::is_c_plus_plus_interface ( )
inlineprotected

Return true if generating C++ linkage.

Definition at line 151 of file CodeGen_C.h.

References CPlusPlusExternDecl, CPlusPlusHeader, CPlusPlusImplementation, and output_kind.

◆ open_scope()

void Halide::Internal::CodeGen_C::open_scope ( )
protected

Open a new C scope (i.e.

throw in a brace, increase the indent)

◆ close_scope()

void Halide::Internal::CodeGen_C::close_scope ( const std::string &  comment)
protected

Close a C scope (i.e.

throw in an end brace, decrease the indent)

◆ forward_declare_type_if_needed()

void Halide::Internal::CodeGen_C::forward_declare_type_if_needed ( const Type t)
protected

If the Type is a handle type, emit a forward-declaration for it if we haven't already.

◆ set_name_mangling_mode()

void Halide::Internal::CodeGen_C::set_name_mangling_mode ( NameMangling  mode)
protected

◆ visit() [1/91]

void Halide::Internal::CodeGen_C::visit ( const Variable )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [2/91]

void Halide::Internal::CodeGen_C::visit ( const IntImm )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [3/91]

void Halide::Internal::CodeGen_C::visit ( const UIntImm )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [4/91]

void Halide::Internal::CodeGen_C::visit ( const StringImm )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [5/91]

void Halide::Internal::CodeGen_C::visit ( const FloatImm )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [6/91]

void Halide::Internal::CodeGen_C::visit ( const Cast )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [7/91]

void Halide::Internal::CodeGen_C::visit ( const Add )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [8/91]

void Halide::Internal::CodeGen_C::visit ( const Sub )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [9/91]

void Halide::Internal::CodeGen_C::visit ( const Mul )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [10/91]

void Halide::Internal::CodeGen_C::visit ( const Div )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [11/91]

void Halide::Internal::CodeGen_C::visit ( const Mod )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [12/91]

void Halide::Internal::CodeGen_C::visit ( const Max )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [13/91]

void Halide::Internal::CodeGen_C::visit ( const Min )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [14/91]

void Halide::Internal::CodeGen_C::visit ( const EQ )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [15/91]

void Halide::Internal::CodeGen_C::visit ( const NE )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [16/91]

void Halide::Internal::CodeGen_C::visit ( const LT )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [17/91]

void Halide::Internal::CodeGen_C::visit ( const LE )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [18/91]

void Halide::Internal::CodeGen_C::visit ( const GT )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [19/91]

void Halide::Internal::CodeGen_C::visit ( const GE )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [20/91]

void Halide::Internal::CodeGen_C::visit ( const And )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [21/91]

void Halide::Internal::CodeGen_C::visit ( const Or )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [22/91]

void Halide::Internal::CodeGen_C::visit ( const Not )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [23/91]

void Halide::Internal::CodeGen_C::visit ( const Call )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [24/91]

void Halide::Internal::CodeGen_C::visit ( const Select )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [25/91]

void Halide::Internal::CodeGen_C::visit ( const Load )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [26/91]

void Halide::Internal::CodeGen_C::visit ( const Store )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [27/91]

void Halide::Internal::CodeGen_C::visit ( const Let )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [28/91]

void Halide::Internal::CodeGen_C::visit ( const LetStmt )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [29/91]

void Halide::Internal::CodeGen_C::visit ( const AssertStmt )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [30/91]

void Halide::Internal::CodeGen_C::visit ( const ProducerConsumer )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [31/91]

void Halide::Internal::CodeGen_C::visit ( const For )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [32/91]

void Halide::Internal::CodeGen_C::visit ( const Ramp )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [33/91]

void Halide::Internal::CodeGen_C::visit ( const Broadcast )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [34/91]

void Halide::Internal::CodeGen_C::visit ( const Provide )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [35/91]

void Halide::Internal::CodeGen_C::visit ( const Allocate )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [36/91]

void Halide::Internal::CodeGen_C::visit ( const Free )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [37/91]

void Halide::Internal::CodeGen_C::visit ( const Realize )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [38/91]

void Halide::Internal::CodeGen_C::visit ( const IfThenElse )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [39/91]

void Halide::Internal::CodeGen_C::visit ( const Evaluate )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [40/91]

void Halide::Internal::CodeGen_C::visit ( const Shuffle )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [41/91]

void Halide::Internal::CodeGen_C::visit ( const Prefetch )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [42/91]

void Halide::Internal::CodeGen_C::visit ( const Fork )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [43/91]

void Halide::Internal::CodeGen_C::visit ( const Acquire )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [44/91]

void Halide::Internal::CodeGen_C::visit ( const Atomic )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit() [45/91]

void Halide::Internal::CodeGen_C::visit ( const VectorReduce )
overrideprotectedvirtual

Reimplemented from Halide::Internal::IRVisitor.

◆ visit_binop()

void Halide::Internal::CodeGen_C::visit_binop ( Type  t,
const Expr a,
const Expr b,
const char *  op 
)
protected

◆ visit_relop()

void Halide::Internal::CodeGen_C::visit_relop ( Type  t,
const Expr a,
const Expr b,
const char *  scalar_op,
const char *  vector_op 
)
protected

◆ with_sep()

template<typename T >
static std::string Halide::Internal::CodeGen_C::with_sep ( const std::vector< T > &  v,
const std::string &  sep 
)
inlinestaticprotected

Definition at line 243 of file CodeGen_C.h.

◆ with_commas()

template<typename T >
static std::string Halide::Internal::CodeGen_C::with_commas ( const std::vector< T > &  v)
inlinestaticprotected

Definition at line 255 of file CodeGen_C.h.

◆ visit() [46/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [47/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [48/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [49/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [50/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [51/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [52/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [53/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [54/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [55/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [56/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [57/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [58/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [59/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [60/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [61/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [62/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [63/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [64/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [65/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [66/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [67/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [68/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [69/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [70/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [71/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [72/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [73/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [74/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [75/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [76/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [77/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [78/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [79/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [80/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [81/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [82/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [83/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [84/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [85/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [86/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [87/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [88/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [89/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [90/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

◆ visit() [91/91]

void Halide::Internal::IRPrinter::visit
overrideprotected

Member Data Documentation

◆ integer_suffix_style

IntegerSuffixStyle Halide::Internal::CodeGen_C::integer_suffix_style = IntegerSuffixStyle::PlainC
protected

How to emit 64-bit integer constants.

Definition at line 64 of file CodeGen_C.h.

◆ id

std::string Halide::Internal::CodeGen_C::id
protected

An ID for the most recently generated ssa variable.

Definition at line 73 of file CodeGen_C.h.

◆ target

Target Halide::Internal::CodeGen_C::target
protected

The target being generated for.

Definition at line 76 of file CodeGen_C.h.

Referenced by get_target().

◆ output_kind

OutputKind Halide::Internal::CodeGen_C::output_kind
protected

Controls whether this instance is generating declarations or definitions and whether the interface us extern "C" or C++.

Definition at line 80 of file CodeGen_C.h.

Referenced by is_c_plus_plus_interface(), is_extern_decl(), and is_header().

◆ cache

std::map<std::string, std::string> Halide::Internal::CodeGen_C::cache
protected

A cache of generated values in scope.

Definition at line 83 of file CodeGen_C.h.

◆ allocations

Scope<Allocation> Halide::Internal::CodeGen_C::allocations
protected

Track the types of allocations to avoid unnecessary casts.

Definition at line 168 of file CodeGen_C.h.

◆ heap_allocations

Scope Halide::Internal::CodeGen_C::heap_allocations
protected

Track which allocations actually went on the heap.

Definition at line 171 of file CodeGen_C.h.

◆ have_user_context

bool Halide::Internal::CodeGen_C::have_user_context
protected

True if there is a void * __user_context parameter in the arguments.

Definition at line 174 of file CodeGen_C.h.

◆ extern_c_open

bool Halide::Internal::CodeGen_C::extern_c_open
protected

Track current calling convention scope.

Definition at line 177 of file CodeGen_C.h.

◆ uses_gpu_for_loops

bool Halide::Internal::CodeGen_C::uses_gpu_for_loops
protected

True if at least one gpu-based for loop is used.

Definition at line 180 of file CodeGen_C.h.

◆ forward_declared

std::set<const halide_handle_cplusplus_type *> Halide::Internal::CodeGen_C::forward_declared
protected

Track which handle types have been forward-declared already.

Definition at line 183 of file CodeGen_C.h.

◆ inside_atomic_mutex_node

bool Halide::Internal::CodeGen_C::inside_atomic_mutex_node
protected

Are we inside an atomic node that uses mutex locks? This is used for detecting deadlocks from nested atomics.

Definition at line 261 of file CodeGen_C.h.

◆ emit_atomic_stores

bool Halide::Internal::CodeGen_C::emit_atomic_stores
protected

Emit atomic store instructions?

Definition at line 264 of file CodeGen_C.h.

◆ using_vector_typedefs

bool Halide::Internal::CodeGen_C::using_vector_typedefs
protected

true if add_vector_typedefs() has been called.

Definition at line 267 of file CodeGen_C.h.


The documentation for this class was generated from the following file: