refactor xo::ast -> xo::scm + restore nodef ppdetail_atomic build

This commit is contained in:
Roland Conybeare 2025-07-28 10:13:25 -04:00
commit 483ce15988
78 changed files with 243 additions and 237 deletions

View file

@ -56,18 +56,18 @@ int
main() {
using xo::scope;
using xo::jit::MachPipeline;
using xo::ast::make_constant;
using xo::ast::make_primitive;
using xo::ast::llvmintrinsic;
using xo::ast::make_apply;
using xo::ast::make_var;
using xo::ast::make_lambda;
using xo::scm::make_constant;
using xo::scm::make_primitive;
using xo::scm::llvmintrinsic;
using xo::scm::make_apply;
using xo::scm::make_var;
using xo::scm::make_lambda;
using xo::reflect::Reflect;
using xo::xtag;
using std::cerr;
using std::endl;
//using xo::ast::make_constant;
//using xo::scm::make_constant;
static llvm::ExitOnError llvm_exit_on_err;

View file

@ -47,18 +47,18 @@ main() {
using xo::scope;
using xo::jit::MachPipeline;
using xo::jit::activation_record;
using xo::ast::make_constant;
using xo::ast::make_primitive;
using xo::ast::llvmintrinsic;
using xo::ast::make_apply;
using xo::ast::make_var;
using xo::ast::make_lambda;
using xo::scm::make_constant;
using xo::scm::make_primitive;
using xo::scm::llvmintrinsic;
using xo::scm::make_apply;
using xo::scm::make_var;
using xo::scm::make_lambda;
using xo::reflect::Reflect;
using xo::xtag;
using std::cerr;
using std::endl;
//using xo::ast::make_constant;
//using xo::scm::make_constant;
static llvm::ExitOnError llvm_exit_on_err;

View file

@ -56,13 +56,13 @@ namespace xo {
**/
class MachPipeline : public ref::Refcount {
public:
using Expression = xo::ast::Expression;
using Lambda = xo::ast::Lambda;
using GlobalEnv = xo::ast::GlobalEnv;
using Expression = xo::scm::Expression;
using Lambda = xo::scm::Lambda;
using GlobalEnv = xo::scm::GlobalEnv;
using TypeDescr = xo::reflect::TypeDescr;
using ExecutionSession = llvm::orc::ExecutionSession;
using DataLayout = llvm::DataLayout;
//using ConstantInterface = xo::ast::ConstantInterface;
//using ConstantInterface = xo::scm::ConstantInterface;
public:
/* tracking KaleidoscopeJIT::Create() here.. */
@ -109,8 +109,8 @@ namespace xo {
* @c llvm::Type instances are *immortal* (llvm interns them into opaque global lookup tables)
**/
llvm::Type * codegen_type(TypeDescr td);
llvm::Value * codegen_constant(bp<xo::ast::ConstantInterface> expr);
llvm::Function * codegen_primitive(bp<xo::ast::PrimitiveInterface> expr);
llvm::Value * codegen_constant(bp<xo::scm::ConstantInterface> expr);
llvm::Function * codegen_primitive(bp<xo::scm::PrimitiveInterface> expr);
/** like @ref codegen_primitive , but create wrapper function that accepts (and discards)
* environment pointer as first argument.
@ -118,7 +118,7 @@ namespace xo {
* Implementation consists of tail call to natural primitive, that skips the unused
* environment pointer
**/
llvm::Function * codegen_primitive_wrapper(bp<xo::ast::PrimitiveInterface> expr,
llvm::Function * codegen_primitive_wrapper(bp<xo::scm::PrimitiveInterface> expr,
llvm::IRBuilder<> & ir_builder);
/** Generate closure for invoking a primitive function.
@ -126,17 +126,17 @@ namespace xo {
* to support function-pointer-like behavior for a target function
* that may resolve to primitive-or-lambda at runtime
**/
llvm::Value * codegen_primitive_closure(bp<xo::ast::PrimitiveInterface> expr,
llvm::Value * codegen_primitive_closure(bp<xo::scm::PrimitiveInterface> expr,
llvm::IRBuilder<> & ir_builder);
llvm::Value * codegen_apply(bp<xo::ast::Apply> expr,
llvm::Value * codegen_apply(bp<xo::scm::Apply> expr,
llvm::Value * envptr,
llvm::IRBuilder<> & ir_builder);
/* NOTE: codegen_lambda() needs to be reentrant too.
* for example can have a lambda in apply position.
*/
llvm::Function * codegen_lambda_decl(bp<xo::ast::Lambda> expr);
llvm::Function * codegen_lambda_defn(bp<xo::ast::Lambda> expr, llvm::IRBuilder<> & ir_builder);
llvm::Function * codegen_lambda_decl(bp<xo::scm::Lambda> expr);
llvm::Function * codegen_lambda_defn(bp<xo::scm::Lambda> expr, llvm::IRBuilder<> & ir_builder);
/** Generate closure for invoking a lambda (user-defined function).
* See @ref MachPipeline::codegen_apply for invocation
* Same ABI as @ref MachPipeline::codegen_primitive_closure
@ -147,13 +147,13 @@ namespace xo {
* @ref MachPipeline::codegen_toplevel and friends are responsible for
* assembling and propagating this.
**/
llvm::Value * codegen_lambda_closure(bp<xo::ast::Lambda> lambda,
llvm::Value * codegen_lambda_closure(bp<xo::scm::Lambda> lambda,
llvm::Value * envptr,
llvm::IRBuilder<> & ir_builder);
llvm::Value * codegen_variable(bp<xo::ast::Variable> var,
llvm::Value * codegen_variable(bp<xo::scm::Variable> var,
llvm::Value * envptr,
llvm::IRBuilder<> & ir_builder);
llvm::Value * codegen_ifexpr(bp<xo::ast::IfExpr> ifexpr,
llvm::Value * codegen_ifexpr(bp<xo::scm::IfExpr> ifexpr,
llvm::Value * envptr,
llvm::IRBuilder<> & ir_builder);

View file

@ -17,7 +17,7 @@
namespace xo {
namespace jit {
/** analagous to xo::ast::binding_path,
/** analagous to xo::scm::binding_path,
* but with locations renumbered to include only vars that belong to an explict runtime
* environment object; in other words we exclude vars with stack-only storage
**/
@ -119,7 +119,7 @@ namespace xo {
**/
class activation_record {
public:
using Lambda = xo::ast::Lambda;
using Lambda = xo::scm::Lambda;
using TypeDescr = xo::reflect::TypeDescr;
public:

View file

@ -20,8 +20,8 @@ namespace xo {
**/
struct type2llvm {
public:
using FunctionInterface = xo::ast::FunctionInterface;
using Lambda = xo::ast::Lambda;
using FunctionInterface = xo::scm::FunctionInterface;
using Lambda = xo::scm::Lambda;
using TypeDescr = xo::reflect::TypeDescr;
public:

View file

@ -7,17 +7,17 @@
#include <string>
namespace xo {
using xo::ast::exprtype;
using xo::ast::Expression;
using xo::ast::ConstantInterface;
//using xo::ast::FunctionInterface;
using xo::ast::PrimitiveInterface;
using xo::ast::Lambda;
using xo::ast::Variable;
using xo::ast::Apply;
using xo::ast::IfExpr;
using xo::ast::GlobalEnv;
using xo::ast::llvmintrinsic;
using xo::scm::exprtype;
using xo::scm::Expression;
using xo::scm::ConstantInterface;
//using xo::scm::FunctionInterface;
using xo::scm::PrimitiveInterface;
using xo::scm::Lambda;
using xo::scm::Variable;
using xo::scm::Apply;
using xo::scm::IfExpr;
using xo::scm::GlobalEnv;
using xo::scm::llvmintrinsic;
using xo::reflect::Reflect;
using xo::reflect::StructMember;
using xo::reflect::TypeDescr;
@ -369,7 +369,7 @@ namespace xo {
} /*codegen_primitive_wrapper*/
llvm::Value *
MachPipeline::codegen_primitive_closure(bp<xo::ast::PrimitiveInterface> expr,
MachPipeline::codegen_primitive_closure(bp<xo::scm::PrimitiveInterface> expr,
llvm::IRBuilder<> & ir_builder)
{
constexpr bool c_debug_flag = true;
@ -435,7 +435,7 @@ namespace xo {
/* we don't need any special checking here.
* already know (from xo-level checking) that pointer has the right type.
*
* Specifically, xo::ast::Apply::make() requires the expression in function position
* Specifically, xo::scm::Apply::make() requires the expression in function position
* have suitable function type.
*
* Now: we have an llvm::Value (fn_value) representing the pointer.
@ -1026,7 +1026,7 @@ namespace xo {
*/
/* WIP. STRATEGY:
* - xo::ast::ClosureExpr (an expression that generates a closure)
* - xo::scm::ClosureExpr (an expression that generates a closure)
* closure = {lambda, env}
*
* - pass 1:

View file

@ -4,16 +4,16 @@
#include <string>
namespace xo {
using xo::ast::exprtype;
using xo::ast::Expression;
using xo::ast::ConstantInterface;
//using xo::ast::FunctionInterface;
using xo::ast::PrimitiveInterface;
using xo::ast::Lambda;
using xo::ast::Variable;
using xo::ast::Apply;
using xo::ast::IfExpr;
using xo::ast::llvmintrinsic;
using xo::scm::exprtype;
using xo::scm::Expression;
using xo::scm::ConstantInterface;
//using xo::scm::FunctionInterface;
using xo::scm::PrimitiveInterface;
using xo::scm::Lambda;
using xo::scm::Variable;
using xo::scm::Apply;
using xo::scm::IfExpr;
using xo::scm::llvmintrinsic;
using xo::reflect::Reflect;
using xo::reflect::StructMember;
using xo::reflect::TypeDescr;
@ -465,7 +465,7 @@ namespace xo {
/* we don't need any special checking here.
* already know (from xo-level checking) that pointer has the right type.
*
* Specifically, xo::ast::Apply::make() requires the expression in function position
* Specifically, xo::scm::Apply::make() requires the expression in function position
* have suitable function type.
*
* Now: we have an llvm::Value (fn_value) representing the pointer.

View file

@ -4,16 +4,16 @@
#include <string>
namespace xo {
using xo::ast::exprtype;
using xo::ast::Expression;
using xo::ast::ConstantInterface;
//using xo::ast::FunctionInterface;
using xo::ast::PrimitiveInterface;
using xo::ast::Lambda;
using xo::ast::Variable;
using xo::ast::Apply;
using xo::ast::IfExpr;
using xo::ast::llvmintrinsic;
using xo::scm::exprtype;
using xo::scm::Expression;
using xo::scm::ConstantInterface;
//using xo::scm::FunctionInterface;
using xo::scm::PrimitiveInterface;
using xo::scm::Lambda;
using xo::scm::Variable;
using xo::scm::Apply;
using xo::scm::IfExpr;
using xo::scm::llvmintrinsic;
using xo::reflect::Reflect;
using xo::reflect::StructMember;
using xo::reflect::TypeDescr;
@ -465,7 +465,7 @@ namespace xo {
/* we don't need any special checking here.
* already know (from xo-level checking) that pointer has the right type.
*
* Specifically, xo::ast::Apply::make() requires the expression in function position
* Specifically, xo::scm::Apply::make() requires the expression in function position
* have suitable function type.
*
* Now: we have an llvm::Value (fn_value) representing the pointer.

View file

@ -10,13 +10,13 @@
namespace xo {
using xo::jit::MachPipeline;
using xo::ast::make_apply;
using xo::ast::make_var;
using xo::ast::make_primitive;
using xo::ast::llvmintrinsic;
using xo::ast::Expression;
using xo::ast::Lambda;
using xo::ast::exprtype;
using xo::scm::make_apply;
using xo::scm::make_var;
using xo::scm::make_primitive;
using xo::scm::llvmintrinsic;
using xo::scm::Expression;
using xo::scm::Lambda;
using xo::scm::exprtype;
using xo::reflect::Reflect;
using xo::reflect::reflect_struct;
using xo::ref::brw;