return false;
} else if (!(out = fold_op(parser->fold, op, exprs))) {
/* generate a call to __builtin_mod */
- ast_expression *mod = intrin_func(parser->intrin, "mod");
+ ast_expression *mod = parser->m_intrin.func("mod");
ast_call *call = nullptr;
if (!mod) return false; /* can return null for missing floor */
}
if (!(out = fold_op(parser->fold, op, exprs))) {
- ast_expression *shift = intrin_func(parser->intrin, (op->id == opid2('<','<')) ? "__builtin_lshift" : "__builtin_rshift");
+ ast_expression *shift = parser->m_intrin.func((op->id == opid2('<','<')) ? "__builtin_lshift" : "__builtin_rshift");
ast_call *call = ast_call_new(parser_ctx(parser), shift);
call->params.push_back(exprs[0]);
call->params.push_back(exprs[1]);
}
if(!(out = fold_op(parser->fold, op, exprs))) {
- ast_expression *shift = intrin_func(parser->intrin, (op->id == opid3('<','<','=')) ? "__builtin_lshift" : "__builtin_rshift");
+ ast_expression *shift = parser->m_intrin.func((op->id == opid3('<','<','=')) ? "__builtin_lshift" : "__builtin_rshift");
ast_call *call = ast_call_new(parser_ctx(parser), shift);
call->params.push_back(exprs[0]);
call->params.push_back(exprs[1]);
}
if (!(out = fold_op(parser->fold, op, exprs))) {
- ast_call *gencall = ast_call_new(parser_ctx(parser), intrin_func(parser->intrin, "pow"));
+ ast_call *gencall = ast_call_new(parser_ctx(parser), parser->m_intrin.func("pow"));
gencall->params.push_back(exprs[0]);
gencall->params.push_back(exprs[1]);
out = (ast_expression*)gencall;
* TODO handle this at the intrinsic level with an ast_intrinsic
* node and codegen.
*/
- if ((fun = sy->out[fid].out) == intrin_debug_typestring(parser->intrin)) {
+ if ((fun = sy->out[fid].out) == parser->m_intrin.debug_typestring()) {
char ty[1024];
if (fid+2 != sy->out.size() || sy->out.back().block) {
parseerror(parser, "intrinsic __builtin_debug_typestring requires exactly 1 parameter");
for (i = 0; i < paramcount; i++)
vec_push(exprs, sy->out[fid+1 + i].out);
- if (!(foldval = intrin_fold(parser->intrin, (ast_value*)fun, exprs))) {
+ if (!(foldval = parser->m_intrin.fold((ast_value*)fun, exprs))) {
vec_free(exprs);
goto fold_leave;
}
* use the identifier as is.
*/
if (!strncmp(parser_tokval(parser), "__builtin_", 10)) {
- var = intrin_func(parser->intrin, parser_tokval(parser));
+ var = parser->m_intrin.func(parser_tokval(parser));
}
/*
* the first one masks for __builtin though, we emit warning here.
*/
if (!var) {
- if ((var = intrin_func(parser->intrin, parser_tokval(parser)))) {
+ if ((var = parser->m_intrin.func(parser_tokval(parser)))) {
(void)!compile_warning(
parser_ctx(parser),
WARN_BUILTINS,
parser->reserved_version = nullptr;
}
- parser->fold = fold_init (parser);
- parser->intrin = intrin_init(parser);
+ parser->fold = fold_init(parser);
+ parser->m_intrin = intrin(parser);
return parser;
}
util_htdel(parser->aliases);
fold_cleanup(parser->fold);
- intrin_cleanup(parser->intrin);
}
void parser_cleanup(parser_t *parser)