static void make_debug_info(compile_t* c, reachable_type_t* t) { source_t* source = ast_source(t->ast); t->di_file = LLVMDIBuilderCreateFile(c->di, source->file); switch(t->underlying) { case TK_TUPLETYPE: case TK_STRUCT: make_debug_prototype(c, t); return; case TK_PRIMITIVE: { if(t->primitive != NULL) make_debug_basic(c, t); else make_debug_prototype(c, t); return; } case TK_UNIONTYPE: case TK_ISECTTYPE: case TK_INTERFACE: case TK_TRAIT: case TK_CLASS: case TK_ACTOR: make_debug_prototype(c, t); return; default: {} } assert(0); }
void dwarf_lexicalscope(dwarf_t* dwarf, ast_t* ast) { dwarf_meta_t meta; memset(&meta, 0, sizeof(dwarf_meta_t)); symbols_push_frame(dwarf->symbols, NULL); source_t* source = ast_source(ast); meta.file = source->file; meta.line = ast_line(ast); meta.pos = ast_pos(ast); symbols_lexicalscope(dwarf->symbols, &meta); }
static void setup_dwarf(dwarf_t* dwarf, dwarf_meta_t* meta, gentype_t* g, bool opaque, bool field) { memset(meta, 0, sizeof(dwarf_meta_t)); ast_t* ast = g->ast; LLVMTypeRef type = g->primitive; if(is_machine_word(ast)) { if(is_float(ast)) meta->flags |= DWARF_FLOAT; else if(is_signed(dwarf->opt, ast)) meta->flags |= DWARF_SIGNED; else if(is_bool(ast)) meta->flags |= DWARF_BOOLEAN; } else if(is_pointer(ast) || is_maybe(ast) || !is_concrete(ast) || (is_constructable(ast) && field)) { type = g->use_type; } else if(is_constructable(ast)) { type = g->structure; } bool defined_type = g->underlying != TK_TUPLETYPE && g->underlying != TK_UNIONTYPE && g->underlying != TK_ISECTTYPE; source_t* source; if(defined_type) ast = (ast_t*)ast_data(ast); source = ast_source(ast); meta->file = source->file; meta->name = g->type_name; meta->line = ast_line(ast); meta->pos = ast_pos(ast); if(!opaque) { meta->size = LLVMABISizeOfType(dwarf->target_data, type) << 3; meta->align = LLVMABIAlignmentOfType(dwarf->target_data, type) << 3; } }
void codegen_pushscope(compile_t* c, ast_t* ast) { compile_frame_t* frame = push_frame(c); frame->fun = frame->prev->fun; frame->break_target = frame->prev->break_target; frame->continue_target = frame->prev->continue_target; frame->invoke_target = frame->prev->invoke_target; frame->di_file = frame->prev->di_file; if(frame->prev->di_scope != NULL) { source_t* source = ast_source(ast); LLVMMetadataRef file = LLVMDIBuilderCreateFile(c->di, source->file); frame->di_scope = LLVMDIBuilderCreateLexicalBlock(c->di, frame->prev->di_scope, file, (unsigned)ast_line(ast), (unsigned)ast_pos(ast)); } }
static void meta_local(dwarf_meta_t* meta, ast_t* ast, const char* name, const char* type, LLVMBasicBlockRef entry, LLVMValueRef storage, size_t offset, bool constant) { memset(meta, 0, sizeof(dwarf_meta_t)); source_t* source = ast_source(ast); meta->file = source->file; meta->name = name; meta->mangled = type; meta->line = ast_line(ast); meta->pos = ast_pos(ast); meta->offset = offset + 1; meta->entry = entry; meta->storage = storage; if(constant) meta->flags = DWARF_CONSTANT; }
void dwarf_method(dwarf_t* dwarf, ast_t* fun, const char* name, const char* mangled, const char** params, size_t count, LLVMValueRef ir) { dwarf_meta_t meta; memset(&meta, 0, sizeof(dwarf_meta_t)); source_t* source = ast_source(fun); ast_t* seq = ast_childidx(fun, 6); meta.file = source->file; meta.name = name; meta.mangled = mangled; meta.params = params; meta.line = ast_line(fun); meta.pos = ast_pos(fun); meta.offset = ast_line(seq); meta.size = count; symbols_method(dwarf->symbols, &meta, ir); }
// Check the number of configs we have to process and print a warning if it's a // lot. static void check_config_count(buildflagset_t* config, ast_t* location) { pony_assert(config != NULL); pony_assert(location != NULL); double config_count = buildflagset_configcount(config); if(config_count > 10000) { source_t* source = ast_source(location); const char* file = NULL; if(source != NULL) file = source->file; if(file == NULL) file = ""; printf("Processing %g configs at %s:" __zu ", this may take some time\n", config_count, file, ast_line(location)); } }