Commit 16b8467a5e

Andrew Kelley <andrew@ziglang.org>
2018-12-23 23:36:41
llvm8: fix build errors
1 parent c002167
src/codegen.cpp
@@ -643,18 +643,14 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {
             unsigned line_number = (unsigned)(fn_table_entry->proto_node->line == 0) ?
                 0 : (fn_table_entry->proto_node->line + 1);
             unsigned scope_line = line_number;
-            bool is_definition = fn_table_entry->body_node != nullptr;
             unsigned flags = 0;
-            bool is_optimized = g->build_mode != BuildModeDebug;
-            bool is_internal_linkage = (fn_table_entry->body_node != nullptr &&
-                    fn_table_entry->export_list.length == 0);
             ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent);
             assert(fn_di_scope != nullptr);
             ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder,
                 fn_di_scope, buf_ptr(&fn_table_entry->symbol_name), "",
                 import->di_file, line_number,
-                fn_table_entry->type_entry->di_type, is_internal_linkage,
-                is_definition, scope_line, flags, is_optimized, nullptr);
+                fn_table_entry->type_entry->di_type,
+                scope_line, flags, nullptr);
 
             scope->di_scope = ZigLLVMSubprogramToScope(subprogram);
             ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram);
src/target.cpp
@@ -184,6 +184,7 @@ static const Os os_list[] = {
     OsContiki,
     OsAMDPAL,
     OsHermitCore,
+    OsHurd,
     OsZen,
 };
 
@@ -328,6 +329,8 @@ ZigLLVM_OSType get_llvm_os_type(Os os_type) {
             return ZigLLVM_AMDPAL;
         case OsHermitCore:
             return ZigLLVM_HermitCore;
+        case OsHurd:
+            return ZigLLVM_Hurd;
     }
     zig_unreachable();
 }
@@ -399,6 +402,8 @@ static Os get_zig_os_type(ZigLLVM_OSType os_type) {
             return OsAMDPAL;
         case ZigLLVM_HermitCore:
             return OsHermitCore;
+        case ZigLLVM_Hurd:
+            return OsHurd;
     }
     zig_unreachable();
 }
@@ -440,6 +445,7 @@ const char *get_target_os_name(Os os_type) {
         case OsContiki:
         case OsAMDPAL:
         case OsHermitCore:
+        case OsHurd:
             return ZigLLVMGetOSTypeName(get_llvm_os_type(os_type));
     }
     zig_unreachable();
@@ -814,6 +820,7 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
         case OsContiki:
         case OsAMDPAL:
         case OsHermitCore:
+        case OsHurd:
             zig_panic("TODO c type size in bits for this target");
     }
     zig_unreachable();
src/target.hpp
@@ -51,6 +51,7 @@ enum Os {
     OsContiki,
     OsAMDPAL,
     OsHermitCore,
+    OsHurd,
     OsZen,
 };
 
src/translate_c.cpp
@@ -906,6 +906,18 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou
                     case BuiltinType::SatUShortFract:
                     case BuiltinType::SatUFract:
                     case BuiltinType::SatULongFract:
+                    case BuiltinType::OCLIntelSubgroupAVCMcePayload:
+                    case BuiltinType::OCLIntelSubgroupAVCImePayload:
+                    case BuiltinType::OCLIntelSubgroupAVCRefPayload:
+                    case BuiltinType::OCLIntelSubgroupAVCSicPayload:
+                    case BuiltinType::OCLIntelSubgroupAVCMceResult:
+                    case BuiltinType::OCLIntelSubgroupAVCImeResult:
+                    case BuiltinType::OCLIntelSubgroupAVCRefResult:
+                    case BuiltinType::OCLIntelSubgroupAVCSicResult:
+                    case BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
+                    case BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
+                    case BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
+                    case BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
                         emit_warning(c, source_loc, "unsupported builtin type");
                         return nullptr;
                 }
