tan  0.0.1
tanlang::Intrinsic Class Reference

A generic representation of Intrinsic variables/functions. More...

#include <intrinsic.h>

Inheritance diagram for tanlang::Intrinsic:
Collaboration diagram for tanlang::Intrinsic:

Public Member Functions

IntrinsicType get_intrinsic_type () const
 
void set_intrinsic_type (IntrinsicType intrinsic_type)
 
ASTBaseget_sub () const
 
void set_sub (ASTBase *sub)
 
vector< ASTBase * > get_children () const override
 Get a ordered list of child nodes. More...
 
str terminal_token () const override
 Which terminal token is expected immediately after this node. More...
 
- Public Member Functions inherited from tanlang::Expr
virtual bool is_comptime_known ()
 
virtual bool is_lvalue ()
 
virtual void set_lvalue (bool is_lvalue)
 
bool is_expr () const override
 
bool is_stmt () const override
 
- Public Member Functions inherited from tanlang::ASTBase
 ASTBase (ASTNodeType node_type, TokenizedSourceFile *src, int bp)
 
ASTNodeType get_node_type () const
 
void set_node_type (ASTNodeType node_type)
 
int get_bp () const
 
Contextctx ()
 
str repr (const str &prefix="-") const
 AST tree string representation. More...
 
- Public Member Functions inherited from tanlang::SourceTraceable
 SourceTraceable (TokenizedSourceFile *src)
 
uint32_t start () const
 
uint32_t end () const
 
void set_start (uint32_t val)
 
void set_end (uint32_t val)
 
TokenizedSourceFilesrc () const
 
- Public Member Functions inherited from tanlang::Typed
virtual Typeget_type () const
 
virtual void set_type (Type *type)
 
- Public Member Functions inherited from tanlang::ASTNamed
str get_name () const
 
void set_name (const str &name)
 

Static Public Member Functions

static IntrinsicCreate (TokenizedSourceFile *src)
 
static vector< FunctionDecl * > GetIntrinsicFunctionDeclarations ()
 Generate a list of intrinsics function prototypes/declarations, such as @abort More...
 

Static Public Attributes

static umap< str, IntrinsicType > INTRINSIC_NAME_TO_TYPES
 A mapping from intrinsic names to IntrinsicType. More...
 
static const str STACK_TRACE_FUNCTION_REAL_NAME = "__tan_runtime_stack_trace"
 
static const str TEST_COMP_ERROR_NAME = "test_comp_error"
 
static const str ABORT_NAME = "abort"
 
static const str COMP_PRINT_NAME = "compprint"
 
- Static Public Attributes inherited from tanlang::ASTBase
static umap< ASTNodeType, str > ASTTypeNames
 string representation of ASTNodeType More...
 
static umap< ASTNodeType, int > OpPrecedence
 operator precedence of tokens More...
 

Protected Member Functions

 Intrinsic (TokenizedSourceFile *src)
 
- Protected Member Functions inherited from tanlang::Expr
 Expr (ASTNodeType type, TokenizedSourceFile *src, int bp)
 
- Protected Member Functions inherited from tanlang::ASTBase
virtual str to_string (bool include_source_code=false) const
 Different from repr, to_string output doesn't include child nodes. More...
 
virtual ASTBaseget () const
 Get the "actual" this. Used for implementing proxy classes. More...
 

Additional Inherited Members

- Protected Attributes inherited from tanlang::Expr
bool _is_lvalue = false
 

Detailed Description

A generic representation of Intrinsic variables/functions.

Definition at line 55 of file intrinsic.h.

Member Function Documentation

◆ get_children()

vector< ASTBase * > tanlang::Intrinsic::get_children ( ) const
overridevirtual

Get a ordered list of child nodes.

Reimplemented from tanlang::Expr.

Definition at line 67 of file intrinsic.cpp.

References tanlang::ASTBase::get_children().

◆ GetIntrinsicFunctionDeclarations()

vector< FunctionDecl * > tanlang::Intrinsic::GetIntrinsicFunctionDeclarations ( )
static

Generate a list of intrinsics function prototypes/declarations, such as @abort

Definition at line 35 of file intrinsic.cpp.

Referenced by tanlang::CompilerDriver::parse().

◆ terminal_token()

str tanlang::Intrinsic::terminal_token ( ) const
overridevirtual

Which terminal token is expected immediately after this node.

Reimplemented from tanlang::ASTBase.

Definition at line 74 of file intrinsic.cpp.

Member Data Documentation

◆ INTRINSIC_NAME_TO_TYPES

umap< str, IntrinsicType > tanlang::Intrinsic::INTRINSIC_NAME_TO_TYPES
static
Initial value:
{
{"asm", IntrinsicType::ASM },
{"swap", IntrinsicType::SWAP },
{"memset", IntrinsicType::MEMSET },
{"memcpy", IntrinsicType::MEMCPY },
{"range", IntrinsicType::RANGE },
{COMP_PRINT_NAME, IntrinsicType::COMP_PRINT },
{"file", IntrinsicType::FILENAME },
{"line", IntrinsicType::LINENO },
{"define", IntrinsicType::DEFINE },
{"sizeof", IntrinsicType::SIZE_OF },
{"offsetof", IntrinsicType::OFFSET_OF },
{"isa", IntrinsicType::ISA },
{"alignof", IntrinsicType::ALIGN_OF },
{"min_of", IntrinsicType::MIN_OF },
{"max_of", IntrinsicType::MAX_OF },
{"is_unsigned", IntrinsicType::IS_UNSIGNED },
{"unlikely", IntrinsicType::UNLIKELY },
{"likely", IntrinsicType::LIKELY },
{"expect", IntrinsicType::EXPECT },
{"noop", IntrinsicType::NOOP },
{"get_decl", IntrinsicType::GET_DECL },
{TEST_COMP_ERROR_NAME, IntrinsicType::TEST_COMP_ERROR},
{ABORT_NAME, IntrinsicType::ABORT },
{"stack_trace", IntrinsicType::STACK_TRACE },
{STACK_TRACE_FUNCTION_REAL_NAME, IntrinsicType::STACK_TRACE }
}

A mapping from intrinsic names to IntrinsicType.

Definition at line 65 of file intrinsic.h.


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