diff --git a/compiler/dsl/dsl.h b/compiler/dsl/dsl.h index 244bdd62..97cf3fef 100644 --- a/compiler/dsl/dsl.h +++ b/compiler/dsl/dsl.h @@ -7,7 +7,7 @@ #include #include -namespace seq { +namespace codon { /// Base class for DSL plugins. Plugins will return an instance of /// a child of this class, which defines various characteristics of @@ -69,4 +69,4 @@ public: virtual std::vector getBinaryKeywords() { return {}; } }; -} // namespace seq +} // namespace codon diff --git a/compiler/dsl/plugins.cpp b/compiler/dsl/plugins.cpp index d644b252..736e6944 100644 --- a/compiler/dsl/plugins.cpp +++ b/compiler/dsl/plugins.cpp @@ -2,7 +2,7 @@ #include "util/common.h" #include -namespace seq { +namespace codon { PluginManager::~PluginManager() { for (auto &plugin : plugins) { @@ -35,4 +35,4 @@ PluginManager::Error PluginManager::load(DSL *dsl) { return Error::NONE; } -} // namespace seq +} // namespace codon diff --git a/compiler/dsl/plugins.h b/compiler/dsl/plugins.h index cc94f9d8..94a5e8ee 100644 --- a/compiler/dsl/plugins.h +++ b/compiler/dsl/plugins.h @@ -6,7 +6,7 @@ #include #include -namespace seq { +namespace codon { /// Plugin metadata struct Plugin { @@ -47,4 +47,4 @@ public: Error load(DSL *dsl); }; -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ast/expr.cpp b/compiler/parser/ast/expr.cpp index 0ab16ae3..2c31a4b1 100644 --- a/compiler/parser/ast/expr.cpp +++ b/compiler/parser/ast/expr.cpp @@ -21,7 +21,7 @@ using fmt::format; using std::move; -namespace seq { +namespace codon { namespace ast { Expr::Expr() @@ -441,4 +441,4 @@ string StackAllocExpr::toString() const { ACCEPT_IMPL(StackAllocExpr, ASTVisitor); } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ast/expr.h b/compiler/parser/ast/expr.h index 8a59793e..a9f1a9bf 100644 --- a/compiler/parser/ast/expr.h +++ b/compiler/parser/ast/expr.h @@ -17,7 +17,7 @@ #include "parser/ast/types.h" #include "parser/common.h" -namespace seq { +namespace codon { namespace ast { #define ACCEPT(X) \ @@ -62,7 +62,7 @@ struct StaticValue { * A Seq AST expression. * Each AST expression is intended to be instantiated as a shared_ptr. */ -struct Expr : public seq::SrcObject { +struct Expr : public codon::SrcObject { typedef Expr base_type; // private: @@ -139,7 +139,7 @@ protected: using ExprPtr = shared_ptr; /// Function signature parameter helper node (name: type = deflt). -struct Param : public seq::SrcObject { +struct Param : public codon::SrcObject { string name; ExprPtr type; ExprPtr deflt; @@ -675,4 +675,4 @@ struct StackAllocExpr : Expr { #undef ACCEPT } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ast/stmt.cpp b/compiler/parser/ast/stmt.cpp index aa8b9215..0d63d8be 100644 --- a/compiler/parser/ast/stmt.cpp +++ b/compiler/parser/ast/stmt.cpp @@ -22,11 +22,11 @@ using std::move; const int INDENT_SIZE = 2; -namespace seq { +namespace codon { namespace ast { Stmt::Stmt() : done(false), age(-1) {} -Stmt::Stmt(const seq::SrcInfo &s) : done(false) { setSrcInfo(s); } +Stmt::Stmt(const codon::SrcInfo &s) : done(false) { setSrcInfo(s); } string Stmt::toString() const { return toString(-1); } SuiteStmt::SuiteStmt(vector stmts, bool ownBlock) @@ -419,4 +419,4 @@ string UpdateStmt::toString(int) const { ACCEPT_IMPL(UpdateStmt, ASTVisitor); } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ast/stmt.h b/compiler/parser/ast/stmt.h index 809d7033..f0eb7c70 100644 --- a/compiler/parser/ast/stmt.h +++ b/compiler/parser/ast/stmt.h @@ -17,7 +17,7 @@ #include "parser/ast/types.h" #include "parser/common.h" -namespace seq { +namespace codon { namespace ast { #define ACCEPT(X) \ @@ -37,7 +37,7 @@ struct FunctionStmt; * A Seq AST statement. * Each AST statement is intended to be instantiated as a shared_ptr. */ -struct Stmt : public seq::SrcObject { +struct Stmt : public codon::SrcObject { typedef Stmt base_type; /// Flag that indicates if all types in a statement are inferred (i.e. if a @@ -49,7 +49,7 @@ struct Stmt : public seq::SrcObject { public: Stmt(); Stmt(const Stmt &s) = default; - explicit Stmt(const seq::SrcInfo &s); + explicit Stmt(const codon::SrcInfo &s); /// Convert a node to an S-expression. string toString() const; @@ -561,4 +561,4 @@ struct UpdateStmt : public Stmt { #undef ACCEPT } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ast/types.cpp b/compiler/parser/ast/types.cpp index e2f3cc16..a791bf3a 100644 --- a/compiler/parser/ast/types.cpp +++ b/compiler/parser/ast/types.cpp @@ -19,7 +19,7 @@ using std::dynamic_pointer_cast; using std::min; using std::static_pointer_cast; -namespace seq { +namespace codon { namespace ast { namespace types { @@ -810,4 +810,4 @@ string CallableTrait::debugString(bool debug) const { } // namespace types } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ast/types.h b/compiler/parser/ast/types.h index 1dbcebf0..b2c82835 100644 --- a/compiler/parser/ast/types.h +++ b/compiler/parser/ast/types.h @@ -16,7 +16,7 @@ #include "parser/common.h" -namespace seq { +namespace codon { namespace ast { struct Expr; @@ -42,7 +42,7 @@ struct StaticType; * Type instances are widely mutated during the type inference and each type is intended * to be instantiated and manipulated as a shared_ptr. */ -struct Type : public seq::SrcObject, public std::enable_shared_from_this { +struct Type : public codon::SrcObject, public std::enable_shared_from_this { /// A structure that keeps the list of unification steps that can be undone later. /// Needed because the unify() is destructive. struct Unification { @@ -417,4 +417,4 @@ public: } // namespace types } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/cache.cpp b/compiler/parser/cache.cpp index 77872a99..3c76c7ff 100644 --- a/compiler/parser/cache.cpp +++ b/compiler/parser/cache.cpp @@ -16,7 +16,7 @@ #include "parser/visitors/typecheck/typecheck.h" #include "parser/visitors/typecheck/typecheck_ctx.h" -namespace seq { +namespace codon { namespace ast { Cache::Cache(string argv0) @@ -142,4 +142,4 @@ ir::types::Type *Cache::makeFunction(const vector &types) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/cache.h b/compiler/parser/cache.h index c45fe910..edeee2ff 100644 --- a/compiler/parser/cache.h +++ b/compiler/parser/cache.h @@ -44,7 +44,7 @@ #define FLAG_ATOMIC 2 #define FLAG_TEST 4 -namespace seq { +namespace codon { namespace ast { /// Forward declarations @@ -98,7 +98,7 @@ struct Cache : public std::enable_shared_from_this { /// Absolute path of the entry-point module (if available). string module0; /// LLVM module. - seq::ir::Module *module = nullptr; + codon::ir::Module *module = nullptr; /// Table of imported files that maps an absolute filename to a Import structure. /// By convention, the key of Seq standard library is "". @@ -147,7 +147,7 @@ struct Cache : public std::enable_shared_from_this { /// A list of field names and realization's realized field types. vector> fields; /// IR type pointer. - seq::ir::types::Type *ir; + codon::ir::types::Type *ir; }; /// Realization lookup table that maps a realized class name to the corresponding /// ClassRealization instance. @@ -245,4 +245,4 @@ public: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/common.cpp b/compiler/parser/common.cpp index 29a95009..23193706 100644 --- a/compiler/parser/common.cpp +++ b/compiler/parser/common.cpp @@ -13,7 +13,7 @@ #include "parser/common.h" #include "util/fmt/format.h" -namespace seq { +namespace codon { namespace ast { /// String and collection utilities @@ -136,7 +136,7 @@ bool isdigit(const string &str) { /// AST utilities void error(const char *format) { throw exc::ParserException(format); } -void error(const ::seq::SrcInfo &info, const char *format) { +void error(const ::codon::SrcInfo &info, const char *format) { throw exc::ParserException(format, info); } @@ -268,4 +268,4 @@ shared_ptr getImportFile(const string &argv0, const string &what, } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/common.h b/compiler/parser/common.h index 4015e234..d5476f1b 100644 --- a/compiler/parser/common.h +++ b/compiler/parser/common.h @@ -37,7 +37,7 @@ using std::vector; #include "compiler/util/fmt/format.h" #include "compiler/util/fmt/ostream.h" -namespace seq { +namespace codon { namespace exc { @@ -203,4 +203,4 @@ shared_ptr getImportFile(const string &argv0, const string &what, const string &module0 = ""); } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/ctx.h b/compiler/parser/ctx.h index 2c6bf8a7..c4570e3b 100644 --- a/compiler/parser/ctx.h +++ b/compiler/parser/ctx.h @@ -19,7 +19,7 @@ #include "parser/ast.h" #include "parser/common.h" -namespace seq { +namespace codon { namespace ast { /** @@ -139,4 +139,4 @@ private: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/parser.cpp b/compiler/parser/parser.cpp index 54922e43..ce8af653 100644 --- a/compiler/parser/parser.cpp +++ b/compiler/parser/parser.cpp @@ -32,7 +32,7 @@ int _level = 0; int _dbg_level = 0; bool _isTest = false; -namespace seq { +namespace codon { ir::Module *parse(const string &argv0, const string &file, const string &code, bool isCode, int isTest, int startLine, @@ -115,7 +115,7 @@ ir::Module *parse(const string &argv0, const string &file, const string &code, duration_cast(high_resolution_clock::now() - t).count() / 1000.0); if (_dbg_level) { - auto out = seq::ir::util::format(module); + auto out = codon::ir::util::format(module); std::ofstream os("_dump_sir.lisp"); os << out; os.close(); @@ -156,4 +156,4 @@ void generateDocstr(const string &argv0) { } } -} // namespace seq +} // namespace codon diff --git a/compiler/parser/parser.h b/compiler/parser/parser.h index 762338dc..cfda000f 100644 --- a/compiler/parser/parser.h +++ b/compiler/parser/parser.h @@ -15,9 +15,9 @@ #include "sir/sir.h" #include "util/common.h" -namespace seq { +namespace codon { -seq::ir::Module *parse(const std::string &argv0, const std::string &file, +codon::ir::Module *parse(const std::string &argv0, const std::string &file, const std::string &code = "", bool isCode = false, int isTest = 0, int startLine = 0, const std::unordered_map &defines = @@ -25,4 +25,4 @@ seq::ir::Module *parse(const std::string &argv0, const std::string &file, void generateDocstr(const std::string &argv0); -} // namespace seq +} // namespace codon diff --git a/compiler/parser/peg/grammar.peg b/compiler/parser/peg/grammar.peg index 535ce7f2..90227dc3 100644 --- a/compiler/parser/peg/grammar.peg +++ b/compiler/parser/peg/grammar.peg @@ -7,7 +7,7 @@ #include "parser/peg/rules.h" #include using namespace std; - using namespace seq::ast; + using namespace codon::ast; #define V0 VS[0] #define V1 VS[1] @@ -25,13 +25,13 @@ t->setSrcInfo(s); return std::static_pointer_cast(t); } - auto chain(peg::SemanticValues &VS, const seq::SrcInfo &LOC) { + auto chain(peg::SemanticValues &VS, const codon::SrcInfo &LOC) { auto b = ac_expr(V0); for (int i = 1; i < VS.size(); i++) b = ast(LOC, b, VS.token_to_string(i - 1), ac_expr(VS[i])); return b; } - auto wrap_tuple(peg::SemanticValues &VS, const seq::SrcInfo &LOC) { + auto wrap_tuple(peg::SemanticValues &VS, const codon::SrcInfo &LOC) { if (VS.size() == 1 && VS.tokens.empty()) return ac_expr(V0); return ast(LOC, VS.transform()); diff --git a/compiler/parser/peg/openmp.peg b/compiler/parser/peg/openmp.peg index 76805faf..dbeece2e 100644 --- a/compiler/parser/peg/openmp.peg +++ b/compiler/parser/peg/openmp.peg @@ -4,7 +4,7 @@ #include "parser/peg/rules.h" #include using namespace std; - using namespace seq::ast; + using namespace codon::ast; #define V0 VS[0] #define V1 VS[1] diff --git a/compiler/parser/peg/peg.cpp b/compiler/parser/peg/peg.cpp index 27f0b63e..b59e0414 100644 --- a/compiler/parser/peg/peg.cpp +++ b/compiler/parser/peg/peg.cpp @@ -24,7 +24,7 @@ extern int _ocaml_time; using namespace std; -namespace seq { +namespace codon { namespace ast { static shared_ptr grammar(nullptr); @@ -93,7 +93,7 @@ StmtPtr parseCode(const shared_ptr &cache, const string &file, } ExprPtr parseExpr(const shared_ptr &cache, const string &code, - const seq::SrcInfo &offset) { + const codon::SrcInfo &offset) { return parseCode(cache, offset.file, code, offset.line, offset.col, "fstring"); } @@ -138,7 +138,7 @@ shared_ptr initOpenMPParser() { } vector parseOpenMP(const shared_ptr &cache, const string &code, - const seq::SrcInfo &loc) { + const codon::SrcInfo &loc) { if (!ompGrammar) ompGrammar = initOpenMPParser(); @@ -162,4 +162,4 @@ vector parseOpenMP(const shared_ptr &cache, const string & } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/peg/peg.h b/compiler/parser/peg/peg.h index 9f2ec5a6..d1a9452a 100644 --- a/compiler/parser/peg/peg.h +++ b/compiler/parser/peg/peg.h @@ -16,7 +16,7 @@ #include "parser/cache.h" #include "util/common.h" -namespace seq { +namespace codon { namespace ast { /// Parse a Seq code block with the appropriate file and position offsets. @@ -24,13 +24,13 @@ StmtPtr parseCode(const shared_ptr &cache, const string &file, const string &code, int line_offset = 0); /// Parse a Seq code expression. ExprPtr parseExpr(const shared_ptr &cache, const string &code, - const seq::SrcInfo &offset); + const codon::SrcInfo &offset); /// Parse a Seq file. StmtPtr parseFile(const shared_ptr &cache, const string &file); /// Parse a OpenMP clause. vector parseOpenMP(const shared_ptr &cache, const string &code, - const seq::SrcInfo &loc); + const codon::SrcInfo &loc); } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/peg/rules.h b/compiler/parser/peg/rules.h index 20d2cbc8..c8927e40 100644 --- a/compiler/parser/peg/rules.h +++ b/compiler/parser/peg/rules.h @@ -21,7 +21,7 @@ #include "parser/common.h" #include "util/peglib.h" -namespace seq { +namespace codon { namespace ast { struct ParseContext { @@ -46,7 +46,7 @@ struct ParseContext { }; } // namespace ast -} // namespace seq +} // namespace codon void init_codon_rules(peg::Grammar &); void init_codon_actions(peg::Grammar &); diff --git a/compiler/parser/visitors/doc/doc.cpp b/compiler/parser/visitors/doc/doc.cpp index a80a5bc5..a50b3863 100644 --- a/compiler/parser/visitors/doc/doc.cpp +++ b/compiler/parser/visitors/doc/doc.cpp @@ -24,7 +24,7 @@ using std::ostream; using std::stack; using std::to_string; -namespace seq { +namespace codon { namespace ast { // clang-format off @@ -350,7 +350,7 @@ void DocVisitor::visit(ClassStmt *stmt) { resultStmt = to_string(id); } -shared_ptr DocVisitor::jsonify(const seq::SrcInfo &s) { +shared_ptr DocVisitor::jsonify(const codon::SrcInfo &s) { return make_shared(vector{to_string(s.line), to_string(s.len)}); } @@ -449,4 +449,4 @@ void DocVisitor::visit(AssignStmt *stmt) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/doc/doc.h b/compiler/parser/visitors/doc/doc.h index 833da8d8..a54c66e3 100644 --- a/compiler/parser/visitors/doc/doc.h +++ b/compiler/parser/visitors/doc/doc.h @@ -20,7 +20,7 @@ #include "parser/ctx.h" #include "parser/visitors/visitor.h" -namespace seq { +namespace codon { namespace ast { struct json { @@ -75,7 +75,7 @@ public: string transform(const StmtPtr &e) override; void transformModule(StmtPtr stmt); - shared_ptr jsonify(const seq::SrcInfo &s); + shared_ptr jsonify(const codon::SrcInfo &s); vector flatten(StmtPtr stmt, string *docstr = nullptr, bool deep = true); public: @@ -89,4 +89,4 @@ public: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/format/format.cpp b/compiler/parser/visitors/format/format.cpp index 77ff662e..0495aaf3 100644 --- a/compiler/parser/visitors/format/format.cpp +++ b/compiler/parser/visitors/format/format.cpp @@ -6,7 +6,7 @@ using fmt::format; -namespace seq { +namespace codon { namespace ast { FormatVisitor::FormatVisitor(bool html, shared_ptr cache) @@ -438,4 +438,4 @@ void FormatVisitor::visit(YieldFromStmt *stmt) { void FormatVisitor::visit(WithStmt *stmt) {} } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/format/format.h b/compiler/parser/visitors/format/format.h index 73071bf3..9a1200a8 100644 --- a/compiler/parser/visitors/format/format.h +++ b/compiler/parser/visitors/format/format.h @@ -17,7 +17,7 @@ #include "parser/common.h" #include "parser/visitors/visitor.h" -namespace seq { +namespace codon { namespace ast { class FormatVisitor : public CallbackASTVisitor { @@ -140,4 +140,4 @@ public: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/simplify/simplify.cpp b/compiler/parser/visitors/simplify/simplify.cpp index 48dd6751..781854b3 100644 --- a/compiler/parser/visitors/simplify/simplify.cpp +++ b/compiler/parser/visitors/simplify/simplify.cpp @@ -27,7 +27,7 @@ using std::ostream; using std::pair; using std::stack; -namespace seq { +namespace codon { namespace ast { using namespace types; @@ -40,7 +40,7 @@ StmtPtr SimplifyVisitor::apply(shared_ptr cache, const StmtPtr &node, auto preamble = make_shared(); if (!cache->module) - cache->module = new seq::ir::Module("", cache); + cache->module = new codon::ir::Module("", cache); // Load standard library if it has not been loaded. if (!in(cache->imports, STDLIB_IMPORT)) { @@ -187,4 +187,4 @@ SimplifyVisitor::SimplifyVisitor(shared_ptr ctx, : ctx(move(ctx)), preamble(move(preamble)) {} } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/simplify/simplify.h b/compiler/parser/visitors/simplify/simplify.h index 37f3b5dc..4a7d1a66 100644 --- a/compiler/parser/visitors/simplify/simplify.h +++ b/compiler/parser/visitors/simplify/simplify.h @@ -17,7 +17,7 @@ #include "parser/visitors/simplify/simplify_ctx.h" #include "parser/visitors/visitor.h" -namespace seq { +namespace codon { namespace ast { /** @@ -492,4 +492,4 @@ private: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/simplify/simplify_ctx.cpp b/compiler/parser/visitors/simplify/simplify_ctx.cpp index ed5d4710..78ed8299 100644 --- a/compiler/parser/visitors/simplify/simplify_ctx.cpp +++ b/compiler/parser/visitors/simplify/simplify_ctx.cpp @@ -19,7 +19,7 @@ using fmt::format; using std::dynamic_pointer_cast; using std::stack; -namespace seq { +namespace codon { namespace ast { SimplifyItem::SimplifyItem(Kind k, string base, string canonicalName, bool global) @@ -101,4 +101,4 @@ void SimplifyContext::dump(int pad) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/simplify/simplify_ctx.h b/compiler/parser/visitors/simplify/simplify_ctx.h index b0ea14a2..b1b05329 100644 --- a/compiler/parser/visitors/simplify/simplify_ctx.h +++ b/compiler/parser/visitors/simplify/simplify_ctx.h @@ -20,7 +20,7 @@ #include "parser/common.h" #include "parser/ctx.h" -namespace seq { +namespace codon { namespace ast { /** @@ -129,4 +129,4 @@ private: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/simplify/simplify_expr.cpp b/compiler/parser/visitors/simplify/simplify_expr.cpp index 45b5a3e9..ac2a5a8b 100644 --- a/compiler/parser/visitors/simplify/simplify_expr.cpp +++ b/compiler/parser/visitors/simplify/simplify_expr.cpp @@ -19,7 +19,7 @@ using fmt::format; -namespace seq { +namespace codon { namespace ast { ExprPtr SimplifyVisitor::transform(const ExprPtr &expr) { @@ -792,4 +792,4 @@ ExprPtr SimplifyVisitor::makeAnonFn(vector stmts, } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/simplify/simplify_stmt.cpp b/compiler/parser/visitors/simplify/simplify_stmt.cpp index 0bb87d31..d95dac22 100644 --- a/compiler/parser/visitors/simplify/simplify_stmt.cpp +++ b/compiler/parser/visitors/simplify/simplify_stmt.cpp @@ -20,7 +20,7 @@ using fmt::format; using std::dynamic_pointer_cast; -namespace seq { +namespace codon { namespace ast { struct ReplacementVisitor : ReplaceASTVisitor { @@ -1747,4 +1747,4 @@ vector SimplifyVisitor::getClassMethods(const StmtPtr &s) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/translate/translate.cpp b/compiler/parser/visitors/translate/translate.cpp index fe423d4a..ad8dc5b4 100644 --- a/compiler/parser/visitors/translate/translate.cpp +++ b/compiler/parser/visitors/translate/translate.cpp @@ -19,8 +19,8 @@ #include "sir/util/cloning.h" using fmt::format; -using seq::ir::cast; -using seq::ir::transform::parallel::OMPSched; +using codon::ir::cast; +using codon::ir::transform::parallel::OMPSched; using std::function; using std::get; using std::make_shared; @@ -29,7 +29,7 @@ using std::shared_ptr; using std::stack; using std::vector; -namespace seq { +namespace codon { namespace ast { TranslateVisitor::TranslateVisitor(shared_ptr ctx) @@ -394,7 +394,7 @@ void TranslateVisitor::visit(ClassStmt *stmt) { /************************************************************************************/ -seq::ir::types::Type *TranslateVisitor::getType(const types::TypePtr &t) { +codon::ir::types::Type *TranslateVisitor::getType(const types::TypePtr &t) { seqassert(t && t->getClass(), "{} is not a class", t ? t->toString() : "-"); string name = t->getClass()->realizedTypeName(); auto i = ctx->find(name); @@ -407,7 +407,7 @@ void TranslateVisitor::transformFunction(types::FuncType *type, FunctionStmt *as vector names; vector indices; vector srcInfos; - vector types; + vector types; for (int i = 0, j = 1; i < ast->args.size(); i++) if (!ast->args[i].generic) { if (!type->args[j]->getFunc()) { @@ -456,7 +456,7 @@ void TranslateVisitor::transformFunction(types::FuncType *type, FunctionStmt *as void TranslateVisitor::transformLLVMFunction(types::FuncType *type, FunctionStmt *ast, ir::Func *func) { vector names; - vector types; + vector types; vector indices; for (int i = 0, j = 1; i < ast->args.size(); i++) if (!ast->args[i].generic) { @@ -523,4 +523,4 @@ void TranslateVisitor::transformLLVMFunction(types::FuncType *type, FunctionStmt } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/translate/translate.h b/compiler/parser/visitors/translate/translate.h index f3203436..168db9ef 100644 --- a/compiler/parser/visitors/translate/translate.h +++ b/compiler/parser/visitors/translate/translate.h @@ -21,7 +21,7 @@ #include "parser/visitors/visitor.h" #include "sir/sir.h" -namespace seq { +namespace codon { namespace ast { class TranslateVisitor : public CallbackASTVisitor { @@ -30,7 +30,7 @@ class TranslateVisitor : public CallbackASTVisitor { public: explicit TranslateVisitor(shared_ptr ctx); - static seq::ir::Module *apply(shared_ptr cache, StmtPtr stmts); + static codon::ir::Module *apply(shared_ptr cache, StmtPtr stmts); ir::Value *transform(const ExprPtr &expr) override; ir::Value *transform(const StmtPtr &stmt) override; @@ -84,4 +84,4 @@ private: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/translate/translate_ctx.cpp b/compiler/parser/visitors/translate/translate_ctx.cpp index 31ba2c2c..5a5842f6 100644 --- a/compiler/parser/visitors/translate/translate_ctx.cpp +++ b/compiler/parser/visitors/translate/translate_ctx.cpp @@ -14,11 +14,11 @@ #include "parser/visitors/translate/translate_ctx.h" #include "parser/visitors/typecheck/typecheck_ctx.h" -namespace seq { +namespace codon { namespace ast { -TranslateContext::TranslateContext(shared_ptr cache, seq::ir::SeriesFlow *series, - seq::ir::BodiedFunc *base) +TranslateContext::TranslateContext(shared_ptr cache, codon::ir::SeriesFlow *series, + codon::ir::BodiedFunc *base) : Context(""), cache(std::move(cache)) { stack.push_front(vector()); bases.push_back(base); @@ -62,14 +62,14 @@ shared_ptr TranslateContext::add(TranslateItem::Kind kind, return it; } -void TranslateContext::addSeries(seq::ir::SeriesFlow *s) { series.push_back(s); } +void TranslateContext::addSeries(codon::ir::SeriesFlow *s) { series.push_back(s); } void TranslateContext::popSeries() { series.pop_back(); } -seq::ir::Module *TranslateContext::getModule() const { - return dynamic_cast(bases[0]->getModule()); +codon::ir::Module *TranslateContext::getModule() const { + return dynamic_cast(bases[0]->getModule()); } -seq::ir::BodiedFunc *TranslateContext::getBase() const { return bases.back(); } -seq::ir::SeriesFlow *TranslateContext::getSeries() const { return series.back(); } +codon::ir::BodiedFunc *TranslateContext::getBase() const { return bases.back(); } +codon::ir::SeriesFlow *TranslateContext::getSeries() const { return series.back(); } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/translate/translate_ctx.h b/compiler/parser/visitors/translate/translate_ctx.h index 32bd87de..ce69ca15 100644 --- a/compiler/parser/visitors/translate/translate_ctx.h +++ b/compiler/parser/visitors/translate/translate_ctx.h @@ -18,7 +18,7 @@ #include "sir/sir.h" #include "sir/types/types.h" -namespace seq { +namespace codon { namespace ast { /** @@ -30,19 +30,19 @@ struct TranslateItem { enum Kind { Func, Type, Var } kind; /// IR handle. union { - seq::ir::Var *var; - seq::ir::Func *func; - seq::ir::types::Type *type; + codon::ir::Var *var; + codon::ir::Func *func; + codon::ir::types::Type *type; } handle; /// Base function pointer. - seq::ir::BodiedFunc *base; + codon::ir::BodiedFunc *base; - TranslateItem(Kind k, seq::ir::BodiedFunc *base) + TranslateItem(Kind k, codon::ir::BodiedFunc *base) : kind(k), handle{nullptr}, base(base) {} - const seq::ir::BodiedFunc *getBase() const { return base; } - seq::ir::Func *getFunc() const { return kind == Func ? handle.func : nullptr; } - seq::ir::types::Type *getType() const { return kind == Type ? handle.type : nullptr; } - seq::ir::Var *getVar() const { return kind == Var ? handle.var : nullptr; } + const codon::ir::BodiedFunc *getBase() const { return base; } + codon::ir::Func *getFunc() const { return kind == Func ? handle.func : nullptr; } + codon::ir::types::Type *getType() const { return kind == Type ? handle.type : nullptr; } + codon::ir::Var *getVar() const { return kind == Var ? handle.var : nullptr; } }; /** @@ -52,13 +52,13 @@ struct TranslateContext : public Context { /// A pointer to the shared cache. shared_ptr cache; /// Stack of function bases. - vector bases; + vector bases; /// Stack of IR series (blocks). - vector series; + vector series; public: - TranslateContext(shared_ptr cache, seq::ir::SeriesFlow *series, - seq::ir::BodiedFunc *base); + TranslateContext(shared_ptr cache, codon::ir::SeriesFlow *series, + codon::ir::BodiedFunc *base); using Context::add; /// Convenience method for adding an object to the context. @@ -67,14 +67,14 @@ public: shared_ptr find(const string &name) const override; /// Convenience method for adding a series. - void addSeries(seq::ir::SeriesFlow *s); + void addSeries(codon::ir::SeriesFlow *s); void popSeries(); public: - seq::ir::Module *getModule() const; - seq::ir::BodiedFunc *getBase() const; - seq::ir::SeriesFlow *getSeries() const; + codon::ir::Module *getModule() const; + codon::ir::BodiedFunc *getBase() const; + codon::ir::SeriesFlow *getSeries() const; }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck.cpp b/compiler/parser/visitors/typecheck/typecheck.cpp index 4837bd8a..f1b25aa6 100644 --- a/compiler/parser/visitors/typecheck/typecheck.cpp +++ b/compiler/parser/visitors/typecheck/typecheck.cpp @@ -26,7 +26,7 @@ using std::ostream; using std::stack; using std::static_pointer_cast; -namespace seq { +namespace codon { namespace ast { using namespace types; @@ -60,4 +60,4 @@ TypePtr TypecheckVisitor::unify(TypePtr &a, const TypePtr &b) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck.h b/compiler/parser/visitors/typecheck/typecheck.h index 2cb7dbeb..1eeca932 100644 --- a/compiler/parser/visitors/typecheck/typecheck.h +++ b/compiler/parser/visitors/typecheck/typecheck.h @@ -21,7 +21,7 @@ #include "parser/visitors/typecheck/typecheck_ctx.h" #include "parser/visitors/visitor.h" -namespace seq { +namespace codon { namespace ast { class TypecheckVisitor : public CallbackASTVisitor { @@ -294,7 +294,7 @@ private: types::TypePtr realizeType(types::ClassType *typ); types::TypePtr realizeFunc(types::FuncType *typ); std::pair inferTypes(StmtPtr stmt, bool keepLast, const string &name); - seq::ir::types::Type *getLLVMType(const types::ClassType *t); + codon::ir::types::Type *getLLVMType(const types::ClassType *t); bool wrapExpr(ExprPtr &expr, types::TypePtr expectedType, const types::FuncTypePtr &callee); @@ -306,4 +306,4 @@ private: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck_ctx.cpp b/compiler/parser/visitors/typecheck/typecheck_ctx.cpp index aa636468..eb5bcb55 100644 --- a/compiler/parser/visitors/typecheck/typecheck_ctx.cpp +++ b/compiler/parser/visitors/typecheck/typecheck_ctx.cpp @@ -19,7 +19,7 @@ using fmt::format; using std::dynamic_pointer_cast; using std::stack; -namespace seq { +namespace codon { namespace ast { TypeContext::TypeContext(shared_ptr cache) @@ -400,4 +400,4 @@ void TypeContext::dump(int pad) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck_ctx.h b/compiler/parser/visitors/typecheck/typecheck_ctx.h index 15a3b45f..fce90290 100644 --- a/compiler/parser/visitors/typecheck/typecheck_ctx.h +++ b/compiler/parser/visitors/typecheck/typecheck_ctx.h @@ -18,7 +18,7 @@ #include "parser/common.h" #include "parser/ctx.h" -namespace seq { +namespace codon { namespace ast { /** @@ -155,4 +155,4 @@ private: }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck_expr.cpp b/compiler/parser/visitors/typecheck/typecheck_expr.cpp index 9c6a938c..7866b5be 100644 --- a/compiler/parser/visitors/typecheck/typecheck_expr.cpp +++ b/compiler/parser/visitors/typecheck/typecheck_expr.cpp @@ -26,7 +26,7 @@ using std::ostream; using std::stack; using std::static_pointer_cast; -namespace seq { +namespace codon { namespace ast { using namespace types; @@ -1674,4 +1674,4 @@ int64_t TypecheckVisitor::sliceAdjustIndices(int64_t length, int64_t *start, } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck_infer.cpp b/compiler/parser/visitors/typecheck/typecheck_infer.cpp index 0290c540..01b08bc3 100644 --- a/compiler/parser/visitors/typecheck/typecheck_infer.cpp +++ b/compiler/parser/visitors/typecheck/typecheck_infer.cpp @@ -28,7 +28,7 @@ using std::ostream; using std::stack; using std::static_pointer_cast; -namespace seq { +namespace codon { namespace ast { using namespace types; @@ -150,7 +150,7 @@ types::TypePtr TypecheckVisitor::realizeFunc(types::FuncType *type) { while (ctx->bases.size() > depth) ctx->bases.pop_back(); if (ctx->realizationDepth > 500) - seq::compilationError( + codon::compilationError( "maximum realization depth exceeded (recursive static function?)", getSrcInfo().file, getSrcInfo().line, getSrcInfo().col); @@ -355,14 +355,14 @@ pair TypecheckVisitor::inferTypes(StmtPtr result, bool keepLast, } } if (!fixed) { - map> v; + map> v; for (auto &ub : ctx->activeUnbounds) if (ub.first->getLink()->id >= minUnbound) { v[ub.first->getLink()->id] = {ub.first->getSrcInfo(), ub.second}; LOG_TYPECHECK("dangling ?{} ({})", ub.first->getLink()->id, minUnbound); } for (auto &ub : v) { - seq::compilationError( + codon::compilationError( format("cannot infer the type of {}", ub.second.second), ub.second.first.file, ub.second.first.line, ub.second.first.col, /*terminate=*/false); @@ -467,7 +467,7 @@ ir::types::Type *TypecheckVisitor::getLLVMType(const types::ClassType *t) { } handle->setSrcInfo(t->getSrcInfo()); handle->setAstType( - std::const_pointer_cast(t->shared_from_this())); + std::const_pointer_cast(t->shared_from_this())); // Not needed for classes, I guess // if (auto &ast = ctx->cache->classes[t->name].ast) // handle->setAttribute(std::make_unique(ast->attributes)); @@ -475,4 +475,4 @@ ir::types::Type *TypecheckVisitor::getLLVMType(const types::ClassType *t) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/typecheck/typecheck_stmt.cpp b/compiler/parser/visitors/typecheck/typecheck_stmt.cpp index 6e20c220..433c88f3 100644 --- a/compiler/parser/visitors/typecheck/typecheck_stmt.cpp +++ b/compiler/parser/visitors/typecheck/typecheck_stmt.cpp @@ -25,7 +25,7 @@ using std::ostream; using std::stack; using std::static_pointer_cast; -namespace seq { +namespace codon { namespace ast { using namespace types; @@ -573,4 +573,4 @@ void TypecheckVisitor::visit(ClassStmt *stmt) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/visitor.cpp b/compiler/parser/visitors/visitor.cpp index 7600bf40..84f8c55f 100644 --- a/compiler/parser/visitors/visitor.cpp +++ b/compiler/parser/visitors/visitor.cpp @@ -9,7 +9,7 @@ #include "parser/visitors/visitor.h" #include "parser/ast.h" -namespace seq { +namespace codon { namespace ast { void ASTVisitor::defaultVisit(Expr *expr) {} @@ -290,4 +290,4 @@ void ReplaceASTVisitor::visit(CustomStmt *stmt) { } } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/parser/visitors/visitor.h b/compiler/parser/visitors/visitor.h index 51f5b146..91190b98 100644 --- a/compiler/parser/visitors/visitor.h +++ b/compiler/parser/visitors/visitor.h @@ -14,7 +14,7 @@ #include "parser/ast.h" #include "parser/common.h" -namespace seq { +namespace codon { namespace ast { /** @@ -120,7 +120,7 @@ struct CallbackASTVisitor : public ASTVisitor, public SrcObject { /// Convenience method that constructs a node. /// @param s source location. template - auto Nx(const seq::SrcObject *s, Ts &&...args) { + auto Nx(const codon::SrcObject *s, Ts &&...args) { auto t = std::make_shared(std::forward(args)...); t->setSrcInfo(s->getSrcInfo()); return t; @@ -215,4 +215,4 @@ struct ReplaceASTVisitor : public ASTVisitor { }; } // namespace ast -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/analysis.cpp b/compiler/sir/analyze/analysis.cpp index 808b1c47..20c236d1 100644 --- a/compiler/sir/analyze/analysis.cpp +++ b/compiler/sir/analyze/analysis.cpp @@ -2,7 +2,7 @@ #include "sir/transform/manager.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { @@ -12,4 +12,4 @@ const Result *Analysis::doGetAnalysis(const std::string &key) { } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/analysis.h b/compiler/sir/analyze/analysis.h index cc4a4f50..a7aa26e4 100644 --- a/compiler/sir/analyze/analysis.h +++ b/compiler/sir/analyze/analysis.h @@ -5,7 +5,7 @@ #include "sir/module.h" #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { @@ -45,4 +45,4 @@ private: } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/dataflow/cfg.cpp b/compiler/sir/analyze/dataflow/cfg.cpp index 502a4851..53e7dfb8 100644 --- a/compiler/sir/analyze/dataflow/cfg.cpp +++ b/compiler/sir/analyze/dataflow/cfg.cpp @@ -5,7 +5,7 @@ #include "sir/dsl/codegen.h" #include "sir/dsl/nodes.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace dataflow { @@ -465,6 +465,6 @@ CFVisitor::Loop &CFVisitor::findLoop(id_t id) { } // namespace dataflow } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon #undef DEFAULT_VISIT diff --git a/compiler/sir/analyze/dataflow/cfg.h b/compiler/sir/analyze/dataflow/cfg.h index 8e552ed3..1b3a31e4 100644 --- a/compiler/sir/analyze/dataflow/cfg.h +++ b/compiler/sir/analyze/dataflow/cfg.h @@ -13,7 +13,7 @@ #define DEFAULT_VISIT(x) \ void visit(const x *v) override { defaultInsert(v); } -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace dataflow { @@ -497,6 +497,6 @@ private: } // namespace dataflow } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon #undef DEFAULT_VISIT diff --git a/compiler/sir/analyze/dataflow/dominator.cpp b/compiler/sir/analyze/dataflow/dominator.cpp index ea7de475..0c8393b1 100644 --- a/compiler/sir/analyze/dataflow/dominator.cpp +++ b/compiler/sir/analyze/dataflow/dominator.cpp @@ -1,6 +1,6 @@ #include "dominator.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace dataflow { @@ -69,4 +69,4 @@ std::unique_ptr DominatorAnalysis::run(const Module *m) { } // namespace dataflow } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/dataflow/dominator.h b/compiler/sir/analyze/dataflow/dominator.h index 45392800..e38cac5e 100644 --- a/compiler/sir/analyze/dataflow/dominator.h +++ b/compiler/sir/analyze/dataflow/dominator.h @@ -7,7 +7,7 @@ #include "sir/analyze/analysis.h" #include "sir/analyze/dataflow/cfg.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace dataflow { @@ -62,4 +62,4 @@ public: } // namespace dataflow } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/dataflow/reaching.cpp b/compiler/sir/analyze/dataflow/reaching.cpp index 1db50a20..deae7144 100644 --- a/compiler/sir/analyze/dataflow/reaching.cpp +++ b/compiler/sir/analyze/dataflow/reaching.cpp @@ -1,6 +1,6 @@ #include "reaching.h" -namespace seq { +namespace codon { namespace ir { namespace { id_t getKilled(const Value *val) { @@ -148,4 +148,4 @@ std::unique_ptr RDAnalysis::run(const Module *m) { } // namespace dataflow } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/dataflow/reaching.h b/compiler/sir/analyze/dataflow/reaching.h index bbfa7b7a..aa3c6ccc 100644 --- a/compiler/sir/analyze/dataflow/reaching.h +++ b/compiler/sir/analyze/dataflow/reaching.h @@ -5,7 +5,7 @@ #include "sir/analyze/analysis.h" #include "sir/analyze/dataflow/cfg.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace dataflow { @@ -77,4 +77,4 @@ public: } // namespace dataflow } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/module/global_vars.cpp b/compiler/sir/analyze/module/global_vars.cpp index 463b9df5..78f3f3bb 100644 --- a/compiler/sir/analyze/module/global_vars.cpp +++ b/compiler/sir/analyze/module/global_vars.cpp @@ -2,7 +2,7 @@ #include "sir/util/operator.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace module { @@ -40,4 +40,4 @@ std::unique_ptr GlobalVarsAnalyses::run(const Module *m) { } // namespace module } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/module/global_vars.h b/compiler/sir/analyze/module/global_vars.h index b1370afe..dbedd685 100644 --- a/compiler/sir/analyze/module/global_vars.h +++ b/compiler/sir/analyze/module/global_vars.h @@ -4,7 +4,7 @@ #include "sir/analyze/analysis.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace module { @@ -25,4 +25,4 @@ class GlobalVarsAnalyses : public Analysis { } // namespace module } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/module/side_effect.cpp b/compiler/sir/analyze/module/side_effect.cpp index 906c919e..67aa86bc 100644 --- a/compiler/sir/analyze/module/side_effect.cpp +++ b/compiler/sir/analyze/module/side_effect.cpp @@ -3,7 +3,7 @@ #include "sir/util/irtools.h" #include "sir/util/operator.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace module { @@ -277,4 +277,4 @@ std::unique_ptr SideEffectAnalysis::run(const Module *m) { } // namespace module } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/analyze/module/side_effect.h b/compiler/sir/analyze/module/side_effect.h index 245bc70d..5cd602ce 100644 --- a/compiler/sir/analyze/module/side_effect.h +++ b/compiler/sir/analyze/module/side_effect.h @@ -4,7 +4,7 @@ #include "sir/analyze/analysis.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { namespace module { @@ -42,4 +42,4 @@ public: } // namespace module } // namespace analyze } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/attribute.cpp b/compiler/sir/attribute.cpp index b867918a..2897445c 100644 --- a/compiler/sir/attribute.cpp +++ b/compiler/sir/attribute.cpp @@ -2,7 +2,7 @@ #include "util/fmt/ostream.h" -namespace seq { +namespace codon { namespace ir { const std::string KeyValueAttribute::AttributeName = "kvAttribute"; @@ -37,4 +37,4 @@ std::ostream &MemberAttribute::doFormat(std::ostream &os) const { const std::string SrcInfoAttribute::AttributeName = "srcInfoAttribute"; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/attribute.h b/compiler/sir/attribute.h index 97698569..63d40f85 100644 --- a/compiler/sir/attribute.h +++ b/compiler/sir/attribute.h @@ -12,7 +12,7 @@ #include "util/fmt/format.h" #include "util/fmt/ostream.h" -namespace seq { +namespace codon { namespace ir { /// Base for SIR attributes. @@ -42,12 +42,12 @@ struct SrcInfoAttribute : public Attribute { static const std::string AttributeName; /// source info - seq::SrcInfo info; + codon::SrcInfo info; SrcInfoAttribute() = default; /// Constructs a SrcInfoAttribute. /// @param info the source info - explicit SrcInfoAttribute(seq::SrcInfo info) : info(std::move(info)) {} + explicit SrcInfoAttribute(codon::SrcInfo info) : info(std::move(info)) {} private: std::ostream &doFormat(std::ostream &os) const override { return os << info; } @@ -103,4 +103,4 @@ private: }; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/base.cpp b/compiler/sir/base.cpp index 9f1deba0..8f29384c 100644 --- a/compiler/sir/base.cpp +++ b/compiler/sir/base.cpp @@ -5,7 +5,7 @@ #include "value.h" #include "var.h" -namespace seq { +namespace codon { namespace ir { id_t IdMixin::currentId = 0; @@ -31,4 +31,4 @@ int Node::replaceUsedVariable(Var *old, Var *newVar) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/base.h b/compiler/sir/base.h index ac2638e9..c081e0f0 100644 --- a/compiler/sir/base.h +++ b/compiler/sir/base.h @@ -14,7 +14,7 @@ #include "util/fmt/format.h" #include "util/fmt/ostream.h" -namespace seq { +namespace codon { namespace ir { using id_t = std::int64_t; @@ -167,13 +167,13 @@ public: /// Helper to add source information. /// @param the source information - void setSrcInfo(seq::SrcInfo s) { + void setSrcInfo(codon::SrcInfo s) { setAttribute(std::make_unique(std::move(s))); } /// @return the src info - seq::SrcInfo getSrcInfo() const { + codon::SrcInfo getSrcInfo() const { return getAttribute() ? getAttribute()->info - : seq::SrcInfo(); + : codon::SrcInfo(); } /// @return a text representation of a reference to the object @@ -330,11 +330,11 @@ template bool isA(const Node *other) { } } // namespace ir -} // namespace seq +} // namespace codon // See https://github.com/fmtlib/fmt/issues/1283. namespace fmt { -using seq::ir::Node; +using codon::ir::Node; template struct formatter : fmt::v6::internal::fallback_formatter {}; diff --git a/compiler/sir/const.cpp b/compiler/sir/const.cpp index 6d765965..5201d63c 100644 --- a/compiler/sir/const.cpp +++ b/compiler/sir/const.cpp @@ -1,6 +1,6 @@ #include "const.h" -namespace seq { +namespace codon { namespace ir { const char Const::NodeId = 0; @@ -16,4 +16,4 @@ int Const::doReplaceUsedType(const std::string &name, types::Type *newType) { const char TemplatedConst::NodeId = 0; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/const.h b/compiler/sir/const.h index 5fa1973a..6826a09f 100644 --- a/compiler/sir/const.h +++ b/compiler/sir/const.h @@ -3,7 +3,7 @@ #include "module.h" #include "value.h" -namespace seq { +namespace codon { namespace ir { /// SIR constant base. Once created, constants are immutable. @@ -78,4 +78,4 @@ public: }; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/dsl/codegen.h b/compiler/sir/dsl/codegen.h index ca46f072..a128c23a 100644 --- a/compiler/sir/dsl/codegen.h +++ b/compiler/sir/dsl/codegen.h @@ -6,7 +6,7 @@ #include "sir/llvm/llvm.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { @@ -56,4 +56,4 @@ struct CFBuilder { } // namespace codegen } // namespace dsl } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/dsl/nodes.cpp b/compiler/sir/dsl/nodes.cpp index d3bfc2c2..e8c89f95 100644 --- a/compiler/sir/dsl/nodes.cpp +++ b/compiler/sir/dsl/nodes.cpp @@ -1,6 +1,6 @@ #include "nodes.h" -namespace seq { +namespace codon { namespace ir { namespace dsl { @@ -16,4 +16,4 @@ const char CustomInstr::NodeId = 0; } // namespace dsl } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/dsl/nodes.h b/compiler/sir/dsl/nodes.h index ccceb702..73678f2c 100644 --- a/compiler/sir/dsl/nodes.h +++ b/compiler/sir/dsl/nodes.h @@ -6,7 +6,7 @@ #include "sir/const.h" #include "sir/instr.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -124,4 +124,4 @@ public: } // namespace dsl } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/flow.cpp b/compiler/sir/flow.cpp index 7e5da5c6..5174c1c7 100644 --- a/compiler/sir/flow.cpp +++ b/compiler/sir/flow.cpp @@ -6,11 +6,11 @@ #include "module.h" -namespace seq { +namespace codon { namespace ir { namespace { -int findAndReplace(id_t id, seq::ir::Value *newVal, - std::list &values) { +int findAndReplace(id_t id, codon::ir::Value *newVal, + std::list &values) { auto replacements = 0; for (auto &value : values) { if (value->getId() == id) { @@ -303,4 +303,4 @@ int PipelineFlow::doReplaceUsedValue(id_t id, Value *newValue) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/flow.h b/compiler/sir/flow.h index ab351173..670ee981 100644 --- a/compiler/sir/flow.h +++ b/compiler/sir/flow.h @@ -8,7 +8,7 @@ #include "value.h" #include "var.h" -namespace seq { +namespace codon { namespace ir { /// Base for flows, which represent control flow. @@ -608,11 +608,11 @@ protected: }; } // namespace ir -} // namespace seq +} // namespace codon // See https://github.com/fmtlib/fmt/issues/1283. namespace fmt { -using seq::ir::Flow; +using codon::ir::Flow; template struct formatter : fmt::v6::internal::fallback_formatter {}; diff --git a/compiler/sir/func.cpp b/compiler/sir/func.cpp index 2c270d07..052b2294 100644 --- a/compiler/sir/func.cpp +++ b/compiler/sir/func.cpp @@ -11,10 +11,10 @@ #include "module.h" #include "var.h" -namespace seq { +namespace codon { namespace ir { namespace { -int findAndReplace(id_t id, seq::ir::Var *newVal, std::list &values) { +int findAndReplace(id_t id, codon::ir::Var *newVal, std::list &values) { auto replacements = 0; for (auto &value : values) { if (value->getId() == id) { @@ -130,4 +130,4 @@ int LLVMFunc::doReplaceUsedType(const std::string &name, types::Type *newType) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/func.h b/compiler/sir/func.h index 4eac3189..731bd556 100644 --- a/compiler/sir/func.h +++ b/compiler/sir/func.h @@ -4,7 +4,7 @@ #include "util/iterators.h" #include "var.h" -namespace seq { +namespace codon { namespace ir { /// SIR function @@ -224,4 +224,4 @@ protected: }; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/instr.cpp b/compiler/sir/instr.cpp index 4a8c0b7e..918e478f 100644 --- a/compiler/sir/instr.cpp +++ b/compiler/sir/instr.cpp @@ -3,11 +3,11 @@ #include "module.h" #include "util/iterators.h" -namespace seq { +namespace codon { namespace ir { namespace { -int findAndReplace(id_t id, seq::ir::Value *newVal, - std::vector &values) { +int findAndReplace(id_t id, codon::ir::Value *newVal, + std::vector &values) { auto replacements = 0; for (auto &value : values) { if (value->getId() == id) { @@ -262,4 +262,4 @@ int FlowInstr::doReplaceUsedValue(id_t id, Value *newValue) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/instr.h b/compiler/sir/instr.h index 885d7c32..62faac55 100644 --- a/compiler/sir/instr.h +++ b/compiler/sir/instr.h @@ -9,7 +9,7 @@ #include "value.h" #include "var.h" -namespace seq { +namespace codon { namespace ir { /// SIR object representing an "instruction," or discrete operation in the context of a @@ -572,4 +572,4 @@ protected: }; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/llvm/coro/CoroCleanup.cpp b/compiler/sir/llvm/coro/CoroCleanup.cpp index 9b4e4e54..e8b37ac2 100644 --- a/compiler/sir/llvm/coro/CoroCleanup.cpp +++ b/compiler/sir/llvm/coro/CoroCleanup.cpp @@ -145,4 +145,4 @@ char CoroCleanupLegacy::ID = 0; INITIALIZE_PASS(CoroCleanupLegacy, "coro-cleanup", "Lower all coroutine related intrinsics", false, false) -Pass *seq::coro::createCoroCleanupLegacyPass() { return new CoroCleanupLegacy(); } +Pass *codon::coro::createCoroCleanupLegacyPass() { return new CoroCleanupLegacy(); } diff --git a/compiler/sir/llvm/coro/CoroEarly.cpp b/compiler/sir/llvm/coro/CoroEarly.cpp index 82530007..b5966b4e 100644 --- a/compiler/sir/llvm/coro/CoroEarly.cpp +++ b/compiler/sir/llvm/coro/CoroEarly.cpp @@ -274,4 +274,4 @@ char CoroEarlyLegacy::ID = 0; INITIALIZE_PASS(CoroEarlyLegacy, "coro-early", "Lower early coroutine intrinsics", false, false) -Pass *seq::coro::createCoroEarlyLegacyPass() { return new CoroEarlyLegacy(); } +Pass *codon::coro::createCoroEarlyLegacyPass() { return new CoroEarlyLegacy(); } diff --git a/compiler/sir/llvm/coro/CoroElide.cpp b/compiler/sir/llvm/coro/CoroElide.cpp index feb08f9e..a7b69c84 100644 --- a/compiler/sir/llvm/coro/CoroElide.cpp +++ b/compiler/sir/llvm/coro/CoroElide.cpp @@ -432,4 +432,4 @@ INITIALIZE_PASS_END(CoroElideLegacy, "coro-elide", "Coroutine frame allocation elision and indirect calls replacement", false, false) -Pass *seq::coro::createCoroElideLegacyPass() { return new CoroElideLegacy(); } +Pass *codon::coro::createCoroElideLegacyPass() { return new CoroElideLegacy(); } diff --git a/compiler/sir/llvm/coro/CoroSplit.cpp b/compiler/sir/llvm/coro/CoroSplit.cpp index da13921d..7639e650 100644 --- a/compiler/sir/llvm/coro/CoroSplit.cpp +++ b/compiler/sir/llvm/coro/CoroSplit.cpp @@ -2150,6 +2150,6 @@ INITIALIZE_PASS_END(CoroSplitLegacy, "coro-split", "Split coroutine into a set of functions driving its state machine", false, false) -Pass *seq::coro::createCoroSplitLegacyPass(bool ReuseFrameSlot) { +Pass *codon::coro::createCoroSplitLegacyPass(bool ReuseFrameSlot) { return new CoroSplitLegacy(ReuseFrameSlot); } diff --git a/compiler/sir/llvm/coro/Coroutines.cpp b/compiler/sir/llvm/coro/Coroutines.cpp index aaab8cc3..40ab931f 100644 --- a/compiler/sir/llvm/coro/Coroutines.cpp +++ b/compiler/sir/llvm/coro/Coroutines.cpp @@ -49,34 +49,34 @@ void llvm::initializeCoroutines(PassRegistry &Registry) { static void addCoroutineOpt0Passes(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { - PM.add(seq::coro::createCoroSplitLegacyPass()); - PM.add(seq::coro::createCoroElideLegacyPass()); + PM.add(codon::coro::createCoroSplitLegacyPass()); + PM.add(codon::coro::createCoroElideLegacyPass()); PM.add(createBarrierNoopPass()); - PM.add(seq::coro::createCoroCleanupLegacyPass()); + PM.add(codon::coro::createCoroCleanupLegacyPass()); } static void addCoroutineEarlyPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { - PM.add(seq::coro::createCoroEarlyLegacyPass()); + PM.add(codon::coro::createCoroEarlyLegacyPass()); } static void addCoroutineScalarOptimizerPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { - PM.add(seq::coro::createCoroElideLegacyPass()); + PM.add(codon::coro::createCoroElideLegacyPass()); } static void addCoroutineSCCPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { - PM.add(seq::coro::createCoroSplitLegacyPass(Builder.OptLevel != 0)); + PM.add(codon::coro::createCoroSplitLegacyPass(Builder.OptLevel != 0)); } static void addCoroutineOptimizerLastPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { - PM.add(seq::coro::createCoroCleanupLegacyPass()); + PM.add(codon::coro::createCoroCleanupLegacyPass()); } -void seq::coro::addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder) { +void codon::coro::addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder) { Builder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, addCoroutineEarlyPasses); Builder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0, addCoroutineOpt0Passes); diff --git a/compiler/sir/llvm/coro/Coroutines.h b/compiler/sir/llvm/coro/Coroutines.h index acb9d42e..67873af4 100644 --- a/compiler/sir/llvm/coro/Coroutines.h +++ b/compiler/sir/llvm/coro/Coroutines.h @@ -5,7 +5,7 @@ class Pass; class PassManagerBuilder; } // namespace llvm -namespace seq { +namespace codon { namespace coro { /// Add all coroutine passes to appropriate extension points. @@ -25,4 +25,4 @@ llvm::Pass *createCoroElideLegacyPass(); llvm::Pass *createCoroCleanupLegacyPass(); } // namespace coro -} // namespace seq +} // namespace codon diff --git a/compiler/sir/llvm/llvisitor.cpp b/compiler/sir/llvm/llvisitor.cpp index 4172daf7..89fa20b2 100644 --- a/compiler/sir/llvm/llvisitor.cpp +++ b/compiler/sir/llvm/llvisitor.cpp @@ -24,7 +24,7 @@ extern "C" uint64_t seq_exc_class(); static llvm::codegen::RegisterCodeGenFlags CFG; -namespace seq { +namespace codon { namespace ir { namespace { std::string getNameForFunction(const Func *x) { @@ -2474,4 +2474,4 @@ void LLVMVisitor::visit(const dsl::CustomInstr *x) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/llvm/llvisitor.h b/compiler/sir/llvm/llvisitor.h index baf33d79..e7368c5b 100644 --- a/compiler/sir/llvm/llvisitor.h +++ b/compiler/sir/llvm/llvisitor.h @@ -6,7 +6,7 @@ #include #include -namespace seq { +namespace codon { namespace ir { class LLVMVisitor : public util::ConstVisitor { @@ -293,4 +293,4 @@ public: }; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/module.cpp b/compiler/sir/module.cpp index 1def144b..ffa042f0 100644 --- a/compiler/sir/module.cpp +++ b/compiler/sir/module.cpp @@ -7,24 +7,24 @@ #include "func.h" -namespace seq { +namespace codon { namespace ir { namespace { -std::vector +std::vector translateGenerics(std::vector &generics) { - std::vector ret; + std::vector ret; for (auto &g : generics) { seqassert(g.isStatic() || g.getTypeValue(), "generic must be static or a type"); - ret.push_back(std::make_shared( - g.isStatic() ? std::make_shared(g.getStaticValue()) + ret.push_back(std::make_shared( + g.isStatic() ? std::make_shared(g.getStaticValue()) : g.getTypeValue()->getAstType())); } return ret; } -std::vector> +std::vector> generateDummyNames(std::vector &types) { - std::vector> ret; + std::vector> ret; for (auto *t : types) { seqassert(t->getAstType(), "{} must have an ast type", *t); ret.emplace_back("", t->getAstType()); @@ -32,16 +32,16 @@ generateDummyNames(std::vector &types) { return ret; } -std::vector translateArgs(std::vector &types) { - std::vector ret = { - std::make_shared( - seq::ast::types::LinkType::Kind::Unbound, 0)}; +std::vector translateArgs(std::vector &types) { + std::vector ret = { + std::make_shared( + codon::ast::types::LinkType::Kind::Unbound, 0)}; for (auto *t : types) { seqassert(t->getAstType(), "{} must have an ast type", *t); if (auto f = t->getAstType()->getFunc()) { auto *irType = cast(t); std::vector mask(std::distance(irType->begin(), irType->end()), 0); - ret.push_back(std::make_shared( + ret.push_back(std::make_shared( t->getAstType()->getRecord(), f, mask)); } else { ret.push_back(t->getAstType()); @@ -220,7 +220,7 @@ types::Type *Module::getOptionalType(types::Type *base) { types::Type *Module::getFuncType(types::Type *rType, std::vector argTypes, bool variadic) { auto args = translateArgs(argTypes); - args[0] = std::make_shared(rType->getAstType()); + args[0] = std::make_shared(rType->getAstType()); auto *result = cache->makeFunction(args); if (variadic) { // Type checker types have no concept of variadic functions, so we will @@ -326,4 +326,4 @@ types::Type *Module::unsafeGetIntNType(unsigned int len, bool sign) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/module.h b/compiler/sir/module.h index 25079486..6f08d06f 100644 --- a/compiler/sir/module.h +++ b/compiler/sir/module.h @@ -15,7 +15,7 @@ #include "value.h" #include "var.h" -namespace seq { +namespace codon { namespace ast { struct Cache; @@ -228,7 +228,7 @@ public: /// @param args the arguments /// @return the new node template - DesiredType *N(seq::SrcInfo s, Args &&...args) { + DesiredType *N(codon::SrcInfo s, Args &&...args) { auto *ret = new DesiredType(std::forward(args)...); ret->setModule(this); ret->setSrcInfo(s); @@ -241,7 +241,7 @@ public: /// @param args the arguments /// @return the new node template - DesiredType *N(const seq::SrcObject *s, Args &&...args) { + DesiredType *N(const codon::SrcObject *s, Args &&...args) { return N(s->getSrcInfo(), std::forward(args)...); } /// Constructs and registers an IR node with provided source node. @@ -256,7 +256,7 @@ public: /// @param args the arguments /// @return the new node template DesiredType *Nr(Args &&...args) { - return N(seq::SrcInfo(), std::forward(args)...); + return N(codon::SrcInfo(), std::forward(args)...); } /// @return the type-checker cache @@ -415,4 +415,4 @@ private: }; } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/canonical.cpp b/compiler/sir/transform/cleanup/canonical.cpp index aea19f2f..a39164de 100644 --- a/compiler/sir/transform/cleanup/canonical.cpp +++ b/compiler/sir/transform/cleanup/canonical.cpp @@ -10,7 +10,7 @@ #include "sir/transform/rewrite.h" #include "sir/util/irtools.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -338,4 +338,4 @@ void CanonicalizationPass::registerStandardRules(Module *m) { } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/canonical.h b/compiler/sir/transform/cleanup/canonical.h index 1fbcdd8d..76177640 100644 --- a/compiler/sir/transform/cleanup/canonical.h +++ b/compiler/sir/transform/cleanup/canonical.h @@ -3,7 +3,7 @@ #include "sir/transform/pass.h" #include "sir/transform/rewrite.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -34,4 +34,4 @@ private: } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/dead_code.cpp b/compiler/sir/transform/cleanup/dead_code.cpp index 72c6ee43..12633df1 100644 --- a/compiler/sir/transform/cleanup/dead_code.cpp +++ b/compiler/sir/transform/cleanup/dead_code.cpp @@ -3,7 +3,7 @@ #include "sir/analyze/module/side_effect.h" #include "sir/util/cloning.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -104,4 +104,4 @@ void DeadCodeCleanupPass::doReplacement(Value *og, Value *v) { } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/dead_code.h b/compiler/sir/transform/cleanup/dead_code.h index 861e4a97..e0575fef 100644 --- a/compiler/sir/transform/cleanup/dead_code.h +++ b/compiler/sir/transform/cleanup/dead_code.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -41,4 +41,4 @@ private: } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/global_demote.cpp b/compiler/sir/transform/cleanup/global_demote.cpp index ee1932b8..f8270e0f 100644 --- a/compiler/sir/transform/cleanup/global_demote.cpp +++ b/compiler/sir/transform/cleanup/global_demote.cpp @@ -1,6 +1,6 @@ #include "global_demote.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -60,4 +60,4 @@ void GlobalDemotionPass::run(Module *M) { } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/global_demote.h b/compiler/sir/transform/cleanup/global_demote.h index e1aad888..86f93eb9 100644 --- a/compiler/sir/transform/cleanup/global_demote.h +++ b/compiler/sir/transform/cleanup/global_demote.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -30,4 +30,4 @@ public: } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/replacer.cpp b/compiler/sir/transform/cleanup/replacer.cpp index 32757cf2..aeaae097 100644 --- a/compiler/sir/transform/cleanup/replacer.cpp +++ b/compiler/sir/transform/cleanup/replacer.cpp @@ -6,7 +6,7 @@ #include "sir/value.h" #include "sir/var.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -136,4 +136,4 @@ void ReplaceCleanupPass::run(Module *module) { } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/cleanup/replacer.h b/compiler/sir/transform/cleanup/replacer.h index 11c627d3..afb3cd37 100644 --- a/compiler/sir/transform/cleanup/replacer.h +++ b/compiler/sir/transform/cleanup/replacer.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace cleanup { @@ -18,4 +18,4 @@ public: } // namespace cleanup } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/folding/const_fold.cpp b/compiler/sir/transform/folding/const_fold.cpp index 189df892..7df7e48f 100644 --- a/compiler/sir/transform/folding/const_fold.cpp +++ b/compiler/sir/transform/folding/const_fold.cpp @@ -10,7 +10,7 @@ #define UNOP(o) \ [](auto x) -> auto { return o x; } -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -352,7 +352,7 @@ void FoldingPass::registerStandardRules(Module *m) { } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon #undef BINOP #undef UNOP diff --git a/compiler/sir/transform/folding/const_fold.h b/compiler/sir/transform/folding/const_fold.h index 767f9b94..e5f29430 100644 --- a/compiler/sir/transform/folding/const_fold.h +++ b/compiler/sir/transform/folding/const_fold.h @@ -7,7 +7,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -30,4 +30,4 @@ private: } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/folding/const_prop.cpp b/compiler/sir/transform/folding/const_prop.cpp index 68e1ddb6..7a296661 100644 --- a/compiler/sir/transform/folding/const_prop.cpp +++ b/compiler/sir/transform/folding/const_prop.cpp @@ -4,7 +4,7 @@ #include "sir/analyze/module/global_vars.h" #include "sir/util/cloning.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -74,4 +74,4 @@ void ConstPropPass::handle(VarValue *v) { } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/folding/const_prop.h b/compiler/sir/transform/folding/const_prop.h index f27e5ec4..80f53ff1 100644 --- a/compiler/sir/transform/folding/const_prop.h +++ b/compiler/sir/transform/folding/const_prop.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -30,4 +30,4 @@ public: } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/folding/folding.cpp b/compiler/sir/transform/folding/folding.cpp index d1ca92d1..3df1bf0b 100644 --- a/compiler/sir/transform/folding/folding.cpp +++ b/compiler/sir/transform/folding/folding.cpp @@ -3,7 +3,7 @@ #include "const_fold.h" #include "const_prop.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -40,4 +40,4 @@ bool FoldingPassGroup::shouldRepeat() const { } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/folding/folding.h b/compiler/sir/transform/folding/folding.h index d16b85e5..eab15457 100644 --- a/compiler/sir/transform/folding/folding.h +++ b/compiler/sir/transform/folding/folding.h @@ -6,7 +6,7 @@ #include "sir/transform/cleanup/dead_code.h" #include "sir/transform/cleanup/global_demote.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -38,4 +38,4 @@ public: } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/folding/rule.h b/compiler/sir/transform/folding/rule.h index 2aa0e709..71f02702 100644 --- a/compiler/sir/transform/folding/rule.h +++ b/compiler/sir/transform/folding/rule.h @@ -7,7 +7,7 @@ #include "sir/transform/rewrite.h" #include "sir/util/irtools.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace folding { @@ -258,4 +258,4 @@ public: } // namespace folding } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/lowering/imperative.cpp b/compiler/sir/transform/lowering/imperative.cpp index 7b1f87f6..3a5a5258 100644 --- a/compiler/sir/transform/lowering/imperative.cpp +++ b/compiler/sir/transform/lowering/imperative.cpp @@ -6,7 +6,7 @@ #include "sir/util/irtools.h" #include "sir/util/matching.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace lowering { @@ -140,4 +140,4 @@ void ImperativeForFlowLowering::handle(ForFlow *v) { } // namespace lowering } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/lowering/imperative.h b/compiler/sir/transform/lowering/imperative.h index 468f56b5..13abd20a 100644 --- a/compiler/sir/transform/lowering/imperative.h +++ b/compiler/sir/transform/lowering/imperative.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace lowering { @@ -17,4 +17,4 @@ public: } // namespace lowering } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/lowering/pipeline.cpp b/compiler/sir/transform/lowering/pipeline.cpp index bb36189f..473a97ce 100644 --- a/compiler/sir/transform/lowering/pipeline.cpp +++ b/compiler/sir/transform/lowering/pipeline.cpp @@ -6,7 +6,7 @@ #include "sir/util/irtools.h" #include "sir/util/matching.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace lowering { @@ -64,4 +64,4 @@ void PipelineLowering::handle(PipelineFlow *v) { } // namespace lowering } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/lowering/pipeline.h b/compiler/sir/transform/lowering/pipeline.h index 96013c1f..9431fe41 100644 --- a/compiler/sir/transform/lowering/pipeline.h +++ b/compiler/sir/transform/lowering/pipeline.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace lowering { @@ -18,4 +18,4 @@ public: } // namespace lowering } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/manager.cpp b/compiler/sir/transform/manager.cpp index b3521e1f..bb245408 100644 --- a/compiler/sir/transform/manager.cpp +++ b/compiler/sir/transform/manager.cpp @@ -21,7 +21,7 @@ #include "sir/transform/pythonic/str.h" #include "util/common.h" -namespace seq { +namespace codon { namespace ir { namespace transform { @@ -186,4 +186,4 @@ void PassManager::registerStandardPasses(bool debug) { } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/manager.h b/compiler/sir/transform/manager.h index 4f073d82..f516a0e1 100644 --- a/compiler/sir/transform/manager.h +++ b/compiler/sir/transform/manager.h @@ -11,7 +11,7 @@ #include "sir/analyze/analysis.h" #include "sir/module.h" -namespace seq { +namespace codon { namespace ir { namespace transform { @@ -163,4 +163,4 @@ private: } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/parallel/openmp.cpp b/compiler/sir/transform/parallel/openmp.cpp index ae6c9d95..a1e96f41 100644 --- a/compiler/sir/transform/parallel/openmp.cpp +++ b/compiler/sir/transform/parallel/openmp.cpp @@ -9,7 +9,7 @@ #include "sir/util/irtools.h" #include "sir/util/outlining.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace parallel { @@ -970,4 +970,4 @@ void OpenMPPass::handle(ImperativeForFlow *v) { } // namespace parallel } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/parallel/openmp.h b/compiler/sir/transform/parallel/openmp.h index 6a920169..1aca6489 100644 --- a/compiler/sir/transform/parallel/openmp.h +++ b/compiler/sir/transform/parallel/openmp.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace parallel { @@ -22,4 +22,4 @@ public: } // namespace parallel } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/parallel/schedule.cpp b/compiler/sir/transform/parallel/schedule.cpp index 219200d6..01e67768 100644 --- a/compiler/sir/transform/parallel/schedule.cpp +++ b/compiler/sir/transform/parallel/schedule.cpp @@ -6,7 +6,7 @@ #include #include -namespace seq { +namespace codon { namespace ir { namespace transform { namespace parallel { @@ -84,4 +84,4 @@ int OMPSched::replaceUsedValue(id_t id, Value *newValue) { } // namespace parallel } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/parallel/schedule.h b/compiler/sir/transform/parallel/schedule.h index d120cc8e..5f0cf446 100644 --- a/compiler/sir/transform/parallel/schedule.h +++ b/compiler/sir/transform/parallel/schedule.h @@ -2,7 +2,7 @@ #include "sir/value.h" -namespace seq { +namespace codon { namespace ir { class Value; @@ -32,4 +32,4 @@ struct OMPSched { } // namespace parallel } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pass.cpp b/compiler/sir/transform/pass.cpp index f1c424c1..830eb5ba 100644 --- a/compiler/sir/transform/pass.cpp +++ b/compiler/sir/transform/pass.cpp @@ -2,7 +2,7 @@ #include "manager.h" -namespace seq { +namespace codon { namespace ir { namespace transform { @@ -23,4 +23,4 @@ void PassGroup::setManager(PassManager *mng) { } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pass.h b/compiler/sir/transform/pass.h index 23e2d42e..955838ef 100644 --- a/compiler/sir/transform/pass.h +++ b/compiler/sir/transform/pass.h @@ -3,7 +3,7 @@ #include "sir/module.h" #include "sir/util/operator.h" -namespace seq { +namespace codon { namespace ir { namespace analyze { @@ -78,4 +78,4 @@ public: } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pythonic/dict.cpp b/compiler/sir/transform/pythonic/dict.cpp index d5f1f17d..3f6ba98e 100644 --- a/compiler/sir/transform/pythonic/dict.cpp +++ b/compiler/sir/transform/pythonic/dict.cpp @@ -6,7 +6,7 @@ #include "sir/util/irtools.h" #include "sir/util/matching.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace pythonic { @@ -144,4 +144,4 @@ void DictArithmeticOptimization::handle(CallInstr *v) { } // namespace pythonic } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pythonic/dict.h b/compiler/sir/transform/pythonic/dict.h index f7b65457..2e9887d4 100644 --- a/compiler/sir/transform/pythonic/dict.h +++ b/compiler/sir/transform/pythonic/dict.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace pythonic { @@ -20,4 +20,4 @@ public: } // namespace pythonic } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pythonic/io.cpp b/compiler/sir/transform/pythonic/io.cpp index 1f96c9a4..8ca11e58 100644 --- a/compiler/sir/transform/pythonic/io.cpp +++ b/compiler/sir/transform/pythonic/io.cpp @@ -5,7 +5,7 @@ #include "sir/util/cloning.h" #include "sir/util/irtools.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace pythonic { @@ -99,4 +99,4 @@ void IOCatOptimization::handle(CallInstr *v) { } // namespace pythonic } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pythonic/io.h b/compiler/sir/transform/pythonic/io.h index ee008ce6..33d4a578 100644 --- a/compiler/sir/transform/pythonic/io.h +++ b/compiler/sir/transform/pythonic/io.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace pythonic { @@ -18,4 +18,4 @@ public: } // namespace pythonic } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pythonic/str.cpp b/compiler/sir/transform/pythonic/str.cpp index 77df5bc0..964b35f3 100644 --- a/compiler/sir/transform/pythonic/str.cpp +++ b/compiler/sir/transform/pythonic/str.cpp @@ -5,7 +5,7 @@ #include "sir/util/cloning.h" #include "sir/util/irtools.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace pythonic { @@ -72,4 +72,4 @@ void StrAdditionOptimization::handle(CallInstr *v) { } // namespace pythonic } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/pythonic/str.h b/compiler/sir/transform/pythonic/str.h index 60775008..d72de930 100644 --- a/compiler/sir/transform/pythonic/str.h +++ b/compiler/sir/transform/pythonic/str.h @@ -2,7 +2,7 @@ #include "sir/transform/pass.h" -namespace seq { +namespace codon { namespace ir { namespace transform { namespace pythonic { @@ -18,4 +18,4 @@ public: } // namespace pythonic } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/transform/rewrite.h b/compiler/sir/transform/rewrite.h index 59e477a9..044d83a7 100644 --- a/compiler/sir/transform/rewrite.h +++ b/compiler/sir/transform/rewrite.h @@ -3,7 +3,7 @@ #include "sir/transform/pass.h" #include "sir/util/visitor.h" -namespace seq { +namespace codon { namespace ir { namespace transform { @@ -70,4 +70,4 @@ public: } // namespace transform } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/types/types.cpp b/compiler/sir/types/types.cpp index 93cffe80..7861ab95 100644 --- a/compiler/sir/types/types.cpp +++ b/compiler/sir/types/types.cpp @@ -13,13 +13,13 @@ #include "sir/util/visitor.h" #include "sir/value.h" -namespace seq { +namespace codon { namespace ir { namespace types { namespace { -std::vector -extractTypes(const std::vector &gens) { - std::vector ret; +std::vector +extractTypes(const std::vector &gens) { + std::vector ret; for (auto &g : gens) ret.push_back(g.type); return ret; @@ -205,4 +205,4 @@ std::string IntNType::getInstanceName(unsigned int len, bool sign) { } // namespace types } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/types/types.h b/compiler/sir/types/types.h index 4f2d616b..d0a18320 100644 --- a/compiler/sir/types/types.h +++ b/compiler/sir/types/types.h @@ -15,7 +15,7 @@ #include "sir/util/packs.h" #include "sir/util/visitor.h" -namespace seq { +namespace codon { namespace ir { class Value; @@ -460,4 +460,4 @@ private: } // namespace types } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/cloning.cpp b/compiler/sir/util/cloning.cpp index 271e5f79..74269f28 100644 --- a/compiler/sir/util/cloning.cpp +++ b/compiler/sir/util/cloning.cpp @@ -1,6 +1,6 @@ #include "cloning.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -260,4 +260,4 @@ void CloneVisitor::visit(const dsl::CustomInstr *v) { result = v->doClone(*this) } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/cloning.h b/compiler/sir/util/cloning.h index f4709017..c39af5ae 100644 --- a/compiler/sir/util/cloning.h +++ b/compiler/sir/util/cloning.h @@ -3,7 +3,7 @@ #include "sir/sir.h" #include "visitor.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -157,4 +157,4 @@ private: } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/context.h b/compiler/sir/util/context.h index fc7636f4..e42bfb31 100644 --- a/compiler/sir/util/context.h +++ b/compiler/sir/util/context.h @@ -2,7 +2,7 @@ #include -namespace seq { +namespace codon { namespace ir { namespace util { @@ -33,4 +33,4 @@ public: } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/format.cpp b/compiler/sir/util/format.cpp index 97565e50..4ebcad4d 100644 --- a/compiler/sir/util/format.cpp +++ b/compiler/sir/util/format.cpp @@ -8,7 +8,7 @@ #include "util/fmt/ostream.h" #include "visitor.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -443,11 +443,11 @@ std::ostream &format(std::ostream &os, const Node *node) { } // namespace util } // namespace ir -} // namespace seq +} // namespace codon // See https://github.com/fmtlib/fmt/issues/1283. namespace fmt { template -struct formatter - : fmt::v6::internal::fallback_formatter {}; +struct formatter + : fmt::v6::internal::fallback_formatter {}; } // namespace fmt diff --git a/compiler/sir/util/format.h b/compiler/sir/util/format.h index f97a7b15..df5eafc1 100644 --- a/compiler/sir/util/format.h +++ b/compiler/sir/util/format.h @@ -4,7 +4,7 @@ #include "sir/sir.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -21,4 +21,4 @@ std::ostream &format(std::ostream &os, const Node *node); } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/inlining.cpp b/compiler/sir/util/inlining.cpp index 07506a22..08a94e49 100644 --- a/compiler/sir/util/inlining.cpp +++ b/compiler/sir/util/inlining.cpp @@ -6,7 +6,7 @@ #include "sir/util/irtools.h" #include "sir/util/operator.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -68,7 +68,7 @@ public: } // namespace InlineResult inlineFunction(Func *func, std::vector args, bool aggressive, - seq::SrcInfo info) { + codon::SrcInfo info) { auto *bodied = cast(func); if (!bodied) return {nullptr, {}}; @@ -132,4 +132,4 @@ InlineResult inlineCall(CallInstr *v, bool aggressive) { } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/inlining.h b/compiler/sir/util/inlining.h index 9b316714..47dc027f 100644 --- a/compiler/sir/util/inlining.h +++ b/compiler/sir/util/inlining.h @@ -2,7 +2,7 @@ #include "sir/sir.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -23,7 +23,7 @@ struct InlineResult { /// @param aggressive true if should inline complex functions /// @return the inlined result, nullptr if unsuccessful InlineResult inlineFunction(Func *func, std::vector args, - bool aggressive = false, seq::SrcInfo callInfo = {}); + bool aggressive = false, codon::SrcInfo callInfo = {}); /// Inline the given call. /// @param v the instruction @@ -33,4 +33,4 @@ InlineResult inlineCall(CallInstr *v, bool aggressive = false); } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/irtools.cpp b/compiler/sir/util/irtools.cpp index fc43bc1a..b7f51d79 100644 --- a/compiler/sir/util/irtools.cpp +++ b/compiler/sir/util/irtools.cpp @@ -2,7 +2,7 @@ #include -namespace seq { +namespace codon { namespace ir { namespace util { @@ -248,4 +248,4 @@ void setReturnType(Func *func, types::Type *rType) { } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/irtools.h b/compiler/sir/util/irtools.h index b65fab39..9dada658 100644 --- a/compiler/sir/util/irtools.h +++ b/compiler/sir/util/irtools.h @@ -2,7 +2,7 @@ #include "sir/sir.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -203,4 +203,4 @@ void setReturnType(Func *func, types::Type *rType); } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/iterators.h b/compiler/sir/util/iterators.h index 2981bdf7..7f8ae89c 100644 --- a/compiler/sir/util/iterators.h +++ b/compiler/sir/util/iterators.h @@ -4,7 +4,7 @@ #include #include -namespace seq { +namespace codon { namespace ir { namespace util { @@ -106,4 +106,4 @@ template auto const_map_key_adaptor(It it) { } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/matching.cpp b/compiler/sir/util/matching.cpp index fe03642d..512e7996 100644 --- a/compiler/sir/util/matching.cpp +++ b/compiler/sir/util/matching.cpp @@ -21,7 +21,7 @@ handle(v, static_cast(other)); \ } -namespace seq { +namespace codon { namespace ir { namespace util { namespace { @@ -326,6 +326,6 @@ bool match(Node *a, Node *b, bool checkNames, bool varIdMatch) { } // namespace util } // namespace ir -} // namespace seq +} // namespace codon #undef VISIT diff --git a/compiler/sir/util/matching.h b/compiler/sir/util/matching.h index 9ab03ec2..8a7a9782 100644 --- a/compiler/sir/util/matching.h +++ b/compiler/sir/util/matching.h @@ -2,7 +2,7 @@ #include "sir/sir.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -62,4 +62,4 @@ bool match(Node *a, Node *b, bool checkNames = false, bool varIdMatch = false); } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/operator.h b/compiler/sir/util/operator.h index 2f43232c..a2daf8c7 100644 --- a/compiler/sir/util/operator.h +++ b/compiler/sir/util/operator.h @@ -7,8 +7,8 @@ #include "visitor.h" #define LAMBDA_VISIT(x) \ - virtual void handle(seq::ir::x *v) {} \ - void visit(seq::ir::x *v) override { \ + virtual void handle(codon::ir::x *v) {} \ + void visit(codon::ir::x *v) override { \ if (childrenFirst) \ processChildren(v); \ preHook(v); \ @@ -18,7 +18,7 @@ processChildren(v); \ } -namespace seq { +namespace codon { namespace ir { namespace util { @@ -76,7 +76,7 @@ public: LAMBDA_VISIT(VarValue); LAMBDA_VISIT(PointerValue); - void visit(seq::ir::SeriesFlow *v) override { + void visit(codon::ir::SeriesFlow *v) override { if (childrenFirst) processSeriesFlowChildren(v); preHook(v); @@ -86,7 +86,7 @@ public: processSeriesFlowChildren(v); } - virtual void handle(seq::ir::SeriesFlow *v) {} + virtual void handle(codon::ir::SeriesFlow *v) {} LAMBDA_VISIT(IfFlow); LAMBDA_VISIT(WhileFlow); LAMBDA_VISIT(ForFlow); @@ -186,7 +186,7 @@ private: nodeStack.pop_back(); } - void processSeriesFlowChildren(seq::ir::SeriesFlow *v) { + void processSeriesFlowChildren(codon::ir::SeriesFlow *v) { nodeStack.push_back(v); for (auto it = v->begin(); it != v->end(); ++it) { itStack.push_back(it); @@ -199,6 +199,6 @@ private: } // namespace util } // namespace ir -} // namespace seq +} // namespace codon #undef LAMBDA_VISIT diff --git a/compiler/sir/util/outlining.cpp b/compiler/sir/util/outlining.cpp index 504fa395..9823ec64 100644 --- a/compiler/sir/util/outlining.cpp +++ b/compiler/sir/util/outlining.cpp @@ -8,7 +8,7 @@ #include "irtools.h" #include "operator.h" -namespace seq { +namespace codon { namespace ir { namespace util { namespace { @@ -393,4 +393,4 @@ OutlineResult outlineRegion(BodiedFunc *parent, SeriesFlow *series, bool allowOu } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/outlining.h b/compiler/sir/util/outlining.h index 29dd3b27..b4d9aac2 100644 --- a/compiler/sir/util/outlining.h +++ b/compiler/sir/util/outlining.h @@ -2,7 +2,7 @@ #include "sir/sir.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -70,4 +70,4 @@ OutlineResult outlineRegion(BodiedFunc *parent, SeriesFlow *series, } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/packs.h b/compiler/sir/util/packs.h index 69f99579..16a74332 100644 --- a/compiler/sir/util/packs.h +++ b/compiler/sir/util/packs.h @@ -2,7 +2,7 @@ #include -namespace seq { +namespace codon { namespace ir { namespace util { @@ -30,4 +30,4 @@ void stripPack(std::vector &dst, Desired &first, Args &&...args) { } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/visitor.cpp b/compiler/sir/util/visitor.cpp index 3f1f7c36..239f5379 100644 --- a/compiler/sir/util/visitor.cpp +++ b/compiler/sir/util/visitor.cpp @@ -2,7 +2,7 @@ #include "sir/sir.h" -namespace seq { +namespace codon { namespace ir { namespace util { @@ -122,4 +122,4 @@ void ConstVisitor::visit(const dsl::types::CustomType *x) { defaultVisit(x); } } // namespace util } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/util/visitor.h b/compiler/sir/util/visitor.h index 8ddd4c6a..b27462b3 100644 --- a/compiler/sir/util/visitor.h +++ b/compiler/sir/util/visitor.h @@ -4,10 +4,10 @@ #include #include -#define VISIT(x) virtual void visit(seq::ir::x *) -#define CONST_VISIT(x) virtual void visit(const seq::ir::x *) +#define VISIT(x) virtual void visit(codon::ir::x *) +#define CONST_VISIT(x) virtual void visit(const codon::ir::x *) -namespace seq { +namespace codon { namespace ir { class Node; @@ -87,7 +87,7 @@ namespace util { /// Base for SIR visitors class Visitor { protected: - virtual void defaultVisit(seq::ir::Node *) { + virtual void defaultVisit(codon::ir::Node *) { throw std::runtime_error("cannot visit node"); } @@ -161,7 +161,7 @@ public: class ConstVisitor { protected: - virtual void defaultVisit(const seq::ir::Node *) { + virtual void defaultVisit(const codon::ir::Node *) { throw std::runtime_error("cannot visit const node"); } @@ -235,7 +235,7 @@ public: } // namespace util } // namespace ir -} // namespace seq +} // namespace codon #undef VISIT #undef CONST_VISIT diff --git a/compiler/sir/value.cpp b/compiler/sir/value.cpp index e88a8531..8b6ae04b 100644 --- a/compiler/sir/value.cpp +++ b/compiler/sir/value.cpp @@ -3,7 +3,7 @@ #include "instr.h" #include "module.h" -namespace seq { +namespace codon { namespace ir { const char Value::NodeId = 0; @@ -144,4 +144,4 @@ Value *Value::doCall(const std::vector &args) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/value.h b/compiler/sir/value.h index 0a94ea1f..ac06a702 100644 --- a/compiler/sir/value.h +++ b/compiler/sir/value.h @@ -4,7 +4,7 @@ #include "types/types.h" #include "util/packs.h" -namespace seq { +namespace codon { namespace ir { class Func; @@ -122,11 +122,11 @@ private: }; } // namespace ir -} // namespace seq +} // namespace codon // See https://github.com/fmtlib/fmt/issues/1283. namespace fmt { -using seq::ir::Value; +using codon::ir::Value; template struct formatter : fmt::v6::internal::fallback_formatter {}; diff --git a/compiler/sir/var.cpp b/compiler/sir/var.cpp index 8cc01a05..b396e314 100644 --- a/compiler/sir/var.cpp +++ b/compiler/sir/var.cpp @@ -2,7 +2,7 @@ #include "module.h" -namespace seq { +namespace codon { namespace ir { const char Var::NodeId = 0; @@ -40,4 +40,4 @@ int PointerValue::doReplaceUsedVariable(id_t id, Var *newVar) { } } // namespace ir -} // namespace seq +} // namespace codon diff --git a/compiler/sir/var.h b/compiler/sir/var.h index 3c924e33..0f8d268b 100644 --- a/compiler/sir/var.h +++ b/compiler/sir/var.h @@ -12,7 +12,7 @@ #include "util/common.h" #include "value.h" -namespace seq { +namespace codon { namespace ir { class Func; @@ -156,11 +156,11 @@ private: }; } // namespace ir -} // namespace seq +} // namespace codon // See https://github.com/fmtlib/fmt/issues/1283. namespace fmt { -using seq::ir::Var; +using codon::ir::Var; template struct formatter : fmt::v6::internal::fallback_formatter {}; diff --git a/compiler/util/common.cpp b/compiler/util/common.cpp index 23a22026..4c524624 100644 --- a/compiler/util/common.cpp +++ b/compiler/util/common.cpp @@ -2,7 +2,7 @@ #include #include -namespace seq { +namespace codon { namespace { void compilationMessage(const std::string &header, const std::string &msg, const std::string &file, int line, int col) { @@ -34,7 +34,7 @@ void compilationWarning(const std::string &msg, const std::string &file, int lin if (terminate) exit(EXIT_FAILURE); } -} // namespace seq +} // namespace codon void _seqassert(const char *expr_str, const char *file, int line, const std::string &msg) { diff --git a/compiler/util/common.h b/compiler/util/common.h index 5b0b717f..8386f9d1 100644 --- a/compiler/util/common.h +++ b/compiler/util/common.h @@ -61,7 +61,7 @@ extern int _level; void _seqassert(const char *expr_str, const char *file, int line, const std::string &msg); -namespace seq { +namespace codon { struct SrcInfo { std::string file; int line; @@ -74,7 +74,7 @@ struct SrcInfo { id = _id++; }; SrcInfo() : SrcInfo("", 0, 0, 0){}; - friend std::ostream &operator<<(std::ostream &out, const seq::SrcInfo &c) { + friend std::ostream &operator<<(std::ostream &out, const codon::SrcInfo &c) { char buf[PATH_MAX + 1]; strncpy(buf, c.file.c_str(), PATH_MAX); auto f = basename(buf); @@ -104,4 +104,4 @@ void compilationError(const std::string &msg, const std::string &file = "", void compilationWarning(const std::string &msg, const std::string &file = "", int line = 0, int col = 0, bool terminate = false); -} // namespace seq +} // namespace codon diff --git a/compiler/util/peg2cpp.cpp b/compiler/util/peg2cpp.cpp index 3e2d44cb..eb2b7be2 100644 --- a/compiler/util/peg2cpp.cpp +++ b/compiler/util/peg2cpp.cpp @@ -1015,7 +1015,7 @@ int main(int argc, char **argv) { string rules, actions; string action_preamble = " auto &CTX = any_cast(DT);\n"; string loc_preamble = " auto LI = VS.line_info();\n" - " auto LOC = seq::SrcInfo(\n" + " auto LOC = codon::SrcInfo(\n" " VS.path, LI.first + CTX.line_offset,\n" " LI.second + CTX.col_offset,\n" " VS.sv().size());\n"; diff --git a/runtime/main.cpp b/runtime/main.cpp index c6168b9b..5ba5010f 100644 --- a/runtime/main.cpp +++ b/runtime/main.cpp @@ -49,14 +49,14 @@ std::string makeOutputFilename(const std::string &filename, enum BuildKind { LLVM, Bitcode, Object, Executable, Detect }; enum OptMode { Debug, Release }; struct ProcessResult { - std::unique_ptr visitor; + std::unique_ptr visitor; std::string input; }; } // namespace int docMode(const std::vector &args, const std::string &argv0) { llvm::cl::ParseCommandLineOptions(args.size(), args.data()); - seq::generateDocstr(argv0); + codon::generateDocstr(argv0); return EXIT_SUCCESS; } @@ -84,14 +84,14 @@ ProcessResult processSource(const std::vector &args) { if (input != "-" && std::find_if(exts.begin(), exts.end(), [&](auto &ext) { return hasExtension(input, ext); }) == exts.end()) - seq::compilationError( + codon::compilationError( "input file is expected to be a .codon/.py file, or '-' for stdin"); std::unordered_map defmap; for (const auto &define : defines) { auto eq = define.find('='); if (eq == std::string::npos || !eq) { - seq::compilationWarning("ignoring malformed definition: " + define); + codon::compilationWarning("ignoring malformed definition: " + define); continue; } @@ -99,15 +99,15 @@ ProcessResult processSource(const std::vector &args) { auto value = define.substr(eq + 1); if (defmap.find(name) != defmap.end()) { - seq::compilationWarning("ignoring duplicate definition: " + define); + codon::compilationWarning("ignoring duplicate definition: " + define); continue; } defmap.emplace(name, value); } - auto *module = seq::parse(args[0], input.c_str(), /*code=*/"", /*isCode=*/false, - /*isTest=*/false, /*startLine=*/0, defmap); + auto *module = codon::parse(args[0], input.c_str(), /*code=*/"", /*isCode=*/false, + /*isTest=*/false, /*startLine=*/0, defmap); if (!module) return {{}, {}}; @@ -115,8 +115,8 @@ ProcessResult processSource(const std::vector &args) { auto t = std::chrono::high_resolution_clock::now(); std::vector disabledOptsVec(disabledOpts); - seq::ir::transform::PassManager pm(isDebug, disabledOptsVec); - seq::PluginManager plm(&pm, isDebug); + codon::ir::transform::PassManager pm(isDebug, disabledOptsVec); + codon::PluginManager plm(&pm, isDebug); LOG_TIME("[T] ir-setup = {:.1f}", std::chrono::duration_cast( @@ -128,16 +128,16 @@ ProcessResult processSource(const std::vector &args) { for (const auto &dsl : dsls) { auto result = plm.load(dsl); switch (result) { - case seq::PluginManager::NONE: + case codon::PluginManager::NONE: break; - case seq::PluginManager::NOT_FOUND: - seq::compilationError("DSL '" + dsl + "' not found"); + case codon::PluginManager::NOT_FOUND: + codon::compilationError("DSL '" + dsl + "' not found"); break; - case seq::PluginManager::NO_ENTRYPOINT: - seq::compilationError("DSL '" + dsl + "' has no entry point"); + case codon::PluginManager::NO_ENTRYPOINT: + codon::compilationError("DSL '" + dsl + "' has no entry point"); break; - case seq::PluginManager::UNSUPPORTED_VERSION: - seq::compilationError("DSL '" + dsl + "' version incompatible"); + case codon::PluginManager::UNSUPPORTED_VERSION: + codon::compilationError("DSL '" + dsl + "' version incompatible"); break; default: break; @@ -151,7 +151,7 @@ ProcessResult processSource(const std::vector &args) { 1000.0); t = std::chrono::high_resolution_clock::now(); - auto visitor = std::make_unique(isDebug); + auto visitor = std::make_unique(isDebug); visitor->visit(module); LOG_TIME("[T] ir-visitor = {:.1f}", std::chrono::duration_cast( @@ -208,7 +208,7 @@ int buildMode(const std::vector &args) { std::vector libsVec(libs); if (output.empty() && result.input == "-") - seq::compilationError("output file must be specified when reading from stdin"); + codon::compilationError("output file must be specified when reading from stdin"); std::string extension; switch (buildKind) { case BuildKind::LLVM: @@ -253,7 +253,7 @@ int buildMode(const std::vector &args) { } void showCommandsAndExit() { - seq::compilationError("Available commands: seqc "); + codon::compilationError("Available commands: seqc "); } int otherMode(const std::vector &args) { diff --git a/test/main.cpp b/test/main.cpp index 14e39902..797b7898 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -23,7 +23,7 @@ #include "util/common.h" #include "gtest/gtest.h" -using namespace seq; +using namespace codon; using namespace std; class TestOutliner : public ir::transform::OperatorPass { diff --git a/test/sir/analyze/dominator.cpp b/test/sir/analyze/dominator.cpp index 69ab3cf5..b6bf305b 100644 --- a/test/sir/analyze/dominator.cpp +++ b/test/sir/analyze/dominator.cpp @@ -3,7 +3,7 @@ #include "sir/analyze/dataflow/cfg.h" #include "sir/analyze/dataflow/dominator.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, DominatorAnalysisSimple) { auto *f = module->Nr("test_f"); diff --git a/test/sir/analyze/reaching.cpp b/test/sir/analyze/reaching.cpp index 43168645..9088dc39 100644 --- a/test/sir/analyze/reaching.cpp +++ b/test/sir/analyze/reaching.cpp @@ -3,7 +3,7 @@ #include "sir/analyze/dataflow/cfg.h" #include "sir/analyze/dataflow/reaching.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, RDAnalysisSimple) { auto *f = module->Nr("test_f"); diff --git a/test/sir/base.cpp b/test/sir/base.cpp index 7c80e525..eba47741 100644 --- a/test/sir/base.cpp +++ b/test/sir/base.cpp @@ -3,21 +3,21 @@ #include namespace { -class TestVisitor : public seq::ir::util::Visitor { +class TestVisitor : public codon::ir::util::Visitor { public: - void visit(seq::ir::IntConst *) override { FAIL(); } - void visit(seq::ir::BoolConst *) override {} + void visit(codon::ir::IntConst *) override { FAIL(); } + void visit(codon::ir::BoolConst *) override {} }; -class ConstTestVisitor : public seq::ir::util::ConstVisitor { +class ConstTestVisitor : public codon::ir::util::ConstVisitor { public: - void visit(const seq::ir::IntConst *) override { FAIL(); } - void visit(const seq::ir::BoolConst *) override {} + void visit(const codon::ir::IntConst *) override { FAIL(); } + void visit(const codon::ir::BoolConst *) override {} }; } // namespace -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, NodeNoReplacementRTTI) { auto *derived = module->Nr(1, module->getIntType()); diff --git a/test/sir/constant.cpp b/test/sir/constant.cpp index 84f74f27..cdf069ce 100644 --- a/test/sir/constant.cpp +++ b/test/sir/constant.cpp @@ -4,7 +4,7 @@ #include "util/fmt/format.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, ConstTypeQueryAndReplace) { auto *node = module->Nr(1, module->getIntType()); diff --git a/test/sir/flow.cpp b/test/sir/flow.cpp index b7c44420..45c9231f 100644 --- a/test/sir/flow.cpp +++ b/test/sir/flow.cpp @@ -5,7 +5,7 @@ #include "sir/util/matching.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, FlowTypeIsVoid) { auto *f = module->Nr(); diff --git a/test/sir/func.cpp b/test/sir/func.cpp index 0b525176..915ac031 100644 --- a/test/sir/func.cpp +++ b/test/sir/func.cpp @@ -4,7 +4,7 @@ #include "sir/util/matching.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, FuncRealizationAndVarInsertionEraseAndIterators) { auto *fn = module->Nr(); diff --git a/test/sir/instr.cpp b/test/sir/instr.cpp index b0e45dd6..f07eaa3c 100644 --- a/test/sir/instr.cpp +++ b/test/sir/instr.cpp @@ -2,7 +2,7 @@ #include "sir/util/matching.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, AssignInstrQueryAndReplace) { auto *var = module->Nr(module->getIntType()); diff --git a/test/sir/module.cpp b/test/sir/module.cpp index cb8087d1..5ec54dbc 100644 --- a/test/sir/module.cpp +++ b/test/sir/module.cpp @@ -2,7 +2,7 @@ #include "sir/util/matching.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, ModuleNodeBuildingRemovalAndIterators) { { @@ -15,7 +15,7 @@ TEST_F(SIRCoreTest, ModuleNodeBuildingRemovalAndIterators) { ASSERT_EQ(numTypes - 1, std::distance(module->types_begin(), module->types_end())); } { - auto n1 = module->N(seq::SrcInfo{}, 1, module->getIntType()); + auto n1 = module->N(codon::SrcInfo{}, 1, module->getIntType()); ASSERT_EQ(n1->getModule(), module.get()); auto numVals = std::distance(module->values_begin(), module->values_end()); ASSERT_TRUE(std::find(module->values_begin(), module->values_end(), n1) != diff --git a/test/sir/test.h b/test/sir/test.h index 600fd069..ed21e043 100644 --- a/test/sir/test.h +++ b/test/sir/test.h @@ -6,12 +6,12 @@ class SIRCoreTest : public testing::Test { protected: - std::unique_ptr module; - std::unique_ptr cv; + std::unique_ptr module; + std::unique_ptr cv; void SetUp() override { - seq::ir::IdMixin::resetId(); - module = std::make_unique("test"); - cv = std::make_unique(module.get()); + codon::ir::IdMixin::resetId(); + module = std::make_unique("test"); + cv = std::make_unique(module.get()); } }; diff --git a/test/sir/transform/manager.cpp b/test/sir/transform/manager.cpp index 2ce5740c..2ecd10f1 100644 --- a/test/sir/transform/manager.cpp +++ b/test/sir/transform/manager.cpp @@ -3,7 +3,7 @@ #include "sir/transform/manager.h" #include "sir/transform/pass.h" -using namespace seq::ir; +using namespace codon::ir; std::string ANALYSIS_KEY = "**test_analysis**"; std::string PASS_KEY = "**test_pass**"; diff --git a/test/sir/types/types.cpp b/test/sir/types/types.cpp index 0e84cf81..86f0cd5f 100644 --- a/test/sir/types/types.cpp +++ b/test/sir/types/types.cpp @@ -2,7 +2,7 @@ #include -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, RecordTypeQuery) { auto MEMBER_NAME = "1"; diff --git a/test/sir/util/matching.cpp b/test/sir/util/matching.cpp index 7c8e7d63..dfaff5cc 100644 --- a/test/sir/util/matching.cpp +++ b/test/sir/util/matching.cpp @@ -2,7 +2,7 @@ #include "sir/util/matching.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, MatchingEquivalentVar) { auto *first = module->Nr(module->getIntType()); diff --git a/test/sir/value.cpp b/test/sir/value.cpp index 089a9267..261a0ba6 100644 --- a/test/sir/value.cpp +++ b/test/sir/value.cpp @@ -1,6 +1,6 @@ #include "test.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, ValueQueryMethodsDelegate) { Value *original = module->Nr(1, module->getIntType(), "foo"); diff --git a/test/sir/var.cpp b/test/sir/var.cpp index 491272a0..53527858 100644 --- a/test/sir/var.cpp +++ b/test/sir/var.cpp @@ -1,6 +1,6 @@ #include "test.h" -using namespace seq::ir; +using namespace codon::ir; TEST_F(SIRCoreTest, VarQueryMethodsDelegate) { Var *original = module->Nr(module->getIntType());