Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
llvm.h File Reference
#include <llvm-c/Analysis.h>
#include <llvm-c/BitWriter.h>
#include <llvm-c/Core.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Target.h>
#include <llvm-c/TargetMachine.h>
#include <llvm-c/DebugInfo.h>
#include <llvm-c/Types.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "../ast/ast.h"
#include "../c_libs/memory/memory.h"
Include dependency graph for llvm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LLVM_Symbol
 
struct  ModuleCompilationUnit
 
struct  ModuleDependencyInfo
 
struct  DeferredStatement
 
struct  StructInfo
 
struct  CommonTypes
 
struct  CodeGenContext
 
struct  SymbolHashEntry
 
struct  SymbolHashTable
 
struct  StructHashEntry
 
struct  StructHashTable
 

Macros

#define SYMBOL_HASH_SIZE   1024
 
#define MAX_LINK_LIBS   64
 

Typedefs

typedef struct LLVM_Symbol LLVM_Symbol
 
typedef struct CodeGenContext CodeGenContext
 
typedef struct ModuleCompilationUnit ModuleCompilationUnit
 
typedef struct ModuleDependencyInfo ModuleDependencyInfo
 
typedef struct DeferredStatement DeferredStatement
 
typedef struct StructInfo StructInfo
 
typedef struct CommonTypes CommonTypes
 
typedef struct SymbolHashEntry SymbolHashEntry
 
typedef struct SymbolHashTable SymbolHashTable
 
typedef struct StructHashEntry StructHashEntry
 
typedef struct StructHashTable StructHashTable
 

Functions

ModuleCompilationUnitcreate_module_unit (CodeGenContext *ctx, const char *module_name)
 
ModuleCompilationUnitfind_module (CodeGenContext *ctx, const char *module_name)
 
void set_current_module (CodeGenContext *ctx, ModuleCompilationUnit *module)
 
bool compile_modules_to_objects (CodeGenContext *ctx, const char *output_dir)
 
void generate_external_declarations (CodeGenContext *ctx, ModuleCompilationUnit *target_module)
 
void preprocess_all_modules (CodeGenContext *ctx)
 
StructInfofind_struct_type_fast (CodeGenContext *ctx, const char *name)
 
void cleanup_module_caches (void)
 
void debug_object_files (const char *output_dir)
 
StructInfofind_concrete_struct_for_base (CodeGenContext *ctx, StructInfo *base_info, const char *field_name)
 
unsigned int hash_string (const char *str)
 
void init_symbol_cache (void)
 
void cache_symbol (const char *module_name, const char *symbol_name, LLVM_Symbol *symbol)
 
LLVM_Symbollookup_cached_symbol (const char *module_name, const char *symbol_name)
 
void init_struct_cache (void)
 
void cache_struct (const char *name, StructInfo *info)
 
StructInfolookup_cached_struct (const char *name)
 
LLVMValueRef codegen_expr_struct_assignment (CodeGenContext *ctx, AstNode *node)
 
void import_module_symbols (CodeGenContext *ctx, ModuleCompilationUnit *source_module, const char *alias)
 
void import_function_symbol (CodeGenContext *ctx, LLVM_Symbol *source_symbol, ModuleCompilationUnit *source_module, const char *alias)
 
void import_variable_symbol (CodeGenContext *ctx, LLVM_Symbol *source_symbol, ModuleCompilationUnit *source_module, const char *alias)
 
LLVM_Symbolfind_symbol_with_module_support (CodeGenContext *ctx, const char *name)
 
void setup_module_debug_info (CodeGenContext *ctx, ModuleCompilationUnit *unit, const char *filename)
 
void finalize_module_debug_info (ModuleCompilationUnit *unit)
 
void finalize_all_debug_info (CodeGenContext *ctx)
 
void set_debug_location (CodeGenContext *ctx, unsigned line, unsigned column)
 
bool is_main_module (ModuleCompilationUnit *unit)
 
void set_module_as_main (ModuleCompilationUnit *unit)
 
void print_module_info (CodeGenContext *ctx)
 
CodeGenContextinit_codegen_context (ArenaAllocator *arena)
 
void cleanup_codegen_context (CodeGenContext *ctx)
 
void add_symbol_to_module (ModuleCompilationUnit *module, const char *name, LLVMValueRef value, LLVMTypeRef type, bool is_function)
 
LLVM_Symbolfind_symbol_in_module (ModuleCompilationUnit *module, const char *name)
 
LLVM_Symbolfind_symbol_global (CodeGenContext *ctx, const char *name, const char *module_name)
 
bool generate_program_modules (CodeGenContext *ctx, AstNode *ast_root, const char *output_dir)
 
bool generate_module_object_file (ModuleCompilationUnit *module, const char *output_path, bool is_debug)
 
void add_symbol (CodeGenContext *ctx, const char *name, LLVMValueRef value, LLVMTypeRef type, bool is_function)
 
LLVM_Symbolfind_symbol (CodeGenContext *ctx, const char *name)
 
char * print_llvm_ir (CodeGenContext *ctx)
 
bool generate_object_file (CodeGenContext *ctx, const char *object_filename)
 
bool generate_assembly_file (CodeGenContext *ctx, const char *asm_filename, bool is_debug)
 
char * process_escape_sequences (const char *input)
 
LLVMLinkage get_function_linkage (AstNode *node)
 
void init_type_cache (CodeGenContext *ctx)
 
LLVMTypeRef get_int_type (CodeGenContext *ctx, unsigned bits)
 
LLVMTypeRef get_float_type (CodeGenContext *ctx, bool is_double)
 
LLVMValueRef get_const_int (CodeGenContext *ctx, unsigned bits, uint64_t value)
 
bool is_int_type (LLVMTypeRef type)
 
bool is_float_type (LLVMTypeRef type)
 
bool pointer_type (LLVMTypeRef type)
 
bool types_are_equal (LLVMTypeRef a, LLVMTypeRef b)
 
bool needs_conversion (LLVMTypeRef from, LLVMTypeRef to)
 
LLVMValueRef get_default_value (LLVMTypeRef type)
 
LLVMValueRef alloca_and_store (CodeGenContext *ctx, LLVMTypeRef type, LLVMValueRef value, const char *name)
 
LLVMValueRef struct_gep_load (CodeGenContext *ctx, LLVMTypeRef struct_type, LLVMValueRef ptr, unsigned index, LLVMTypeRef element_type, const char *name)
 
void struct_gep_store (CodeGenContext *ctx, LLVMTypeRef struct_type, LLVMValueRef ptr, unsigned index, LLVMValueRef value)
 
LLVMValueRef array_gep (CodeGenContext *ctx, LLVMTypeRef array_type, LLVMValueRef array_ptr, LLVMValueRef index, const char *name)
 
bool block_has_terminator (LLVMBuilderRef builder)
 
void branch_if_no_terminator (CodeGenContext *ctx, LLVMBasicBlockRef target)
 
LLVMValueRef build_global_string (CodeGenContext *ctx, const char *str, const char *name)
 
LLVMValueRef codegen_module_access (CodeGenContext *ctx, AstNode *node)
 Handle compile-time member access (::)
 
bool is_module_identifier (CodeGenContext *ctx, const char *name)
 Check if an identifier might be a module/alias.
 
bool validate_module_access (CodeGenContext *ctx, const char *prefix, const char *symbol_name)
 Validate that a module access is permitted.
 
const char * get_module_name_from_access (AstNode *node)
 Get module name/alias from a compile-time member access node.
 
StructInfofind_struct_type (CodeGenContext *ctx, const char *name)
 
void add_struct_type (CodeGenContext *ctx, StructInfo *struct_info)
 
int get_field_index (StructInfo *struct_info, const char *field_name)
 
bool is_field_access_allowed (CodeGenContext *ctx, StructInfo *struct_info, int field_index)
 
LLVMValueRef codegen_struct_method (CodeGenContext *ctx, AstNode *func_node, StructInfo *struct_info, const char *method_name, bool is_public, bool is_static)
 
LLVMValueRef codegen_struct_literal (CodeGenContext *ctx, const char *struct_name, LLVMValueRef *field_values, size_t field_count)
 
bool is_struct_type (CodeGenContext *ctx, LLVMTypeRef type)
 
const char * get_struct_name_from_type (CodeGenContext *ctx, LLVMTypeRef type)
 
LLVMValueRef create_struct_zero_initializer (CodeGenContext *ctx, const char *struct_name)
 
LLVMValueRef create_struct_copy (CodeGenContext *ctx, LLVMValueRef src_struct, StructInfo *struct_info)
 
void print_struct_info (CodeGenContext *ctx, const char *struct_name)
 
void debug_struct_layout (CodeGenContext *ctx, const char *struct_name)
 
LLVMValueRef codegen_stmt_struct (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_field (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_struct_access (CodeGenContext *ctx, AstNode *node)
 
LLVMTypeRef codegen_type_struct (CodeGenContext *ctx, const char *struct_name)
 
LLVMValueRef codegen_expr (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt (CodeGenContext *ctx, AstNode *node)
 
LLVMTypeRef codegen_type (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_program_multi_module (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_module (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_use (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_os (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_link (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef convert_value_to_type (CodeGenContext *ctx, LLVMValueRef value, LLVMTypeRef from_type, LLVMTypeRef to_type)
 
LLVMValueRef codegen_multidim_array_access (CodeGenContext *ctx, AstNode *base_expr, AstNode **indices, size_t index_count)
 
void copy_array_elements (CodeGenContext *ctx, LLVMValueRef dest_array, LLVMTypeRef dest_type, LLVMValueRef src_array, LLVMTypeRef src_type)
 
void add_symbol_with_element_type (CodeGenContext *ctx, const char *name, LLVMValueRef value, LLVMTypeRef type, LLVMTypeRef element_type, bool is_function)
 
void add_symbol_to_module_with_element_type (ModuleCompilationUnit *module, const char *name, LLVMValueRef value, LLVMTypeRef type, LLVMTypeRef element_type, bool is_function)
 
LLVMTypeRef extract_element_type_from_ast (CodeGenContext *ctx, AstNode *type_node)
 
LLVMValueRef codegen_expr_literal (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_identifier (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_binary (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_unary (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_call (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_assignment (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_array (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_index (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_cast (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_input (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_system (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_syscall (CodeGenContext *ctx, AstNode *node)
 Generate LLVM IR for syscall expression.
 
LLVMValueRef codegen_expr_sizeof (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_alloc (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_free (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_deref (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_addr (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_expr_struct_literal (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_program (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_expression (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_var_decl (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_function (CodeGenContext *ctx, AstNode *node)
 
bool is_enum_constant (LLVM_Symbol *sym)
 
int64_t get_enum_constant_value (LLVM_Symbol *sym)
 
LLVMValueRef codegen_stmt_enum (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_return (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_block (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_if (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_print (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_defer (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_infinite_loop (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_while_loop (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_for_loop (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_loop (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_break_continue (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_switch (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_case (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_stmt_default (CodeGenContext *ctx, AstNode *node)
 
LLVMValueRef codegen_case_value (CodeGenContext *ctx, AstNode *case_value)
 
LLVMValueRef codegen_enum_member_case (CodeGenContext *ctx, AstNode *member_expr)
 
void init_defer_stack (CodeGenContext *ctx)
 
void push_defer_statement (CodeGenContext *ctx, AstNode *statement)
 
void execute_deferred_statements_inline (CodeGenContext *ctx, DeferredStatement *defers)
 
void generate_cleanup_blocks (CodeGenContext *ctx)
 
void clear_defer_stack (CodeGenContext *ctx)
 
bool is_range_type (LLVMTypeRef type)
 
LLVMValueRef get_range_start_value (CodeGenContext *ctx, LLVMValueRef range_struct)
 
LLVMValueRef get_range_end_value (CodeGenContext *ctx, LLVMValueRef range_struct)
 
LLVMValueRef create_range_struct (CodeGenContext *ctx, LLVMValueRef start, LLVMValueRef end)
 
LLVMTypeRef get_range_struct_type (CodeGenContext *ctx, LLVMTypeRef element_type)
 
LLVMValueRef range_contains (CodeGenContext *ctx, LLVMValueRef range_struct, LLVMValueRef value)
 
LLVMValueRef range_length (CodeGenContext *ctx, LLVMValueRef range_struct)
 
LLVMTypeRef codegen_type_basic (CodeGenContext *ctx, AstNode *node)
 
LLVMTypeRef codegen_type_pointer (CodeGenContext *ctx, AstNode *node)
 
LLVMTypeRef codegen_type_array (CodeGenContext *ctx, AstNode *node)
 
LLVMTypeRef codegen_type_function (CodeGenContext *ctx, AstNode *node)
 

Macro Definition Documentation

◆ MAX_LINK_LIBS

#define MAX_LINK_LIBS   64

◆ SYMBOL_HASH_SIZE

#define SYMBOL_HASH_SIZE   1024

Typedef Documentation

◆ CodeGenContext

◆ CommonTypes

typedef struct CommonTypes CommonTypes

◆ DeferredStatement

◆ LLVM_Symbol

typedef struct LLVM_Symbol LLVM_Symbol

◆ ModuleCompilationUnit

◆ ModuleDependencyInfo

◆ StructHashEntry

◆ StructHashTable

◆ StructInfo

typedef struct StructInfo StructInfo

◆ SymbolHashEntry

◆ SymbolHashTable

Function Documentation

◆ add_struct_type()

void add_struct_type ( CodeGenContext ctx,
StructInfo struct_info 
)

◆ add_symbol()

void add_symbol ( CodeGenContext ctx,
const char *  name,
LLVMValueRef  value,
LLVMTypeRef  type,
bool  is_function 
)

◆ add_symbol_to_module()

void add_symbol_to_module ( ModuleCompilationUnit module,
const char *  name,
LLVMValueRef  value,
LLVMTypeRef  type,
bool  is_function 
)

◆ add_symbol_to_module_with_element_type()

void add_symbol_to_module_with_element_type ( ModuleCompilationUnit module,
const char *  name,
LLVMValueRef  value,
LLVMTypeRef  type,
LLVMTypeRef  element_type,
bool  is_function 
)

◆ add_symbol_with_element_type()

void add_symbol_with_element_type ( CodeGenContext ctx,
const char *  name,
LLVMValueRef  value,
LLVMTypeRef  type,
LLVMTypeRef  element_type,
bool  is_function 
)

◆ alloca_and_store()

LLVMValueRef alloca_and_store ( CodeGenContext ctx,
LLVMTypeRef  type,
LLVMValueRef  value,
const char *  name 
)

◆ array_gep()

LLVMValueRef array_gep ( CodeGenContext ctx,
LLVMTypeRef  array_type,
LLVMValueRef  array_ptr,
LLVMValueRef  index,
const char *  name 
)

◆ block_has_terminator()

bool block_has_terminator ( LLVMBuilderRef  builder)

◆ branch_if_no_terminator()

void branch_if_no_terminator ( CodeGenContext ctx,
LLVMBasicBlockRef  target 
)

◆ build_global_string()

LLVMValueRef build_global_string ( CodeGenContext ctx,
const char *  str,
const char *  name 
)

◆ cache_struct()

void cache_struct ( const char *  name,
StructInfo info 
)

◆ cache_symbol()

void cache_symbol ( const char *  module_name,
const char *  symbol_name,
LLVM_Symbol symbol 
)

◆ cleanup_codegen_context()

void cleanup_codegen_context ( CodeGenContext ctx)

◆ cleanup_module_caches()

void cleanup_module_caches ( void  )

◆ clear_defer_stack()

void clear_defer_stack ( CodeGenContext ctx)

◆ codegen_case_value()

LLVMValueRef codegen_case_value ( CodeGenContext ctx,
AstNode case_value 
)

◆ codegen_enum_member_case()

LLVMValueRef codegen_enum_member_case ( CodeGenContext ctx,
AstNode member_expr 
)

◆ codegen_expr()

LLVMValueRef codegen_expr ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_addr()

LLVMValueRef codegen_expr_addr ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_alloc()

LLVMValueRef codegen_expr_alloc ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_array()

LLVMValueRef codegen_expr_array ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_assignment()

LLVMValueRef codegen_expr_assignment ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_binary()

LLVMValueRef codegen_expr_binary ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_call()

LLVMValueRef codegen_expr_call ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_cast()

LLVMValueRef codegen_expr_cast ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_deref()

LLVMValueRef codegen_expr_deref ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_free()

LLVMValueRef codegen_expr_free ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_identifier()

LLVMValueRef codegen_expr_identifier ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_index()

LLVMValueRef codegen_expr_index ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_input()

LLVMValueRef codegen_expr_input ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_literal()

LLVMValueRef codegen_expr_literal ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_sizeof()

LLVMValueRef codegen_expr_sizeof ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_struct_access()

LLVMValueRef codegen_expr_struct_access ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_struct_assignment()

LLVMValueRef codegen_expr_struct_assignment ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_struct_literal()

LLVMValueRef codegen_expr_struct_literal ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_syscall()

LLVMValueRef codegen_expr_syscall ( CodeGenContext ctx,
AstNode node 
)

Generate LLVM IR for syscall expression.

Syscall in x86_64 Linux:

  • syscall number goes in rax
  • arguments go in rdi, rsi, rdx, r10, r8, r9 (in that order)
  • return value comes back in rax

We use inline assembly to invoke the syscall instruction.

◆ codegen_expr_system()

LLVMValueRef codegen_expr_system ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_expr_unary()

LLVMValueRef codegen_expr_unary ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_for_loop()

LLVMValueRef codegen_for_loop ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_infinite_loop()

LLVMValueRef codegen_infinite_loop ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_loop()

LLVMValueRef codegen_loop ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_module_access()

LLVMValueRef codegen_module_access ( CodeGenContext ctx,
AstNode node 
)

Handle compile-time member access (::)

Works with the existing import system:

  • @use "std_io" as io creates symbols like "io.println"
  • Then io::println looks up "io.println"
Parameters
ctxCode generation context
nodeAST node for member access expression
Returns
Generated LLVM value or NULL on error

◆ codegen_multidim_array_access()

LLVMValueRef codegen_multidim_array_access ( CodeGenContext ctx,
AstNode base_expr,
AstNode **  indices,
size_t  index_count 
)

◆ codegen_stmt()

LLVMValueRef codegen_stmt ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_block()

LLVMValueRef codegen_stmt_block ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_break_continue()

LLVMValueRef codegen_stmt_break_continue ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_case()

LLVMValueRef codegen_stmt_case ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_default()

LLVMValueRef codegen_stmt_default ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_defer()

LLVMValueRef codegen_stmt_defer ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_enum()

LLVMValueRef codegen_stmt_enum ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_expression()

LLVMValueRef codegen_stmt_expression ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_field()

LLVMValueRef codegen_stmt_field ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_function()

LLVMValueRef codegen_stmt_function ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_if()

LLVMValueRef codegen_stmt_if ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_link()

LLVMValueRef codegen_stmt_link ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_module()

LLVMValueRef codegen_stmt_module ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_os()

LLVMValueRef codegen_stmt_os ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_print()

LLVMValueRef codegen_stmt_print ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_program()

LLVMValueRef codegen_stmt_program ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_program_multi_module()

LLVMValueRef codegen_stmt_program_multi_module ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_return()

LLVMValueRef codegen_stmt_return ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_struct()

LLVMValueRef codegen_stmt_struct ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_switch()

LLVMValueRef codegen_stmt_switch ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_use()

LLVMValueRef codegen_stmt_use ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_stmt_var_decl()

LLVMValueRef codegen_stmt_var_decl ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_struct_literal()

LLVMValueRef codegen_struct_literal ( CodeGenContext ctx,
const char *  struct_name,
LLVMValueRef *  field_values,
size_t  field_count 
)

◆ codegen_struct_method()

LLVMValueRef codegen_struct_method ( CodeGenContext ctx,
AstNode func_node,
StructInfo struct_info,
const char *  method_name,
bool  is_public,
bool  is_static 
)

◆ codegen_type()

LLVMTypeRef codegen_type ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_type_array()

LLVMTypeRef codegen_type_array ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_type_basic()

LLVMTypeRef codegen_type_basic ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_type_function()

LLVMTypeRef codegen_type_function ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_type_pointer()

LLVMTypeRef codegen_type_pointer ( CodeGenContext ctx,
AstNode node 
)

◆ codegen_type_struct()

LLVMTypeRef codegen_type_struct ( CodeGenContext ctx,
const char *  struct_name 
)

◆ codegen_while_loop()

LLVMValueRef codegen_while_loop ( CodeGenContext ctx,
AstNode node 
)

◆ compile_modules_to_objects()

bool compile_modules_to_objects ( CodeGenContext ctx,
const char *  output_dir 
)

◆ convert_value_to_type()

LLVMValueRef convert_value_to_type ( CodeGenContext ctx,
LLVMValueRef  value,
LLVMTypeRef  from_type,
LLVMTypeRef  to_type 
)

◆ copy_array_elements()

void copy_array_elements ( CodeGenContext ctx,
LLVMValueRef  dest_array,
LLVMTypeRef  dest_type,
LLVMValueRef  src_array,
LLVMTypeRef  src_type 
)

◆ create_module_unit()

ModuleCompilationUnit * create_module_unit ( CodeGenContext ctx,
const char *  module_name 
)

◆ create_range_struct()

LLVMValueRef create_range_struct ( CodeGenContext ctx,
LLVMValueRef  start,
LLVMValueRef  end 
)

◆ create_struct_copy()

LLVMValueRef create_struct_copy ( CodeGenContext ctx,
LLVMValueRef  src_struct,
StructInfo struct_info 
)

◆ create_struct_zero_initializer()

LLVMValueRef create_struct_zero_initializer ( CodeGenContext ctx,
const char *  struct_name 
)

◆ debug_object_files()

void debug_object_files ( const char *  output_dir)

◆ debug_struct_layout()

void debug_struct_layout ( CodeGenContext ctx,
const char *  struct_name 
)

◆ execute_deferred_statements_inline()

void execute_deferred_statements_inline ( CodeGenContext ctx,
DeferredStatement defers 
)

◆ extract_element_type_from_ast()

LLVMTypeRef extract_element_type_from_ast ( CodeGenContext ctx,
AstNode type_node 
)

◆ finalize_all_debug_info()

void finalize_all_debug_info ( CodeGenContext ctx)

◆ finalize_module_debug_info()

void finalize_module_debug_info ( ModuleCompilationUnit unit)

◆ find_concrete_struct_for_base()

StructInfo * find_concrete_struct_for_base ( CodeGenContext ctx,
StructInfo base_info,
const char *  field_name 
)

◆ find_module()

ModuleCompilationUnit * find_module ( CodeGenContext ctx,
const char *  module_name 
)

◆ find_struct_type()

StructInfo * find_struct_type ( CodeGenContext ctx,
const char *  name 
)

◆ find_struct_type_fast()

StructInfo * find_struct_type_fast ( CodeGenContext ctx,
const char *  name 
)

◆ find_symbol()

LLVM_Symbol * find_symbol ( CodeGenContext ctx,
const char *  name 
)

◆ find_symbol_global()

LLVM_Symbol * find_symbol_global ( CodeGenContext ctx,
const char *  name,
const char *  module_name 
)

◆ find_symbol_in_module()

LLVM_Symbol * find_symbol_in_module ( ModuleCompilationUnit module,
const char *  name 
)

◆ find_symbol_with_module_support()

LLVM_Symbol * find_symbol_with_module_support ( CodeGenContext ctx,
const char *  name 
)

◆ generate_assembly_file()

bool generate_assembly_file ( CodeGenContext ctx,
const char *  asm_filename,
bool  is_debug 
)

◆ generate_cleanup_blocks()

void generate_cleanup_blocks ( CodeGenContext ctx)

◆ generate_external_declarations()

void generate_external_declarations ( CodeGenContext ctx,
ModuleCompilationUnit target_module 
)

◆ generate_module_object_file()

bool generate_module_object_file ( ModuleCompilationUnit module,
const char *  output_path,
bool  is_debug 
)

◆ generate_object_file()

bool generate_object_file ( CodeGenContext ctx,
const char *  object_filename 
)

◆ generate_program_modules()

bool generate_program_modules ( CodeGenContext ctx,
AstNode ast_root,
const char *  output_dir 
)

◆ get_const_int()

LLVMValueRef get_const_int ( CodeGenContext ctx,
unsigned  bits,
uint64_t  value 
)

◆ get_default_value()

LLVMValueRef get_default_value ( LLVMTypeRef  type)

◆ get_enum_constant_value()

int64_t get_enum_constant_value ( LLVM_Symbol sym)

◆ get_field_index()

int get_field_index ( StructInfo struct_info,
const char *  field_name 
)

◆ get_float_type()

LLVMTypeRef get_float_type ( CodeGenContext ctx,
bool  is_double 
)

◆ get_function_linkage()

LLVMLinkage get_function_linkage ( AstNode node)

◆ get_int_type()

LLVMTypeRef get_int_type ( CodeGenContext ctx,
unsigned  bits 
)

◆ get_module_name_from_access()

const char * get_module_name_from_access ( AstNode node)

Get module name/alias from a compile-time member access node.

◆ get_range_end_value()

LLVMValueRef get_range_end_value ( CodeGenContext ctx,
LLVMValueRef  range_struct 
)

◆ get_range_start_value()

LLVMValueRef get_range_start_value ( CodeGenContext ctx,
LLVMValueRef  range_struct 
)

◆ get_range_struct_type()

LLVMTypeRef get_range_struct_type ( CodeGenContext ctx,
LLVMTypeRef  element_type 
)

◆ get_struct_name_from_type()

const char * get_struct_name_from_type ( CodeGenContext ctx,
LLVMTypeRef  type 
)

◆ hash_string()

unsigned int hash_string ( const char *  str)

◆ import_function_symbol()

void import_function_symbol ( CodeGenContext ctx,
LLVM_Symbol source_symbol,
ModuleCompilationUnit source_module,
const char *  alias 
)

◆ import_module_symbols()

void import_module_symbols ( CodeGenContext ctx,
ModuleCompilationUnit source_module,
const char *  alias 
)

◆ import_variable_symbol()

void import_variable_symbol ( CodeGenContext ctx,
LLVM_Symbol source_symbol,
ModuleCompilationUnit source_module,
const char *  alias 
)

◆ init_codegen_context()

CodeGenContext * init_codegen_context ( ArenaAllocator arena)

◆ init_defer_stack()

void init_defer_stack ( CodeGenContext ctx)

◆ init_struct_cache()

void init_struct_cache ( void  )

◆ init_symbol_cache()

void init_symbol_cache ( void  )

◆ init_type_cache()

void init_type_cache ( CodeGenContext ctx)

◆ is_enum_constant()

bool is_enum_constant ( LLVM_Symbol sym)

◆ is_field_access_allowed()

bool is_field_access_allowed ( CodeGenContext ctx,
StructInfo struct_info,
int  field_index 
)

◆ is_float_type()

bool is_float_type ( LLVMTypeRef  type)

◆ is_int_type()

bool is_int_type ( LLVMTypeRef  type)

◆ is_main_module()

bool is_main_module ( ModuleCompilationUnit unit)

◆ is_module_identifier()

bool is_module_identifier ( CodeGenContext ctx,
const char *  name 
)

Check if an identifier might be a module/alias.

◆ is_range_type()

bool is_range_type ( LLVMTypeRef  type)

◆ is_struct_type()

bool is_struct_type ( CodeGenContext ctx,
LLVMTypeRef  type 
)

◆ lookup_cached_struct()

StructInfo * lookup_cached_struct ( const char *  name)

◆ lookup_cached_symbol()

LLVM_Symbol * lookup_cached_symbol ( const char *  module_name,
const char *  symbol_name 
)

◆ needs_conversion()

bool needs_conversion ( LLVMTypeRef  from,
LLVMTypeRef  to 
)

◆ pointer_type()

bool pointer_type ( LLVMTypeRef  type)

◆ preprocess_all_modules()

void preprocess_all_modules ( CodeGenContext ctx)

◆ print_llvm_ir()

char * print_llvm_ir ( CodeGenContext ctx)

◆ print_module_info()

void print_module_info ( CodeGenContext ctx)

◆ print_struct_info()

void print_struct_info ( CodeGenContext ctx,
const char *  struct_name 
)

◆ process_escape_sequences()

char * process_escape_sequences ( const char *  input)

◆ push_defer_statement()

void push_defer_statement ( CodeGenContext ctx,
AstNode statement 
)

◆ range_contains()

LLVMValueRef range_contains ( CodeGenContext ctx,
LLVMValueRef  range_struct,
LLVMValueRef  value 
)

◆ range_length()

LLVMValueRef range_length ( CodeGenContext ctx,
LLVMValueRef  range_struct 
)

◆ set_current_module()

void set_current_module ( CodeGenContext ctx,
ModuleCompilationUnit module 
)

◆ set_debug_location()

void set_debug_location ( CodeGenContext ctx,
unsigned  line,
unsigned  column 
)

◆ set_module_as_main()

void set_module_as_main ( ModuleCompilationUnit unit)

◆ setup_module_debug_info()

void setup_module_debug_info ( CodeGenContext ctx,
ModuleCompilationUnit unit,
const char *  filename 
)

◆ struct_gep_load()

LLVMValueRef struct_gep_load ( CodeGenContext ctx,
LLVMTypeRef  struct_type,
LLVMValueRef  ptr,
unsigned  index,
LLVMTypeRef  element_type,
const char *  name 
)

◆ struct_gep_store()

void struct_gep_store ( CodeGenContext ctx,
LLVMTypeRef  struct_type,
LLVMValueRef  ptr,
unsigned  index,
LLVMValueRef  value 
)

◆ types_are_equal()

bool types_are_equal ( LLVMTypeRef  a,
LLVMTypeRef  b 
)

◆ validate_module_access()

bool validate_module_access ( CodeGenContext ctx,
const char *  prefix,
const char *  symbol_name 
)

Validate that a module access is permitted.

Checks that the qualified symbol exists