@@ -1011,6 +1023,9 @@ static AstNode *trans_type(Context *c, const Type *ty, const SourceLocation &sou
                     case CC_PreserveAll:
                         emit_warning(c, source_loc, "unsupported calling convention: PreserveAll");
                         return nullptr;
+                    case CC_AArch64VectorCall:
+                        emit_warning(c, source_loc, "unsupported calling convention: AArch64VectorCall");
+                        return nullptr;
                 }
 
                 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
 }
 
 static AstNode *trans_integer_literal(Context *c, const IntegerLiteral *stmt) {
-    llvm::APSInt result;
+    Expr::EvalResult result;
     if (!stmt->EvaluateAsInt(result, *c->ctx)) {
         emit_warning(c, stmt->getBeginLoc(), "invalid integer literal");
         return nullptr;
     }
-    return trans_create_node_apint(c, result);
+    return trans_create_node_apint(c, result.Val.getInt());
 }
 
 static 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 *
                 case BuiltinType::SatUShortFract:
                 case BuiltinType::SatUFract:
                 case BuiltinType::SatULongFract:
+                case BuiltinType::OCLIntelSubgroupAVCMcePayload:
+                case BuiltinType::OCLIntelSubgroupAVCImePayload:
+                case BuiltinType::OCLIntelSubgroupAVCRefPayload:
+                case BuiltinType::OCLIntelSubgroupAVCSicPayload:
+                case BuiltinType::OCLIntelSubgroupAVCMceResult:
+                case BuiltinType::OCLIntelSubgroupAVCImeResult:
+                case BuiltinType::OCLIntelSubgroupAVCRefResult:
+                case BuiltinType::OCLIntelSubgroupAVCSicResult:
+                case BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
+                case BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
+                case BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
+                case BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
                     return res;
             }
             break;
src/zig_llvm.cpp
@@ -594,8 +594,8 @@ ZigLLVMDIFile *ZigLLVMCreateFile(ZigLLVMDIBuilder *dibuilder, const char *filena
 
 ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMDIScope *scope,
         const char *name, const char *linkage_name, ZigLLVMDIFile *file, unsigned lineno,
-        ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition, unsigned scope_line,
-        unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram)
+        ZigLLVMDIType *fn_di_type, unsigned scope_line,
+        unsigned flags, ZigLLVMDISubprogram *decl_subprogram)
 {
     DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type));
     assert(flags == 0);
@@ -605,9 +605,12 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD
             reinterpret_cast<DIFile*>(file),
             lineno,
             di_sub_type,
-            is_local_to_unit, is_definition, scope_line, DINode::FlagZero, is_optimized,
+            scope_line,
+            DINode::FlagZero,
+            DISubprogram::SPFlagZero,
             nullptr,
-            reinterpret_cast<DISubprogram *>(decl_subprogram));
+            reinterpret_cast<DISubprogram *>(decl_subprogram),
+            nullptr);
     return reinterpret_cast<ZigLLVMDISubprogram*>(result);
 }
 
src/zig_llvm.h
@@ -188,8 +188,8 @@ ZIG_EXTERN_C struct ZigLLVMDIFile *ZigLLVMCreateFile(struct ZigLLVMDIBuilder *di
 
 ZIG_EXTERN_C struct ZigLLVMDISubprogram *ZigLLVMCreateFunction(struct ZigLLVMDIBuilder *dibuilder,
         struct ZigLLVMDIScope *scope, const char *name, const char *linkage_name, struct ZigLLVMDIFile *file,
-        unsigned lineno, struct ZigLLVMDIType *fn_di_type, bool is_local_to_unit, bool is_definition,
-        unsigned scope_line, unsigned flags, bool is_optimized, struct ZigLLVMDISubprogram *decl_subprogram);
+        unsigned lineno, struct ZigLLVMDIType *fn_di_type,
+        unsigned scope_line, unsigned flags, struct ZigLLVMDISubprogram *decl_subprogram);
 
 ZIG_EXTERN_C void ZigLLVMFnSetSubprogram(LLVMValueRef fn, struct ZigLLVMDISubprogram *subprogram);
 
@@ -361,8 +361,9 @@ enum ZigLLVM_OSType {
     ZigLLVM_Contiki,
     ZigLLVM_AMDPAL,     // AMD PAL Runtime
     ZigLLVM_HermitCore, // HermitCore Unikernel/Multikernel
+    ZigLLVM_Hurd,       // GNU/Hurd
 
-    ZigLLVM_LastOSType = ZigLLVM_HermitCore
+    ZigLLVM_LastOSType = ZigLLVM_Hurd
 };
 
 // Synchronize with target.cpp::environ_list