|
Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
|
#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"

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 | |
| ModuleCompilationUnit * | create_module_unit (CodeGenContext *ctx, const char *module_name) |
| ModuleCompilationUnit * | find_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) |
| StructInfo * | find_struct_type_fast (CodeGenContext *ctx, const char *name) |
| void | cleanup_module_caches (void) |
| void | debug_object_files (const char *output_dir) |
| StructInfo * | find_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_Symbol * | lookup_cached_symbol (const char *module_name, const char *symbol_name) |
| void | init_struct_cache (void) |
| void | cache_struct (const char *name, StructInfo *info) |
| StructInfo * | lookup_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_Symbol * | find_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) |
| CodeGenContext * | init_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_Symbol * | find_symbol_in_module (ModuleCompilationUnit *module, const char *name) |
| LLVM_Symbol * | find_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_Symbol * | find_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. | |
| StructInfo * | find_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) |
| #define MAX_LINK_LIBS 64 |
| #define SYMBOL_HASH_SIZE 1024 |
| typedef struct CodeGenContext CodeGenContext |
| typedef struct CommonTypes CommonTypes |
| typedef struct DeferredStatement DeferredStatement |
| typedef struct LLVM_Symbol LLVM_Symbol |
| typedef struct ModuleCompilationUnit ModuleCompilationUnit |
| typedef struct ModuleDependencyInfo ModuleDependencyInfo |
| typedef struct StructHashEntry StructHashEntry |
| typedef struct StructHashTable StructHashTable |
| typedef struct StructInfo StructInfo |
| typedef struct SymbolHashEntry SymbolHashEntry |
| typedef struct SymbolHashTable SymbolHashTable |
| void add_struct_type | ( | CodeGenContext * | ctx, |
| StructInfo * | struct_info | ||
| ) |
| void add_symbol | ( | CodeGenContext * | ctx, |
| const char * | name, | ||
| LLVMValueRef | value, | ||
| LLVMTypeRef | type, | ||
| bool | is_function | ||
| ) |
| void add_symbol_to_module | ( | ModuleCompilationUnit * | module, |
| const char * | name, | ||
| LLVMValueRef | value, | ||
| LLVMTypeRef | 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 | ||
| ) |
| void add_symbol_with_element_type | ( | CodeGenContext * | ctx, |
| const char * | name, | ||
| LLVMValueRef | value, | ||
| LLVMTypeRef | type, | ||
| LLVMTypeRef | element_type, | ||
| bool | is_function | ||
| ) |
| LLVMValueRef alloca_and_store | ( | CodeGenContext * | ctx, |
| LLVMTypeRef | type, | ||
| LLVMValueRef | value, | ||
| const char * | name | ||
| ) |
| 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 | ||
| ) |
| void cache_struct | ( | const char * | name, |
| StructInfo * | info | ||
| ) |
| void cache_symbol | ( | const char * | module_name, |
| const char * | symbol_name, | ||
| LLVM_Symbol * | symbol | ||
| ) |
| void cleanup_codegen_context | ( | CodeGenContext * | ctx | ) |
| void cleanup_module_caches | ( | void | ) |
| void clear_defer_stack | ( | CodeGenContext * | ctx | ) |
| LLVMValueRef codegen_case_value | ( | CodeGenContext * | ctx, |
| AstNode * | case_value | ||
| ) |
| LLVMValueRef codegen_enum_member_case | ( | CodeGenContext * | ctx, |
| AstNode * | member_expr | ||
| ) |
| LLVMValueRef codegen_expr | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_addr | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_alloc | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_array | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_assignment | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_binary | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_call | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_cast | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_deref | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_free | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_identifier | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_index | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_input | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_literal | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_sizeof | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_struct_access | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_struct_assignment | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_struct_literal | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_syscall | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
Generate LLVM IR for syscall expression.
Syscall in x86_64 Linux:
We use inline assembly to invoke the syscall instruction.
| LLVMValueRef codegen_expr_system | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_expr_unary | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_for_loop | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_infinite_loop | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_loop | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_module_access | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
Handle compile-time member access (::)
Works with the existing import system:
| ctx | Code generation context |
| node | AST node for member access expression |
| LLVMValueRef codegen_multidim_array_access | ( | CodeGenContext * | ctx, |
| AstNode * | base_expr, | ||
| AstNode ** | indices, | ||
| size_t | index_count | ||
| ) |
| LLVMValueRef codegen_stmt | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_block | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_break_continue | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_case | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_default | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_defer | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_enum | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_expression | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_field | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_function | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_if | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_link | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_module | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_os | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_print | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_program | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_program_multi_module | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_return | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_struct | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_switch | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_use | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_stmt_var_decl | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMValueRef codegen_struct_literal | ( | CodeGenContext * | ctx, |
| const char * | struct_name, | ||
| LLVMValueRef * | field_values, | ||
| size_t | field_count | ||
| ) |
| LLVMValueRef codegen_struct_method | ( | CodeGenContext * | ctx, |
| AstNode * | func_node, | ||
| StructInfo * | struct_info, | ||
| const char * | method_name, | ||
| bool | is_public, | ||
| bool | is_static | ||
| ) |
| LLVMTypeRef codegen_type | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMTypeRef codegen_type_array | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMTypeRef codegen_type_basic | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMTypeRef codegen_type_function | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMTypeRef codegen_type_pointer | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| LLVMTypeRef codegen_type_struct | ( | CodeGenContext * | ctx, |
| const char * | struct_name | ||
| ) |
| LLVMValueRef codegen_while_loop | ( | CodeGenContext * | ctx, |
| AstNode * | node | ||
| ) |
| bool compile_modules_to_objects | ( | CodeGenContext * | ctx, |
| const char * | output_dir | ||
| ) |
| LLVMValueRef convert_value_to_type | ( | CodeGenContext * | ctx, |
| LLVMValueRef | value, | ||
| LLVMTypeRef | from_type, | ||
| LLVMTypeRef | to_type | ||
| ) |
| void copy_array_elements | ( | CodeGenContext * | ctx, |
| LLVMValueRef | dest_array, | ||
| LLVMTypeRef | dest_type, | ||
| LLVMValueRef | src_array, | ||
| LLVMTypeRef | src_type | ||
| ) |
| ModuleCompilationUnit * create_module_unit | ( | CodeGenContext * | ctx, |
| const char * | module_name | ||
| ) |
| LLVMValueRef create_range_struct | ( | CodeGenContext * | ctx, |
| LLVMValueRef | start, | ||
| LLVMValueRef | end | ||
| ) |
| LLVMValueRef create_struct_copy | ( | CodeGenContext * | ctx, |
| LLVMValueRef | src_struct, | ||
| StructInfo * | struct_info | ||
| ) |
| LLVMValueRef create_struct_zero_initializer | ( | CodeGenContext * | ctx, |
| const char * | struct_name | ||
| ) |
| void debug_object_files | ( | const char * | output_dir | ) |
| void debug_struct_layout | ( | CodeGenContext * | ctx, |
| const char * | struct_name | ||
| ) |
| void execute_deferred_statements_inline | ( | CodeGenContext * | ctx, |
| DeferredStatement * | defers | ||
| ) |
| LLVMTypeRef extract_element_type_from_ast | ( | CodeGenContext * | ctx, |
| AstNode * | type_node | ||
| ) |
| void finalize_all_debug_info | ( | CodeGenContext * | ctx | ) |
| void finalize_module_debug_info | ( | ModuleCompilationUnit * | unit | ) |
| StructInfo * find_concrete_struct_for_base | ( | CodeGenContext * | ctx, |
| StructInfo * | base_info, | ||
| const char * | field_name | ||
| ) |
| ModuleCompilationUnit * find_module | ( | CodeGenContext * | ctx, |
| const char * | module_name | ||
| ) |
| StructInfo * find_struct_type | ( | CodeGenContext * | ctx, |
| const char * | name | ||
| ) |
| StructInfo * find_struct_type_fast | ( | CodeGenContext * | ctx, |
| const char * | name | ||
| ) |
| LLVM_Symbol * find_symbol | ( | CodeGenContext * | ctx, |
| const char * | name | ||
| ) |
| LLVM_Symbol * find_symbol_global | ( | CodeGenContext * | ctx, |
| const char * | name, | ||
| const char * | module_name | ||
| ) |
| LLVM_Symbol * find_symbol_in_module | ( | ModuleCompilationUnit * | module, |
| const char * | name | ||
| ) |
| LLVM_Symbol * find_symbol_with_module_support | ( | CodeGenContext * | ctx, |
| const char * | name | ||
| ) |
| bool generate_assembly_file | ( | CodeGenContext * | ctx, |
| const char * | asm_filename, | ||
| bool | is_debug | ||
| ) |
| void generate_cleanup_blocks | ( | CodeGenContext * | ctx | ) |
| void generate_external_declarations | ( | CodeGenContext * | ctx, |
| ModuleCompilationUnit * | target_module | ||
| ) |
| bool generate_module_object_file | ( | ModuleCompilationUnit * | module, |
| const char * | output_path, | ||
| bool | is_debug | ||
| ) |
| bool generate_object_file | ( | CodeGenContext * | ctx, |
| const char * | object_filename | ||
| ) |
| bool generate_program_modules | ( | CodeGenContext * | ctx, |
| AstNode * | ast_root, | ||
| const char * | output_dir | ||
| ) |
| LLVMValueRef get_const_int | ( | CodeGenContext * | ctx, |
| unsigned | bits, | ||
| uint64_t | value | ||
| ) |
| LLVMValueRef get_default_value | ( | LLVMTypeRef | type | ) |
| int64_t get_enum_constant_value | ( | LLVM_Symbol * | sym | ) |
| int get_field_index | ( | StructInfo * | struct_info, |
| const char * | field_name | ||
| ) |
| LLVMTypeRef get_float_type | ( | CodeGenContext * | ctx, |
| bool | is_double | ||
| ) |
| LLVMLinkage get_function_linkage | ( | AstNode * | node | ) |
| LLVMTypeRef get_int_type | ( | CodeGenContext * | ctx, |
| unsigned | bits | ||
| ) |
| const char * get_module_name_from_access | ( | AstNode * | node | ) |
Get module name/alias from a compile-time member access node.
| LLVMValueRef get_range_end_value | ( | CodeGenContext * | ctx, |
| LLVMValueRef | range_struct | ||
| ) |
| LLVMValueRef get_range_start_value | ( | CodeGenContext * | ctx, |
| LLVMValueRef | range_struct | ||
| ) |
| LLVMTypeRef get_range_struct_type | ( | CodeGenContext * | ctx, |
| LLVMTypeRef | element_type | ||
| ) |
| const char * get_struct_name_from_type | ( | CodeGenContext * | ctx, |
| LLVMTypeRef | type | ||
| ) |
| unsigned int hash_string | ( | const char * | str | ) |
| void import_function_symbol | ( | CodeGenContext * | ctx, |
| LLVM_Symbol * | source_symbol, | ||
| ModuleCompilationUnit * | source_module, | ||
| const char * | alias | ||
| ) |
| void import_module_symbols | ( | CodeGenContext * | ctx, |
| ModuleCompilationUnit * | source_module, | ||
| const char * | alias | ||
| ) |
| void import_variable_symbol | ( | CodeGenContext * | ctx, |
| LLVM_Symbol * | source_symbol, | ||
| ModuleCompilationUnit * | source_module, | ||
| const char * | alias | ||
| ) |
| CodeGenContext * init_codegen_context | ( | ArenaAllocator * | arena | ) |
| void init_defer_stack | ( | CodeGenContext * | ctx | ) |
| void init_struct_cache | ( | void | ) |
| void init_symbol_cache | ( | void | ) |
| void init_type_cache | ( | CodeGenContext * | ctx | ) |
| bool is_enum_constant | ( | LLVM_Symbol * | sym | ) |
| bool is_field_access_allowed | ( | CodeGenContext * | ctx, |
| StructInfo * | struct_info, | ||
| int | field_index | ||
| ) |
| bool is_float_type | ( | LLVMTypeRef | type | ) |
| bool is_int_type | ( | LLVMTypeRef | type | ) |
| bool is_main_module | ( | ModuleCompilationUnit * | unit | ) |
| bool is_module_identifier | ( | CodeGenContext * | ctx, |
| const char * | name | ||
| ) |
Check if an identifier might be a module/alias.
| bool is_range_type | ( | LLVMTypeRef | type | ) |
| bool is_struct_type | ( | CodeGenContext * | ctx, |
| LLVMTypeRef | type | ||
| ) |
| StructInfo * lookup_cached_struct | ( | const char * | name | ) |
| LLVM_Symbol * lookup_cached_symbol | ( | const char * | module_name, |
| const char * | symbol_name | ||
| ) |
| bool needs_conversion | ( | LLVMTypeRef | from, |
| LLVMTypeRef | to | ||
| ) |
| bool pointer_type | ( | LLVMTypeRef | type | ) |
| void preprocess_all_modules | ( | CodeGenContext * | ctx | ) |
| char * print_llvm_ir | ( | CodeGenContext * | ctx | ) |
| void print_module_info | ( | CodeGenContext * | ctx | ) |
| void print_struct_info | ( | CodeGenContext * | ctx, |
| const char * | struct_name | ||
| ) |
| char * process_escape_sequences | ( | const char * | input | ) |
| void push_defer_statement | ( | CodeGenContext * | ctx, |
| AstNode * | statement | ||
| ) |
| LLVMValueRef range_contains | ( | CodeGenContext * | ctx, |
| LLVMValueRef | range_struct, | ||
| LLVMValueRef | value | ||
| ) |
| LLVMValueRef range_length | ( | CodeGenContext * | ctx, |
| LLVMValueRef | range_struct | ||
| ) |
| void set_current_module | ( | CodeGenContext * | ctx, |
| ModuleCompilationUnit * | module | ||
| ) |
| void set_debug_location | ( | CodeGenContext * | ctx, |
| unsigned | line, | ||
| unsigned | column | ||
| ) |
| void set_module_as_main | ( | ModuleCompilationUnit * | unit | ) |
| void setup_module_debug_info | ( | CodeGenContext * | ctx, |
| ModuleCompilationUnit * | unit, | ||
| const char * | filename | ||
| ) |
| 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 | ||
| ) |
| bool types_are_equal | ( | LLVMTypeRef | a, |
| LLVMTypeRef | b | ||
| ) |
| 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