Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp] export isl_printer functionality #6

Open
ftynse opened this issue Jul 25, 2017 · 6 comments
Open

[cpp] export isl_printer functionality #6

ftynse opened this issue Jul 25, 2017 · 6 comments

Comments

@ftynse
Copy link
Member

ftynse commented Jul 25, 2017

It can fit a custom stream object, similarly to std::stringstream, which has state and can accept any relevant objects using operator <<. This way, it will be possible to configure the output formats of the isl_printer. The different between printer_to_file and printer_to_str can be resolved, e.g., with inheritance. It would be nice if printer_to_str behaved similarly to std::stringstream. Finally, callbacks accepting/returning a printer object can accept/return a stream object instead, which is compatible with C++ notion of a stream.

@tobiasgrosser
Copy link
Member

Very interesting. I would like to see a modern printer interface for isl. Sven wanted to not directly expose the isl printer as he did not like the current design. It would be great to learn what kind of interface Sven has in mind.

@tobiasgrosser
Copy link
Member

Or what kind of interface we would like to have.

@tobiasgrosser
Copy link
Member

In fact Polly we just define operator<< using isl_*_to_str:

#define ADD_OSTREAM_PRINTER(name)                                              \
  inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,                  \
                                       const name &Obj) {                      \
    OS << Obj.to_str();                                                        \
    return OS;                                                                 \
  }

ADD_OSTREAM_PRINTER(isl::aff)
ADD_OSTREAM_PRINTER(isl::ast_expr)
ADD_OSTREAM_PRINTER(isl::ast_node)
ADD_OSTREAM_PRINTER(isl::basic_map)
ADD_OSTREAM_PRINTER(isl::basic_set)
ADD_OSTREAM_PRINTER(isl::map)
ADD_OSTREAM_PRINTER(isl::set)
ADD_OSTREAM_PRINTER(isl::id)
ADD_OSTREAM_PRINTER(isl::multi_aff)
ADD_OSTREAM_PRINTER(isl::multi_pw_aff)
ADD_OSTREAM_PRINTER(isl::multi_union_pw_aff)
ADD_OSTREAM_PRINTER(isl::point)
ADD_OSTREAM_PRINTER(isl::pw_aff)
ADD_OSTREAM_PRINTER(isl::schedule)
ADD_OSTREAM_PRINTER(isl::schedule_node)
ADD_OSTREAM_PRINTER(isl::space)
ADD_OSTREAM_PRINTER(isl::union_access_info)
ADD_OSTREAM_PRINTER(isl::union_flow)
ADD_OSTREAM_PRINTER(isl::union_set)
ADD_OSTREAM_PRINTER(isl::union_map)
ADD_OSTREAM_PRINTER(isl::union_pw_aff)
ADD_OSTREAM_PRINTER(isl::union_pw_multi_aff)

https://github.com/llvm-mirror/polly/blob/master/include/polly/Support/ISLOStream.h

@ftynse
Copy link
Member Author

ftynse commented Jul 25, 2017

This sort of definitions can be auto-generated, I think, but it won't solve the callbacks problem.

@tobiasgrosser
Copy link
Member

Sure, the Polly stuff is certainly not a complete interface.

Can you expand a little on the callback stuff. What exactly would you like / do you need?

@chandangreddy
Copy link

What we need is the AST printing functions exposed with the support for callbacks handling users node printing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants