authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-12-23 17:36:41-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-12-23 17:36:41-05:00
log16b8467a5eb983d76d77b7a679af535c950e94b3
treebfcf7341ebcc72dbd31d6ed22a3de62d93e03e94
parentc00216701c64269a2395e84f3ccff99d6fb89ffc

llvm8: fix build errors


6 files changed, 50 insertions(+), 15 deletions(-)

src/codegen.cpp+2-6
...@@ -643,18 +643,14 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {...@@ -643,18 +643,14 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {
643 unsigned line_number = (unsigned)(fn_table_entry->proto_node->line == 0) ?643 unsigned line_number = (unsigned)(fn_table_entry->proto_node->line == 0) ?
644 0 : (fn_table_entry->proto_node->line + 1);644 0 : (fn_table_entry->proto_node->line + 1);
645 unsigned scope_line = line_number;645 unsigned scope_line = line_number;
646 bool is_definition = fn_table_entry->body_node != nullptr;
647 unsigned flags = 0;646 unsigned flags = 0;
648 bool is_optimized = g->build_mode != BuildModeDebug;
649 bool is_internal_linkage = (fn_table_entry->body_node != nullptr &&
650 fn_table_entry->export_list.length == 0);
651 ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent);647 ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent);
652 assert(fn_di_scope != nullptr);648 assert(fn_di_scope != nullptr);
653 ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder,649 ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder,
654 fn_di_scope, buf_ptr(&fn_table_entry->symbol_name), "",650 fn_di_scope, buf_ptr(&fn_table_entry->symbol_name), "",
655 import->di_file, line_number,651 import->di_file, line_number,
656 fn_table_entry->type_entry->di_type, is_internal_linkage,652 fn_table_entry->type_entry->di_type,
657 is_definition, scope_line, flags, is_optimized, nullptr);653 scope_line, flags, nullptr);
658654
659 scope->di_scope = ZigLLVMSubprogramToScope(subprogram);655 scope->di_scope = ZigLLVMSubprogramToScope(subprogram);
660 ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram);656 ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram);
src/target.cpp+7
...@@ -184,6 +184,7 @@ static const Os os_list[] = {...@@ -184,6 +184,7 @@ static const Os os_list[] = {
184 OsContiki,184 OsContiki,
185 OsAMDPAL,185 OsAMDPAL,
186 OsHermitCore,186 OsHermitCore,
187 OsHurd,
187 OsZen,188 OsZen,
188};189};
189190
...@@ -328,6 +329,8 @@ ZigLLVM_OSType get_llvm_os_type(Os os_type) {...@@ -328,6 +329,8 @@ ZigLLVM_OSType get_llvm_os_type(Os os_type) {
328 return ZigLLVM_AMDPAL;329 return ZigLLVM_AMDPAL;
329 case OsHermitCore:330 case OsHermitCore:
330 return ZigLLVM_HermitCore;331 return ZigLLVM_HermitCore;
332 case OsHurd:
333 return ZigLLVM_Hurd;
331 }334 }
332 zig_unreachable();335 zig_unreachable();
333}336}
...@@ -399,6 +402,8 @@ static Os get_zig_os_type(ZigLLVM_OSType os_type) {...@@ -399,6 +402,8 @@ static Os get_zig_os_type(ZigLLVM_OSType os_type) {
399 return OsAMDPAL;402 return OsAMDPAL;
400 case ZigLLVM_HermitCore:403 case ZigLLVM_HermitCore:
401 return OsHermitCore;404 return OsHermitCore;
405 case ZigLLVM_Hurd:
406 return OsHurd;
402 }407 }
403 zig_unreachable();408 zig_unreachable();
404}409}
...@@ -440,6 +445,7 @@ const char *get_target_os_name(Os os_type) {...@@ -440,6 +445,7 @@ const char *get_target_os_name(Os os_type) {
440 case OsContiki:445 case OsContiki:
441 case OsAMDPAL:446 case OsAMDPAL:
442 case OsHermitCore:447 case OsHermitCore:
448 case OsHurd:
443 return ZigLLVMGetOSTypeName(get_llvm_os_type(os_type));449 return ZigLLVMGetOSTypeName(get_llvm_os_type(os_type));
444 }450 }
445 zig_unreachable();451 zig_unreachable();
...@@ -814,6 +820,7 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {...@@ -814,6 +820,7 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
814 case OsContiki:820 case OsContiki:
815 case OsAMDPAL:821 case OsAMDPAL:
816 case OsHermitCore:822 case OsHermitCore:
823 case OsHurd:
817 zig_panic("TODO c type size in bits for this target");824 zig_panic("TODO c type size in bits for this target");
818 }825 }
819 zig_unreachable();826 zig_unreachable();
src/target.hpp+1
...@@ -51,6 +51,7 @@ enum Os {...@@ -51,6 +51,7 @@ enum Os {
51 OsContiki,51 OsContiki,
52 OsAMDPAL,52 OsAMDPAL,
53 OsHermitCore,53 OsHermitCore,
54 OsHurd,
54 OsZen,55 OsZen,
55};56};
5657
src/translate_c.cpp+29-2
...@@ -906,6 +906,18 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou...@@ -906,6 +906,18 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou
906 case BuiltinType::SatUShortFract:906 case BuiltinType::SatUShortFract:
907 case BuiltinType::SatUFract:907 case BuiltinType::SatUFract:
908 case BuiltinType::SatULongFract:908 case BuiltinType::SatULongFract:
909 case BuiltinType::OCLIntelSubgroupAVCMcePayload:
910 case BuiltinType::OCLIntelSubgroupAVCImePayload:
911 case BuiltinType::OCLIntelSubgroupAVCRefPayload:
912 case BuiltinType::OCLIntelSubgroupAVCSicPayload:
913 case BuiltinType::OCLIntelSubgroupAVCMceResult:
914 case BuiltinType::OCLIntelSubgroupAVCImeResult:
915 case BuiltinType::OCLIntelSubgroupAVCRefResult:
916 case BuiltinType::OCLIntelSubgroupAVCSicResult:
917 case BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
918 case BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
919 case BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
920 case BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
909 emit_warning(c, source_loc, "unsupported builtin type");921 emit_warning(c, source_loc, "unsupported builtin type");
910 return nullptr;922 return nullptr;
911 }923 }
...@@ -1011,6 +1023,9 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou...@@ -1011,6 +1023,9 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou
1011 case CC_PreserveAll:1023 case CC_PreserveAll:
1012 emit_warning(c, source_loc, "unsupported calling convention: PreserveAll");1024 emit_warning(c, source_loc, "unsupported calling convention: PreserveAll");
1013 return nullptr;1025 return nullptr;
1026 case CC_AArch64VectorCall:
1027 emit_warning(c, source_loc, "unsupported calling convention: AArch64VectorCall");
1028 return nullptr;
1014 }1029 }
10151030
1016 proto_node->data.fn_proto.is_var_args = fn_proto_ty->isVariadic();1031 proto_node->data.fn_proto.is_var_args = fn_proto_ty->isVariadic();
...@@ -1202,12 +1217,12 @@ static AstNode *trans_return_stmt(Context *c, TransScope *scope, const ReturnStm...@@ -1202,12 +1217,12 @@ static AstNode *trans_return_stmt(Context *c, TransScope *scope, const ReturnStm
1202}1217}
12031218
1204static AstNode *trans_integer_literal(Context *c, const IntegerLiteral *stmt) {1219static AstNode *trans_integer_literal(Context *c, const IntegerLiteral *stmt) {
1205 llvm::APSInt result;1220 Expr::EvalResult result;
1206 if (!stmt->EvaluateAsInt(result, *c->ctx)) {1221 if (!stmt->EvaluateAsInt(result, *c->ctx)) {
1207 emit_warning(c, stmt->getBeginLoc(), "invalid integer literal");1222 emit_warning(c, stmt->getBeginLoc(), "invalid integer literal");
1208 return nullptr;1223 return nullptr;
1209 }1224 }
1210 return trans_create_node_apint(c, result);1225 return trans_create_node_apint(c, result.Val.getInt());
1211}1226}
12121227
1213static AstNode *trans_conditional_operator(Context *c, ResultUsed result_used, TransScope *scope,1228static AstNode *trans_conditional_operator(Context *c, ResultUsed result_used, TransScope *scope,
...@@ -2510,6 +2525,18 @@ static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *...@@ -2510,6 +2525,18 @@ static AstNode *trans_bool_expr(Context *c, ResultUsed result_used, TransScope *
2510 case BuiltinType::SatUShortFract:2525 case BuiltinType::SatUShortFract:
2511 case BuiltinType::SatUFract:2526 case BuiltinType::SatUFract:
2512 case BuiltinType::SatULongFract:2527 case BuiltinType::SatULongFract:
2528 case BuiltinType::OCLIntelSubgroupAVCMcePayload:
2529 case BuiltinType::OCLIntelSubgroupAVCImePayload:
2530 case BuiltinType::OCLIntelSubgroupAVCRefPayload:
2531 case BuiltinType::OCLIntelSubgroupAVCSicPayload:
2532 case BuiltinType::OCLIntelSubgroupAVCMceResult:
2533 case BuiltinType::OCLIntelSubgroupAVCImeResult:
2534 case BuiltinType::OCLIntelSubgroupAVCRefResult:
2535 case BuiltinType::OCLIntelSubgroupAVCSicResult:
2536 case BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
2537 case BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
2538 case BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
2539 case BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
2513 return res;2540 return res;
2514 }2541 }
2515 break;2542 break;
src/zig_llvm.cpp+7-4
...@@ -594,8 +594,8 @@ ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filena...@@ -594,8 +594,8 @@ ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filena
594594
595ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope,595ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope,
596 const char *name, const char *linkage_name, ZigLLVMDIFile *file, unsigned lineno,596 const char *name, const char *linkage_name, ZigLLVMDIFile *file, unsigned lineno,
597 ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line,597 ZigLLVMDIType *fn_di_type, unsigned scope_line,
598 unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram)598 unsigned flags, ZigLLVMDISubprogram *decl_subprogram)
599{599{
600 DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type));600 DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type));
601 assert(flags == 0);601 assert(flags == 0);
...@@ -605,9 +605,12 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD...@@ -605,9 +605,12 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD
605 reinterpret_cast<DIFile*>(file),605 reinterpret_cast<DIFile*>(file),
606 lineno,606 lineno,
607 di_sub_type,607 di_sub_type,
608 is_local_to_unit, is_definition, scope_line, DINode::FlagZero, is_optimized,608 scope_line,
609 DINode::FlagZero,
610 DISubprogram::SPFlagZero,
609 nullptr,611 nullptr,
610 reinterpret_cast<DISubprogram *>(decl_subprogram));612 reinterpret_cast<DISubprogram *>(decl_subprogram),
613 nullptr);
611 return reinterpret_cast<ZigLLVMDISubprogram*>(result);614 return reinterpret_cast<ZigLLVMDISubprogram*>(result);
612}615}
613616
src/zig_llvm.h+4-3
...@@ -188,8 +188,8 @@ ZIG_EXTERN_C struct ZigLLVMDIFile *ZigLLVMCreateFile(struct ZigLLVMDIBuilder *di...@@ -188,8 +188,8 @@ ZIG_EXTERN_C struct ZigLLVMDIFile *ZigLLVMCreateFile(struct ZigLLVMDIBuilder *di
188188
189ZIG_EXTERN_C struct ZigLLVMDISubprogram *ZigLLVMCreateFunction(struct ZigLLVMDIBuilder *dibuilder,189ZIG_EXTERN_C struct ZigLLVMDISubprogram *ZigLLVMCreateFunction(struct ZigLLVMDIBuilder *dibuilder,
190 struct ZigLLVMDIScope *scope, const char *name, const char *linkage_name, struct ZigLLVMDIFile *file,190 struct ZigLLVMDIScope *scope, const char *name, const char *linkage_name, struct ZigLLVMDIFile *file,
191 unsigned lineno, struct ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition,191 unsigned lineno, struct ZigLLVMDIType *fn_di_type,
192 unsigned scope_line, unsigned flags, bool is_optimized, struct ZigLLVMDISubprogram *decl_subprogram);192 unsigned scope_line, unsigned flags, struct ZigLLVMDISubprogram *decl_subprogram);
193193
194ZIG_EXTERN_C void ZigLLVMFnSetSubprogram(LLVMValueRef fn, struct ZigLLVMDISubprogram *subprogram);194ZIG_EXTERN_C void ZigLLVMFnSetSubprogram(LLVMValueRef fn, struct ZigLLVMDISubprogram *subprogram);
195195
...@@ -361,8 +361,9 @@ enum ZigLLVM_OSType {...@@ -361,8 +361,9 @@ enum ZigLLVM_OSType {
361 ZigLLVM_Contiki,361 ZigLLVM_Contiki,
362 ZigLLVM_AMDPAL, // AMD PAL Runtime362 ZigLLVM_AMDPAL, // AMD PAL Runtime
363 ZigLLVM_HermitCore, // HermitCore Unikernel/Multikernel363 ZigLLVM_HermitCore, // HermitCore Unikernel/Multikernel
364 ZigLLVM_Hurd, // GNU/Hurd
364365
365 ZigLLVM_LastOSType = ZigLLVM_HermitCore366 ZigLLVM_LastOSType = ZigLLVM_Hurd
366};367};
367368
368// Synchronize with target.cpp::environ_list369// Synchronize with target.cpp::environ_list