Namespace update to codon (#2)

* namespace seq to codon

* using namespace seq -> codon

* seq:: to codon::

Co-authored-by: ‘markhend’ <‘markhend@gmail.com’>
pull/1/head
Mark Henderson 2021-10-04 12:10:59 -05:00 committed by GitHub
parent 6ed45a644c
commit d010f889dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
158 changed files with 430 additions and 430 deletions

View File

@ -7,7 +7,7 @@
#include <string>
#include <vector>
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<BinaryKeyword> getBinaryKeywords() { return {}; }
};
} // namespace seq
} // namespace codon

View File

@ -2,7 +2,7 @@
#include "util/common.h"
#include <dlfcn.h>
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

View File

@ -6,7 +6,7 @@
#include <string>
#include <vector>
namespace seq {
namespace codon {
/// Plugin metadata
struct Plugin {
@ -47,4 +47,4 @@ public:
Error load(DSL *dsl);
};
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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<Expr>;
/// 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

View File

@ -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<StmtPtr> stmts, bool ownBlock)
@ -419,4 +419,4 @@ string UpdateStmt::toString(int) const {
ACCEPT_IMPL(UpdateStmt, ASTVisitor);
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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<Type> {
struct Type : public codon::SrcObject, public std::enable_shared_from_this<Type> {
/// 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

View File

@ -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::TypePtr> &types) {
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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<Cache> {
/// 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<Cache> {
/// A list of field names and realization's realized field types.
vector<std::pair<string, types::TypePtr>> 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

View File

@ -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<ImportFile> getImportFile(const string &argv0, const string &what,
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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<ImportFile> getImportFile(const string &argv0, const string &what,
const string &module0 = "");
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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<milliseconds>(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

View File

@ -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<std::string, std::string> &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

View File

@ -7,7 +7,7 @@
#include "parser/peg/rules.h"
#include <any>
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<typename Tn::base_type>(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<BinaryExpr>(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<TupleExpr>(LOC, VS.transform<ExprPtr>());

View File

@ -4,7 +4,7 @@
#include "parser/peg/rules.h"
#include <any>
using namespace std;
using namespace seq::ast;
using namespace codon::ast;
#define V0 VS[0]
#define V1 VS[1]

View File

@ -24,7 +24,7 @@
extern int _ocaml_time;
using namespace std;
namespace seq {
namespace codon {
namespace ast {
static shared_ptr<peg::Grammar> grammar(nullptr);
@ -93,7 +93,7 @@ StmtPtr parseCode(const shared_ptr<Cache> &cache, const string &file,
}
ExprPtr parseExpr(const shared_ptr<Cache> &cache, const string &code,
const seq::SrcInfo &offset) {
const codon::SrcInfo &offset) {
return parseCode<ExprPtr>(cache, offset.file, code, offset.line, offset.col,
"fstring");
}
@ -138,7 +138,7 @@ shared_ptr<peg::Grammar> initOpenMPParser() {
}
vector<CallExpr::Arg> parseOpenMP(const shared_ptr<Cache> &cache, const string &code,
const seq::SrcInfo &loc) {
const codon::SrcInfo &loc) {
if (!ompGrammar)
ompGrammar = initOpenMPParser();
@ -162,4 +162,4 @@ vector<CallExpr::Arg> parseOpenMP(const shared_ptr<Cache> &cache, const string &
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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> &cache, const string &file,
const string &code, int line_offset = 0);
/// Parse a Seq code expression.
ExprPtr parseExpr(const shared_ptr<Cache> &cache, const string &code,
const seq::SrcInfo &offset);
const codon::SrcInfo &offset);
/// Parse a Seq file.
StmtPtr parseFile(const shared_ptr<Cache> &cache, const string &file);
/// Parse a OpenMP clause.
vector<CallExpr::Arg> parseOpenMP(const shared_ptr<Cache> &cache, const string &code,
const seq::SrcInfo &loc);
const codon::SrcInfo &loc);
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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 &);

View File

@ -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<json> DocVisitor::jsonify(const seq::SrcInfo &s) {
shared_ptr<json> DocVisitor::jsonify(const codon::SrcInfo &s) {
return make_shared<json>(vector<string>{to_string(s.line), to_string(s.len)});
}
@ -449,4 +449,4 @@ void DocVisitor::visit(AssignStmt *stmt) {
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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<json> jsonify(const seq::SrcInfo &s);
shared_ptr<json> jsonify(const codon::SrcInfo &s);
vector<StmtPtr> flatten(StmtPtr stmt, string *docstr = nullptr, bool deep = true);
public:
@ -89,4 +89,4 @@ public:
};
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -6,7 +6,7 @@
using fmt::format;
namespace seq {
namespace codon {
namespace ast {
FormatVisitor::FormatVisitor(bool html, shared_ptr<Cache> cache)
@ -438,4 +438,4 @@ void FormatVisitor::visit(YieldFromStmt *stmt) {
void FormatVisitor::visit(WithStmt *stmt) {}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -17,7 +17,7 @@
#include "parser/common.h"
#include "parser/visitors/visitor.h"
namespace seq {
namespace codon {
namespace ast {
class FormatVisitor : public CallbackASTVisitor<string, string> {
@ -140,4 +140,4 @@ public:
};
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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> cache, const StmtPtr &node,
auto preamble = make_shared<Preamble>();
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<SimplifyContext> ctx,
: ctx(move(ctx)), preamble(move(preamble)) {}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<StmtPtr> stmts,
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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<StmtPtr> SimplifyVisitor::getClassMethods(const StmtPtr &s) {
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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<TranslateContext> 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<string> names;
vector<int> indices;
vector<SrcInfo> srcInfos;
vector<seq::ir::types::Type *> types;
vector<codon::ir::types::Type *> 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<string> names;
vector<seq::ir::types::Type *> types;
vector<codon::ir::types::Type *> types;
vector<int> 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

View File

@ -21,7 +21,7 @@
#include "parser/visitors/visitor.h"
#include "sir/sir.h"
namespace seq {
namespace codon {
namespace ast {
class TranslateVisitor : public CallbackASTVisitor<ir::Value *, ir::Value *> {
@ -30,7 +30,7 @@ class TranslateVisitor : public CallbackASTVisitor<ir::Value *, ir::Value *> {
public:
explicit TranslateVisitor(shared_ptr<TranslateContext> ctx);
static seq::ir::Module *apply(shared_ptr<Cache> cache, StmtPtr stmts);
static codon::ir::Module *apply(shared_ptr<Cache> 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

View File

@ -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> cache, seq::ir::SeriesFlow *series,
seq::ir::BodiedFunc *base)
TranslateContext::TranslateContext(shared_ptr<Cache> cache, codon::ir::SeriesFlow *series,
codon::ir::BodiedFunc *base)
: Context<TranslateItem>(""), cache(std::move(cache)) {
stack.push_front(vector<string>());
bases.push_back(base);
@ -62,14 +62,14 @@ shared_ptr<TranslateItem> 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<seq::ir::Module *>(bases[0]->getModule());
codon::ir::Module *TranslateContext::getModule() const {
return dynamic_cast<codon::ir::Module *>(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

View File

@ -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<TranslateItem> {
/// A pointer to the shared cache.
shared_ptr<Cache> cache;
/// Stack of function bases.
vector<seq::ir::BodiedFunc *> bases;
vector<codon::ir::BodiedFunc *> bases;
/// Stack of IR series (blocks).
vector<seq::ir::SeriesFlow *> series;
vector<codon::ir::SeriesFlow *> series;
public:
TranslateContext(shared_ptr<Cache> cache, seq::ir::SeriesFlow *series,
seq::ir::BodiedFunc *base);
TranslateContext(shared_ptr<Cache> cache, codon::ir::SeriesFlow *series,
codon::ir::BodiedFunc *base);
using Context<TranslateItem>::add;
/// Convenience method for adding an object to the context.
@ -67,14 +67,14 @@ public:
shared_ptr<TranslateItem> 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

View File

@ -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

View File

@ -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<ExprPtr, StmtPtr> {
@ -294,7 +294,7 @@ private:
types::TypePtr realizeType(types::ClassType *typ);
types::TypePtr realizeFunc(types::FuncType *typ);
std::pair<int, StmtPtr> 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

View File

@ -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> cache)
@ -400,4 +400,4 @@ void TypeContext::dump(int pad) {
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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<int, StmtPtr> TypecheckVisitor::inferTypes(StmtPtr result, bool keepLast,
}
}
if (!fixed) {
map<int, pair<seq::SrcInfo, string>> v;
map<int, pair<codon::SrcInfo, string>> 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<seq::ast::types::Type>(t->shared_from_this()));
std::const_pointer_cast<codon::ast::types::Type>(t->shared_from_this()));
// Not needed for classes, I guess
// if (auto &ast = ctx->cache->classes[t->name].ast)
// handle->setAttribute(std::make_unique<ir::KeyValueAttribute>(ast->attributes));
@ -475,4 +475,4 @@ ir::types::Type *TypecheckVisitor::getLLVMType(const types::ClassType *t) {
}
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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 <typename Tn, typename... Ts>
auto Nx(const seq::SrcObject *s, Ts &&...args) {
auto Nx(const codon::SrcObject *s, Ts &&...args) {
auto t = std::make_shared<Tn>(std::forward<Ts>(args)...);
t->setSrcInfo(s->getSrcInfo());
return t;
@ -215,4 +215,4 @@ struct ReplaceASTVisitor : public ASTVisitor {
};
} // namespace ast
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
#include "dominator.h"
namespace seq {
namespace codon {
namespace ir {
namespace analyze {
namespace dataflow {
@ -69,4 +69,4 @@ std::unique_ptr<Result> DominatorAnalysis::run(const Module *m) {
} // namespace dataflow
} // namespace analyze
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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<Result> RDAnalysis::run(const Module *m) {
} // namespace dataflow
} // namespace analyze
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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<Result> GlobalVarsAnalyses::run(const Module *m) {
} // namespace module
} // namespace analyze
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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<Result> SideEffectAnalysis::run(const Module *m) {
} // namespace module
} // namespace analyze
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<SrcInfoAttribute>(std::move(s)));
}
/// @return the src info
seq::SrcInfo getSrcInfo() const {
codon::SrcInfo getSrcInfo() const {
return getAttribute<SrcInfoAttribute>() ? getAttribute<SrcInfoAttribute>()->info
: seq::SrcInfo();
: codon::SrcInfo();
}
/// @return a text representation of a reference to the object
@ -330,11 +330,11 @@ template <typename Desired> 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 <typename Char>
struct formatter<Node, Char> : fmt::v6::internal::fallback_formatter<Node, Char> {};

View File

@ -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<std::string>::NodeId = 0;
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<seq::ir::Value *> &values) {
int findAndReplace(id_t id, codon::ir::Value *newVal,
std::list<codon::ir::Value *> &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

View File

@ -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 <typename Char>
struct formatter<Flow, Char> : fmt::v6::internal::fallback_formatter<Flow, Char> {};

View File

@ -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<seq::ir::Var *> &values) {
int findAndReplace(id_t id, codon::ir::Var *newVal, std::list<codon::ir::Var *> &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

View File

@ -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

View File

@ -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<seq::ir::Value *> &values) {
int findAndReplace(id_t id, codon::ir::Value *newVal,
std::vector<codon::ir::Value *> &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

View File

@ -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

View File

@ -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(); }

View File

@ -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(); }

View File

@ -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(); }

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -6,7 +6,7 @@
#include <unordered_map>
#include <vector>
namespace seq {
namespace codon {
namespace ir {
class LLVMVisitor : public util::ConstVisitor {
@ -293,4 +293,4 @@ public:
};
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -7,24 +7,24 @@
#include "func.h"
namespace seq {
namespace codon {
namespace ir {
namespace {
std::vector<seq::ast::types::TypePtr>
std::vector<codon::ast::types::TypePtr>
translateGenerics(std::vector<types::Generic> &generics) {
std::vector<seq::ast::types::TypePtr> ret;
std::vector<codon::ast::types::TypePtr> ret;
for (auto &g : generics) {
seqassert(g.isStatic() || g.getTypeValue(), "generic must be static or a type");
ret.push_back(std::make_shared<seq::ast::types::LinkType>(
g.isStatic() ? std::make_shared<seq::ast::types::StaticType>(g.getStaticValue())
ret.push_back(std::make_shared<codon::ast::types::LinkType>(
g.isStatic() ? std::make_shared<codon::ast::types::StaticType>(g.getStaticValue())
: g.getTypeValue()->getAstType()));
}
return ret;
}
std::vector<std::pair<std::string, seq::ast::types::TypePtr>>
std::vector<std::pair<std::string, codon::ast::types::TypePtr>>
generateDummyNames(std::vector<types::Type *> &types) {
std::vector<std::pair<std::string, seq::ast::types::TypePtr>> ret;
std::vector<std::pair<std::string, codon::ast::types::TypePtr>> 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::Type *> &types) {
return ret;
}
std::vector<seq::ast::types::TypePtr> translateArgs(std::vector<types::Type *> &types) {
std::vector<seq::ast::types::TypePtr> ret = {
std::make_shared<seq::ast::types::LinkType>(
seq::ast::types::LinkType::Kind::Unbound, 0)};
std::vector<codon::ast::types::TypePtr> translateArgs(std::vector<types::Type *> &types) {
std::vector<codon::ast::types::TypePtr> ret = {
std::make_shared<codon::ast::types::LinkType>(
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<types::FuncType>(t);
std::vector<char> mask(std::distance(irType->begin(), irType->end()), 0);
ret.push_back(std::make_shared<seq::ast::types::PartialType>(
ret.push_back(std::make_shared<codon::ast::types::PartialType>(
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<types::Type *> argTypes, bool variadic) {
auto args = translateArgs(argTypes);
args[0] = std::make_shared<seq::ast::types::LinkType>(rType->getAstType());
args[0] = std::make_shared<codon::ast::types::LinkType>(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

View File

@ -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 <typename DesiredType, typename... Args>
DesiredType *N(seq::SrcInfo s, Args &&...args) {
DesiredType *N(codon::SrcInfo s, Args &&...args) {
auto *ret = new DesiredType(std::forward<Args>(args)...);
ret->setModule(this);
ret->setSrcInfo(s);
@ -241,7 +241,7 @@ public:
/// @param args the arguments
/// @return the new node
template <typename DesiredType, typename... Args>
DesiredType *N(const seq::SrcObject *s, Args &&...args) {
DesiredType *N(const codon::SrcObject *s, Args &&...args) {
return N<DesiredType>(s->getSrcInfo(), std::forward<Args>(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 <typename DesiredType, typename... Args> DesiredType *Nr(Args &&...args) {
return N<DesiredType>(seq::SrcInfo(), std::forward<Args>(args)...);
return N<DesiredType>(codon::SrcInfo(), std::forward<Args>(args)...);
}
/// @return the type-checker cache
@ -415,4 +415,4 @@ private:
};
} // namespace ir
} // namespace seq
} // namespace codon

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More