Commit d0e7734e authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Updated to latest version of mu/mu-spec/muapi.h

parent b5d23c10
......@@ -1204,6 +1204,9 @@ namespace C
}
virtual Any<MuCommInst> visitCommInst(UIRParser::CommInstContext *context) override {
std::string op = context->GLOBAL_NAME()->getText().substr(1, std::string::npos);
// Use the following regex on the MU_CI... definition section in muapi.h to generate this code:
// search #[^ ]* ([A-Z_0-9]*)[^@]*@([a-z0-9.-_]*)
// replace : op == "$2" ? "$1"s
return op == "uvm.new_stack" ? "MU_CI_UVM_NEW_STACK"s
: op == "uvm.kill_stack" ? "MU_CI_UVM_KILL_STACK"s
: op == "uvm.thread_exit" ? "MU_CI_UVM_THREAD_EXIT"s
......@@ -1248,6 +1251,10 @@ namespace C
: op == "uvm.meta.enable_watchpoint" ? "MU_CI_UVM_META_ENABLE_WATCHPOINT"s
: op == "uvm.meta.disable_watchpoint" ? "MU_CI_UVM_META_DISABLE_WATCHPOINT"s
: op == "uvm.meta.set_trap_handler" ? "MU_CI_UVM_META_SET_TRAP_HANDLER"s
: op == "uvm.meta.constant_by_id" ? "MU_CI_UVM_META_CONSTANT_BY_ID"s
: op == "uvm.meta.global_by_id" ? "MU_CI_UVM_META_GLOBAL_BY_ID"s
: op == "uvm.meta.func_by_id" ? "MU_CI_UVM_META_FUNC_BY_ID"s
: op == "uvm.meta.expfunc_by_id" ? "MU_CI_UVM_META_EXPFUNC_BY_ID"s
: op == "uvm.irbuilder.new_ir_builder" ? "MU_CI_UVM_IRBUILDER_NEW_IR_BUILDER"s
: op == "uvm.irbuilder.load" ? "MU_CI_UVM_IRBUILDER_LOAD"s
: op == "uvm.irbuilder.abort" ? "MU_CI_UVM_IRBUILDER_ABORT"s
......
......@@ -70,8 +70,8 @@ Declares 2 types `@int32` and an anonymous `int<32>`.
## Limitations
Muc will only check for correct syntax, it is up to you to ensure your input is semantically valid.
The files muapi.h and mu-fastimpl.h where taken from 'mu/mu-impl-fast' (master branch) they are kept up to date on each commit of this repo.
If they are changed (or their behaviour changes), muc may not work correctly.
The file mu-fastimpl.h was taken from 'mu/mu-impl-fast' (master branch) and muapi.h from 'mu/mu-spec' they are kept up to date on each commit of mu-tool-compiler.
If they are changed (or Zebu's behaviour or the spec changes with respect to hem), muc may not work correctly.
If you are declaring a `.const` with an integer literal, the type must be declared before the literal
(i.e. it must be declared inline like `.const @foo <int<32>> = 3` or be declared in a previous line of the bundle or in a previous bundle).
......
......@@ -1219,6 +1219,9 @@ namespace Runtime
}
virtual Any<MuCommInst> visitCommInst(UIRParser::CommInstContext *context) override {
std::string op = context->GLOBAL_NAME()->getText().substr(1, std::string::npos);
// Use the following regex on the MU_CI... definition section in muapi.h to generate this code:
// search #[^ ]* ([A-Z_0-9]*)[^@]*@([a-z0-9.-_]*)
// replace : op == "$2" ? $1
return op == "uvm.new_stack" ? MU_CI_UVM_NEW_STACK
: op == "uvm.kill_stack" ? MU_CI_UVM_KILL_STACK
: op == "uvm.thread_exit" ? MU_CI_UVM_THREAD_EXIT
......@@ -1263,6 +1266,10 @@ namespace Runtime
: op == "uvm.meta.enable_watchpoint" ? MU_CI_UVM_META_ENABLE_WATCHPOINT
: op == "uvm.meta.disable_watchpoint" ? MU_CI_UVM_META_DISABLE_WATCHPOINT
: op == "uvm.meta.set_trap_handler" ? MU_CI_UVM_META_SET_TRAP_HANDLER
: op == "uvm.meta.constant_by_id" ? MU_CI_UVM_META_CONSTANT_BY_ID
: op == "uvm.meta.global_by_id" ? MU_CI_UVM_META_GLOBAL_BY_ID
: op == "uvm.meta.func_by_id" ? MU_CI_UVM_META_FUNC_BY_ID
: op == "uvm.meta.expfunc_by_id" ? MU_CI_UVM_META_EXPFUNC_BY_ID
: op == "uvm.irbuilder.new_ir_builder" ? MU_CI_UVM_IRBUILDER_NEW_IR_BUILDER
: op == "uvm.irbuilder.load" ? MU_CI_UVM_IRBUILDER_LOAD
: op == "uvm.irbuilder.abort" ? MU_CI_UVM_IRBUILDER_ABORT
......
......@@ -270,9 +270,6 @@ struct MuVM {
// Set handlers
void (*set_trap_handler)(MuVM *mvm, MuTrapHandler trap_handler, MuCPtr userdata);
void (*compile_to_sharedlib)(MuVM *mvm, MuCString lib_name, MuCString *extra_srcs, MuArraySize n_extra_srcs); /// MUAPIPARSER extra_srcs:array:n_extra_srcs
void (*current_thread_as_mu_thread)(MuVM *mvm, MuCPtr threadlocal);
};
// A local context. It can only be used by one thread at a time. It holds many
......@@ -791,6 +788,10 @@ struct MuIRBuilder {
#define MU_CI_UVM_META_ENABLE_WATCHPOINT ((MuCommInst)0x25e) /// MUAPIPARSER muname:@uvm.meta.enable_watchpoint
#define MU_CI_UVM_META_DISABLE_WATCHPOINT ((MuCommInst)0x25f) /// MUAPIPARSER muname:@uvm.meta.disable_watchpoint
#define MU_CI_UVM_META_SET_TRAP_HANDLER ((MuCommInst)0x260) /// MUAPIPARSER muname:@uvm.meta.set_trap_handler
#define MU_CI_UVM_META_CONSTANT_BY_ID ((MuCommInst)0x268) /// MUAPIPARSER muname:@uvm.meta.constant_by_id
#define MU_CI_UVM_META_GLOBAL_BY_ID ((MuCommInst)0x269) /// MUAPIPARSER muname:@uvm.meta.global_by_id
#define MU_CI_UVM_META_FUNC_BY_ID ((MuCommInst)0x26a) /// MUAPIPARSER muname:@uvm.meta.func_by_id
#define MU_CI_UVM_META_EXPFUNC_BY_ID ((MuCommInst)0x26b) /// MUAPIPARSER muname:@uvm.meta.expfunc_by_id
#define MU_CI_UVM_IRBUILDER_NEW_IR_BUILDER ((MuCommInst)0x270) /// MUAPIPARSER muname:@uvm.irbuilder.new_ir_builder
#define MU_CI_UVM_IRBUILDER_LOAD ((MuCommInst)0x300) /// MUAPIPARSER muname:@uvm.irbuilder.load
#define MU_CI_UVM_IRBUILDER_ABORT ((MuCommInst)0x301) /// MUAPIPARSER muname:@uvm.irbuilder.abort
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment