Now I have an isl_map, which prints out as follows: { S_7[k, i, j] -> C[o0, o1] }.
I want to construct a constraint that ideally should look like this: {S_7[k, i, j] -> C[o0, o1]: i / j = o0}.
How can I use isl_val / isl_aff / isl_constraint to construct this constraint?
I tried using isl_aff_var_on_domain to perform arithmetic operations between isl_aff variables, but when using isl_div, the second operand must be a constant, which seems unfeasible. Are there any other methods (besides reading from a string)?
Thanks for your help.
Below is my code implementation.
int lhs_pos = comp->get_loop_level_number_from_dimension_name(lhs.get_name());
int rhs_pos = comp->get_loop_level_number_from_dimension_name(rhs.get_name());
auto sp = isl_map_get_space(map);
isl_local_space *ls = isl_local_space_from_space(sp);
isl_aff* lhs_var = isl_aff_var_on_domain(isl_local_space_copy(ls), isl_dim_in, lhs_pos);
isl_aff* rhs_var = isl_aff_var_on_domain(isl_local_space_copy(ls), isl_dim_in, rhs_pos);
isl_aff* out_var = isl_aff_var_on_domain(isl_local_space_copy(ls), isl_dim_out, i);
isl_aff* result = isl_aff_mul(lhs_var, rhs_var);
result = isl_aff_sub(result, out_var);
cst = isl_equality_from_aff(result);
map = isl_map_add_constraint(map, cst);