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) {
643643 unsigned line_number = (unsigned)(fn_table_entry->proto_node->line == 0) ?
644644 0 : (fn_table_entry->proto_node->line + 1);
645645 unsigned scope_line = line_number;
646 bool is_definition = fn_table_entry->body_node != nullptr;
647646 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);
651647 ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent);
652648 assert(fn_di_scope != nullptr);
653649 ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder,
654650 fn_di_scope, buf_ptr(&fn_table_entry->symbol_name), "",
655651 import->di_file, line_number,
656 fn_table_entry->type_entry->di_type, is_internal_linkage,
657 is_definition, scope_line, flags, is_optimized, nullptr);
652 fn_table_entry->type_entry->di_type,
653 scope_line, flags, nullptr);
658654
659655 scope->di_scope = ZigLLVMSubprogramToScope(subprogram);
660656 ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram);
src/target.cpp+7
......@@ -184,6 +184,7 @@ static const Os os_list[] = {
184184 OsContiki,
185185 OsAMDPAL,
186186 OsHermitCore,
187 OsHurd,
187188 OsZen,
188189};
189190
......@@ -328,6 +329,8 @@ ZigLLVM_OSType get_llvm_os_type(Os os_type) {
328329 return ZigLLVM_AMDPAL;
329330 case OsHermitCore:
330331 return ZigLLVM_HermitCore;
332 case OsHurd:
333 return ZigLLVM_Hurd;
331334 }
332335 zig_unreachable();
333336}
......@@ -399,6 +402,8 @@ static Os get_zig_os_type(ZigLLVM_OSType os_type) {
399402 return OsAMDPAL;
400403 case ZigLLVM_HermitCore:
401404 return OsHermitCore;
405 case ZigLLVM_Hurd:
406 return OsHurd;
402407 }
403408 zig_unreachable();
404409}
......@@ -440,6 +445,7 @@ const char *get_target_os_name(Os os_type) {
440445 case OsContiki:
441446 case OsAMDPAL:
442447 case OsHermitCore:
448 case OsHurd:
443449 return ZigLLVMGetOSTypeName(get_llvm_os_type(os_type));
444450 }
445451 zig_unreachable();
......@@ -814,6 +820,7 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
814820 case OsContiki:
815821 case OsAMDPAL:
816822 case OsHermitCore:
823 case OsHurd:
817824 zig_panic("TODO c type size in bits for this target");
818825 }
819826 zig_unreachable();
src/target.hpp+1
......@@ -51,6 +51,7 @@ enum Os {
5151 OsContiki,
5252 OsAMDPAL,
5353 OsHermitCore,
54 OsHurd,
5455 OsZen,
5556};
5657
src/translate_c.cpp+29-2
......@@ -906,6 +906,18 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou
906906 case BuiltinType::SatUShortFract:
907907 case BuiltinType::SatUFract:
908908 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:
909921 emit_warning(c, source_loc, "unsupported builtin type");
910922 return nullptr;
911923 }
......@@ -1011,6 +1023,9 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou
10111023 case CC_PreserveAll:
10121024 emit_warning(c, source_loc, "unsupported calling convention: PreserveAll");
10131025 return nullptr;
1026 case CC_AArch64VectorCall:
1027 emit_warning(c, source_loc, "unsupported calling convention: AArch64VectorCall");
1028 return nullptr;
10141029 }
10151030
10161031 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
12021217}
12031218
12041219static AstNode *trans_integer_literal(Context *c, const IntegerLiteral *stmt) {
1205 llvm::APSInt result;
1220 Expr::EvalResult result;
12061221 if (!stmt->EvaluateAsInt(result, *c->ctx)) {
12071222 emit_warning(c, stmt->getBeginLoc(), "invalid integer literal");
12081223 return nullptr;
12091224 }
1210 return trans_create_node_apint(c, result);
1225 return trans_create_node_apint(c, result.Val.getInt());
12111226}
12121227
12131228static 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 *
25102525 case BuiltinType::SatUShortFract:
25112526 case BuiltinType::SatUFract:
25122527 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:
25132540 return res;
25142541 }
25152542 break;
src/zig_llvm.cpp+7-4
......@@ -594,8 +594,8 @@ ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filena
594594
595595ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope,
596596 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,
598 unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram)
597 ZigLLVMDIType *fn_di_type, unsigned scope_line,
598 unsigned flags, ZigLLVMDISubprogram *decl_subprogram)
599599{
600600 DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type));
601601 assert(flags == 0);
......@@ -605,9 +605,12 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD
605605 reinterpret_cast<DIFile*>(file),
606606 lineno,
607607 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,
609611 nullptr,
610 reinterpret_cast<DISubprogram *>(decl_subprogram));
612 reinterpret_cast<DISubprogram *>(decl_subprogram),
613 nullptr);
611614 return reinterpret_cast<ZigLLVMDISubprogram*>(result);
612615}
613616
src/zig_llvm.h+4-3
......@@ -188,8 +188,8 @@ ZIG_EXTERN_C struct ZigLLVMDIFile *ZigLLVMCreateFile(struct ZigLLVMDIBuilder *di
188188
189189ZIG_EXTERN_C struct ZigLLVMDISubprogram *ZigLLVMCreateFunction(struct ZigLLVMDIBuilder *dibuilder,
190190 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,
192 unsigned scope_line, unsigned flags, bool is_optimized, struct ZigLLVMDISubprogram *decl_subprogram);
191 unsigned lineno, struct ZigLLVMDIType *fn_di_type,
192 unsigned scope_line, unsigned flags, struct ZigLLVMDISubprogram *decl_subprogram);
193193
194194ZIG_EXTERN_C void ZigLLVMFnSetSubprogram(LLVMValueRef fn, struct ZigLLVMDISubprogram *subprogram);
195195
......@@ -361,8 +361,9 @@ enum ZigLLVM_OSType {
361361 ZigLLVM_Contiki,
362362 ZigLLVM_AMDPAL, // AMD PAL Runtime
363363 ZigLLVM_HermitCore, // HermitCore Unikernel/Multikernel
364 ZigLLVM_Hurd, // GNU/Hurd
364365
365 ZigLLVM_LastOSType = ZigLLVM_HermitCore
366 ZigLLVM_LastOSType = ZigLLVM_Hurd
366367};
367368
368369// Synchronize with target.cpp::environ_list