diff --git a/include/vast/CodeGen/CodeGen.hpp b/include/vast/CodeGen/CodeGen.hpp index 4fef413bc0..a38d105f4a 100644 --- a/include/vast/CodeGen/CodeGen.hpp +++ b/include/vast/CodeGen/CodeGen.hpp @@ -450,7 +450,7 @@ namespace vast::cg VAST_UNIMPLEMENTED; } else if (body) { if (mlir::failed(build_function_body(body))) { - VAST_UNREACHABLE("failed function body codegen"); + VAST_FATAL("failed function body codegen"); } } else { VAST_UNIMPLEMENTED_MSG("no definition for emitted function"); diff --git a/include/vast/CodeGen/CodeGenContext.hpp b/include/vast/CodeGen/CodeGenContext.hpp index 2e91ff53a7..3c53ff352e 100644 --- a/include/vast/CodeGen/CodeGenContext.hpp +++ b/include/vast/CodeGen/CodeGenContext.hpp @@ -215,7 +215,7 @@ namespace vast::cg if (const auto *d = llvm::dyn_cast< clang::NamedDecl >(dctx)) { name += get_decl_name(d); } else { - VAST_UNREACHABLE("unknown decl context: {0}", dctx->getDeclKindName()); + VAST_FATAL("unknown decl context: {0}", dctx->getDeclKindName()); } name += "::"; diff --git a/include/vast/CodeGen/CodeGenDeclVisitor.hpp b/include/vast/CodeGen/CodeGenDeclVisitor.hpp index f1f8560ffc..431b366bf3 100644 --- a/include/vast/CodeGen/CodeGenDeclVisitor.hpp +++ b/include/vast/CodeGen/CodeGenDeclVisitor.hpp @@ -185,7 +185,7 @@ namespace vast::cg { return fn; } - VAST_UNREACHABLE("NYI"); + VAST_UNIMPLEMENTED; // TODO: clang checks here if this is a llvm::GlobalAlias... how will we // support this? @@ -282,7 +282,7 @@ namespace vast::cg { return fn; } - VAST_UNREACHABLE("codegen of incomplete function"); + VAST_FATAL("codegen of incomplete function"); } vast_function get_addr_of_function( @@ -486,7 +486,7 @@ namespace vast::cg { case clang::SC_PrivateExtern: return hl::StorageClass::sc_private_extern; case clang::SC_Register: return hl::StorageClass::sc_register; } - VAST_UNREACHABLE("unknown storage class"); + VAST_UNIMPLEMENTED_MSG("unknown storage class"); } hl::TSClass VisitThreadStorageClass(const clang::VarDecl *decl) const { @@ -496,7 +496,7 @@ namespace vast::cg { case clang::TSCS_thread_local: return hl::TSClass::tsc_cxx_thread; case clang::TSCS__Thread_local: return hl::TSClass::tsc_c_thread; } - VAST_UNREACHABLE("unknown storage class"); + VAST_UNIMPLEMENTED_MSG("unknown thread storage class"); } operation VisitVarDecl(const clang::VarDecl *decl) { @@ -713,7 +713,7 @@ namespace vast::cg { case clang::AccessSpecifier::AS_none: return hl::AccessSpecifier::as_none; } - VAST_UNREACHABLE("unknown access specifier"); + VAST_UNIMPLEMENTED_MSG("unknown access specifier"); } // diff --git a/include/vast/CodeGen/CodeGenStmtVisitor.hpp b/include/vast/CodeGen/CodeGenStmtVisitor.hpp index 8fe8e88354..e684ef52dc 100644 --- a/include/vast/CodeGen/CodeGenStmtVisitor.hpp +++ b/include/vast/CodeGen/CodeGenStmtVisitor.hpp @@ -747,7 +747,7 @@ namespace vast::cg { return VisitFunctionDeclRefExpr(expr); } - VAST_UNREACHABLE("unknown underlying declaration to be referenced"); + VAST_UNIMPLEMENTED_MSG("unknown underlying declaration to be referenced"); } Operation *VisitPredefinedExpr(const clang::PredefinedExpr *expr) diff --git a/include/vast/CodeGen/UnreachableVisitor.hpp b/include/vast/CodeGen/UnreachableVisitor.hpp index 3088db7fe6..33352daa37 100644 --- a/include/vast/CodeGen/UnreachableVisitor.hpp +++ b/include/vast/CodeGen/UnreachableVisitor.hpp @@ -9,32 +9,32 @@ namespace vast::cg template< typename derived_t > struct unreach_stmt_visitor { operation Visit(const clang::Stmt *stmt) { - VAST_UNREACHABLE("unsupported stmt: {0}", stmt->getStmtClassName()); + VAST_FATAL("unsupported stmt: {0}", stmt->getStmtClassName()); } }; template< typename derived_t > struct unreach_decl_visitor { operation Visit(const clang::Decl *decl) { - VAST_UNREACHABLE("unsupported decl: {0}", decl->getDeclKindName()); + VAST_FATAL("unsupported decl: {0}", decl->getDeclKindName()); } }; template< typename derived_t > struct unreach_type_visitor { mlir_type Visit(clang::QualType type) { - VAST_UNREACHABLE("unsupported type: {0}", type.getAsString()); + VAST_FATAL("unsupported type: {0}", type.getAsString()); } mlir_type Visit(const clang::Type *type) { - VAST_UNREACHABLE("unsupported type: {0}", type->getTypeClassName()); + VAST_FATAL("unsupported type: {0}", type->getTypeClassName()); } }; template< typename derived_t > struct unreach_attr_visitor { mlir_attr Visit(const clang::Attr *attr) { - VAST_UNREACHABLE("unsupported attr: {0}", attr->getSpelling()); + VAST_FATAL("unsupported attr: {0}", attr->getSpelling()); } }; diff --git a/include/vast/Conversion/TypeConverters/HLToStd.hpp b/include/vast/Conversion/TypeConverters/HLToStd.hpp index ae7034ee25..950b5e1e79 100644 --- a/include/vast/Conversion/TypeConverters/HLToStd.hpp +++ b/include/vast/Conversion/TypeConverters/HLToStd.hpp @@ -227,7 +227,7 @@ namespace vast::conv::tc { case 128: return mlir::FloatType::getF128(&mctx); default: - VAST_UNREACHABLE("Cannot lower float bitsize {0}", target_bw); + VAST_FATAL("Cannot lower float bitsize {0}", target_bw); } }; } diff --git a/include/vast/Dialect/HighLevel/HighLevelTypes.hpp b/include/vast/Dialect/HighLevel/HighLevelTypes.hpp index 0728e1dfa5..e826e8c2f4 100644 --- a/include/vast/Dialect/HighLevel/HighLevelTypes.hpp +++ b/include/vast/Dialect/HighLevel/HighLevelTypes.hpp @@ -166,7 +166,7 @@ namespace vast::hl .Case< LongDoubleType >([&] (auto t) { return fty::getF80(ctx); }) .Case< Float128Type >([&] (auto t) { return fty::getF128(ctx); }) .Default([] (auto t) { - VAST_UNREACHABLE("unknown float type: {0}", format_type(t)); + VAST_FATAL("unknown float type: {0}", format_type(t)); return mlir_type(); }); } diff --git a/include/vast/Tower/Tower.hpp b/include/vast/Tower/Tower.hpp index 6d12a8d31e..ea822a76d8 100644 --- a/include/vast/Tower/Tower.hpp +++ b/include/vast/Tower/Tower.hpp @@ -46,7 +46,7 @@ namespace vast::tw { auto mod = _modules.back().get(); if (mlir::failed(pm.run(mod))) { - VAST_UNREACHABLE("error: some pass in apply() failed"); + VAST_FATAL("some pass in apply() failed"); } handle.mod.walk(loc_rewriter::remove); diff --git a/include/vast/Util/TypeList.hpp b/include/vast/Util/TypeList.hpp index 0c0206d6c9..cb5b110c63 100644 --- a/include/vast/Util/TypeList.hpp +++ b/include/vast/Util/TypeList.hpp @@ -158,7 +158,7 @@ namespace vast::util { constexpr ret dispatch(mlir_type type, fn &&f) { if constexpr ( list::empty ) { - VAST_UNREACHABLE( "missing type to dispatch" ); + VAST_FATAL( "missing type to dispatch" ); } else { using head = typename list::head; diff --git a/include/vast/repl/command.hpp b/include/vast/repl/command.hpp index 30138c7fb8..d336fe0b45 100644 --- a/include/vast/repl/command.hpp +++ b/include/vast/repl/command.hpp @@ -60,7 +60,7 @@ namespace vast::repl if (token == "ast") return enum_type::ast; if (token == "module") return enum_type::module; if (token == "symbols") return enum_type::symbols; - VAST_UNREACHABLE("uknnown show kind: {0}", token.str()); + VAST_FATAL("uknnown show kind: {0}", token.str()); } enum class meta_action { add, get }; @@ -69,7 +69,7 @@ namespace vast::repl enum_type from_string(string_ref token) requires(std::is_same_v< enum_type, meta_action >) { if (token == "add") return enum_type::add; if (token == "get") return enum_type::get; - VAST_UNREACHABLE("uknnown action kind: {0}", token.str()); + VAST_FATAL("uknnown action kind: {0}", token.str()); } // @@ -112,7 +112,7 @@ namespace vast::repl template< const char *name, typename params_storage > auto get_param(const params_storage ¶ms) { if constexpr (std::tuple_size_v< params_storage > == 0) { - VAST_UNREACHABLE(("unknown param name " + std::string(name)).c_str()); + VAST_FATAL(("unknown param name " + std::string(name)).c_str()); } else { using current = typename std::tuple_element< 0, params_storage >::type; @@ -267,7 +267,7 @@ namespace vast::repl } if constexpr (params_list::empty) { - VAST_UNREACHABLE(("no match for param: " + tokens.front()).str().c_str()); + VAST_FATAL(("no match for param: " + tokens.front()).str().c_str()); } else { using current_param = typename params_list::head; using rest = typename params_list::tail; @@ -296,7 +296,7 @@ namespace vast::repl if constexpr (commands::empty) { // we did not recursivelly match any of known commands - VAST_UNREACHABLE(("no match for command: " + tokens.front()).str().c_str()); + VAST_FATAL(("no match for command: " + tokens.front()).str().c_str()); } else { using current_command = typename commands::head; using rest = typename commands::tail; diff --git a/lib/vast/CodeGen/CodeGenDriver.cpp b/lib/vast/CodeGen/CodeGenDriver.cpp index da77e59b66..077b9764b1 100644 --- a/lib/vast/CodeGen/CodeGenDriver.cpp +++ b/lib/vast/CodeGen/CodeGenDriver.cpp @@ -163,7 +163,7 @@ namespace vast::cg if (const auto *var = llvm::dyn_cast< clang::VarDecl >(decl)) return build_global_var_definition(var, !var->hasDefinition()); - VAST_UNREACHABLE("Invalid argument to buildGlobalDefinition()"); + VAST_FATAL("Invalid argument to buildGlobalDefinition()"); } @@ -312,7 +312,7 @@ namespace vast::cg return true; } - VAST_UNREACHABLE("unsupported value decl"); + VAST_UNIMPLEMENTED_MSG("unsupported value decl"); } void codegen_driver::build_default_methods() { diff --git a/lib/vast/CodeGen/CodeGenStmtVisitor.cpp b/lib/vast/CodeGen/CodeGenStmtVisitor.cpp index 98233f2e7d..a5e32378bc 100644 --- a/lib/vast/CodeGen/CodeGenStmtVisitor.cpp +++ b/lib/vast/CodeGen/CodeGenStmtVisitor.cpp @@ -86,7 +86,7 @@ namespace vast::hl case clang::CastKind::CK_MatrixCast: return CastKind::MatrixCast; } - VAST_UNREACHABLE( "unsupported cast kind" ); + VAST_UNIMPLEMENTED_MSG( "unsupported cast kind" ); } IdentKind ident_kind(const clang::PredefinedExpr *expr) diff --git a/lib/vast/CodeGen/CodeGenTypeVisitor.cpp b/lib/vast/CodeGen/CodeGenTypeVisitor.cpp index 2b740dda18..0b52eb2e94 100644 --- a/lib/vast/CodeGen/CodeGenTypeVisitor.cpp +++ b/lib/vast/CodeGen/CodeGenTypeVisitor.cpp @@ -30,7 +30,7 @@ namespace vast::cg { case BuiltinType::UInt128: return hl::IntegerKind::Int128; default: - VAST_UNREACHABLE("unknown integer kind"); + VAST_UNIMPLEMENTED_MSG("unknown integer kind"); } } @@ -51,7 +51,7 @@ namespace vast::cg { case BuiltinType::Float128: return hl::FloatingKind::Float128; default: - VAST_UNREACHABLE("unknown floating kind"); + VAST_UNIMPLEMENTED_MSG("unknown floating kind"); } } diff --git a/lib/vast/Dialect/Core/Linkage.cpp b/lib/vast/Dialect/Core/Linkage.cpp index b968c2454a..11e15615d3 100644 --- a/lib/vast/Dialect/Core/Linkage.cpp +++ b/lib/vast/Dialect/Core/Linkage.cpp @@ -39,7 +39,7 @@ namespace vast::core { return true; } - VAST_UNREACHABLE("No such linkage"); + VAST_FATAL("No such linkage"); } bool is_vardecl_strong_definition(const clang::VarDecl* decl) { @@ -149,10 +149,8 @@ namespace vast::core { case GlobalLinkageKind::PrivateLinkage: return Visibility::Private; default: - VAST_UNREACHABLE("unsupported linkage kind {0}", stringifyGlobalLinkageKind(linkage)); + VAST_FATAL("unsupported linkage kind {0}", stringifyGlobalLinkageKind(linkage)); } - - VAST_UNREACHABLE("missed linkage kind"); } GlobalLinkageKind get_declarator_linkage( diff --git a/lib/vast/Dialect/HighLevel/HighLevelTypes.cpp b/lib/vast/Dialect/HighLevel/HighLevelTypes.cpp index f24fac26d0..428a077d79 100644 --- a/lib/vast/Dialect/HighLevel/HighLevelTypes.cpp +++ b/lib/vast/Dialect/HighLevel/HighLevelTypes.cpp @@ -57,7 +57,7 @@ namespace vast::hl } } - VAST_UNREACHABLE("unknown typedef name"); + VAST_FATAL("unknown typedef name"); } auto name_of_record(mlir_type t) -> std::optional< std::string > @@ -77,7 +77,7 @@ namespace vast::hl if (auto ty = type.dyn_cast< TypedefType >()) return getFunctionType(getTypedefType(ty, mod), mod); - VAST_UNREACHABLE("unknown type to extract function type"); + VAST_UNIMPLEMENTED_MSG("unknown type to extract function type"); } core::FunctionType getFunctionType(Value callee) { @@ -102,7 +102,7 @@ namespace vast::hl return getFunctionType(value.getType(), mod); } - VAST_UNREACHABLE("unknown callee type"); + VAST_UNIMPLEMENTED_MSG("unknown callee type"); } diff --git a/lib/vast/Dialect/HighLevel/HighLevelVar.cpp b/lib/vast/Dialect/HighLevel/HighLevelVar.cpp index f4f801b26e..1516690427 100644 --- a/lib/vast/Dialect/HighLevel/HighLevelVar.cpp +++ b/lib/vast/Dialect/HighLevel/HighLevelVar.cpp @@ -38,7 +38,7 @@ namespace vast::hl return DeclContextKind::dc_record; if (mlir::isa< EnumDeclOp >(st)) return DeclContextKind::dc_enum; - VAST_UNREACHABLE("unknown declaration context"); + VAST_UNIMPLEMENTED_MSG("unknown declaration context"); } bool VarDeclOp::isStaticDataMember() { @@ -63,7 +63,7 @@ namespace vast::hl case StorageClass::sc_private_extern: return false; } - VAST_UNREACHABLE("unknown starage class"); + VAST_UNIMPLEMENTED_MSG("unknown starage class"); } bool VarDeclOp::isStaticLocal() { diff --git a/lib/vast/Frontend/Action.cpp b/lib/vast/Frontend/Action.cpp index f369f6f09b..17998798e3 100644 --- a/lib/vast/Frontend/Action.cpp +++ b/lib/vast/Frontend/Action.cpp @@ -44,7 +44,7 @@ namespace vast::cc { break; } - VAST_UNREACHABLE("unsupported action type"); + VAST_FATAL("unsupported action type"); } static auto get_output_stream(compiler_instance &ci, string_ref in, output_type act) diff --git a/lib/vast/Frontend/Consumer.cpp b/lib/vast/Frontend/Consumer.cpp index ea69b278c9..c676da20c3 100644 --- a/lib/vast/Frontend/Consumer.cpp +++ b/lib/vast/Frontend/Consumer.cpp @@ -79,7 +79,7 @@ namespace vast::cc { if (!vargs.has_option(opt::disable_vast_verifier)) { if (!codegen->verify_module()) { - VAST_UNREACHABLE("codegen: module verification error before running vast passes"); + VAST_FATAL("codegen: module verification error before running vast passes"); } } } @@ -213,7 +213,7 @@ namespace vast::cc { // diagnostics matched. if (verify_diagnostics && src_mgr_handler.verify().failed()) { llvm::sys::RunInterruptHandlers(); - VAST_UNREACHABLE("failed mlir codegen"); + VAST_FATAL("failed mlir codegen"); } // Emit remaining defaulted C++ methods @@ -233,9 +233,8 @@ namespace vast::cc { pipeline_source::ast, output_type::emit_mlir, *mctx, vargs, default_pipelines_config() ); - if (mlir::failed(pipeline->run(mod))) { - VAST_UNREACHABLE("MLIR pass manager failed when running vast passes"); - } + auto result = pipeline->run(mod); + VAST_CHECK(mlir::succeeded(result), "MLIR pass manager failed when running vast passes"); } source_language get_source_language(const cc::language_options &opts) { diff --git a/lib/vast/Frontend/Targets.cpp b/lib/vast/Frontend/Targets.cpp index afa9fe2185..ac291d0bff 100644 --- a/lib/vast/Frontend/Targets.cpp +++ b/lib/vast/Frontend/Targets.cpp @@ -15,7 +15,7 @@ namespace vast::cc { if (trg == "cir") { return target_dialect::cir; } - VAST_UNREACHABLE("Unknown option of target dialect: {0}", trg); + VAST_FATAL("Unknown option of target dialect: {0}", trg); } std::string to_string(target_dialect target) { diff --git a/tools/vast-front/compiler_invocation.cpp b/tools/vast-front/compiler_invocation.cpp index dadd8a2791..346d5f7417 100644 --- a/tools/vast-front/compiler_invocation.cpp +++ b/tools/vast-front/compiler_invocation.cpp @@ -51,7 +51,7 @@ namespace vast::cc case EmitAssembly: return std::make_unique< vast::cc::emit_assembly_action >(vargs); case EmitLLVM: return std::make_unique< vast::cc::emit_llvm_action >(vargs); case EmitObj: return std::make_unique< vast::cc::emit_obj_action >(vargs); - default: VAST_UNREACHABLE("unsupported frontend action"); + default: VAST_UNIMPLEMENTED_MSG("unsupported frontend action"); } VAST_UNIMPLEMENTED_MSG("not implemented frontend action"); diff --git a/tools/vast-repl/command.cpp b/tools/vast-repl/command.cpp index 9ec3cbb567..f1f79d73d5 100644 --- a/tools/vast-repl/command.cpp +++ b/tools/vast-repl/command.cpp @@ -145,7 +145,7 @@ namespace vast::repl::cmd { auto th = state.tower->top(); for (auto pass : passes) { if (mlir::failed(mlir::parsePassPipeline(pass, pm))) { - VAST_UNREACHABLE("error: failed to parse pass pipeline"); + VAST_FATAL("failed to parse pass pipeline"); } th = state.tower->apply(th, pm); } diff --git a/tools/vast-repl/vast-repl.cpp b/tools/vast-repl/vast-repl.cpp index 765a7676b0..84c1d0c5e3 100644 --- a/tools/vast-repl/vast-repl.cpp +++ b/tools/vast-repl/vast-repl.cpp @@ -44,7 +44,7 @@ namespace vast::repl auto params = parse_params< cmd::load::command_params >(args); cli.exec(make_command< cmd::load >(params)); } else { - VAST_UNREACHABLE("unsupported arguments"); + VAST_FATAL("unsupported arguments"); } }