Predator  [unstable] git snapshot
cldebug.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Kamil Dudka <kdudka@redhat.com>
3  *
4  * This file is part of predator.
5  *
6  * predator is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * any later version.
10  *
11  * predator is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with predator. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef H_GUARD_CLDEBUG_H
21 #define H_GUARD_CLDEBUG_H
22 
23 #include <iostream>
24 
25 struct cl_accessor;
26 struct cl_operand;
27 struct cl_type;
28 
29 namespace CodeStorage {
30  struct Insn;
31 }
32 
33 void cltToStream(std::ostream &str, const struct cl_type *clt, unsigned depth);
34 void acToStream(std::ostream &str, const struct cl_accessor *ac, bool oneline);
35 void operandToStream(std::ostream &str, const struct cl_operand &op);
36 void insnToStream(std::ostream &str, const CodeStorage::Insn &insn);
37 
38 inline std::ostream& operator<<(std::ostream &str, const struct cl_type &clt)
39 {
40  cltToStream(str, &clt, /* oneline */ 0U);
41  return str;
42 }
43 
44 inline std::ostream& operator<<(std::ostream &str, const struct cl_accessor &ac)
45 {
46  acToStream(str, &ac, /* oneline */ true);
47  return str;
48 }
49 
50 inline std::ostream& operator<<(std::ostream &str, const struct cl_operand &op)
51 {
52  operandToStream(str, op);
53  return str;
54 }
55 
56 namespace CodeStorage {
57 
58 inline std::ostream& operator<<(std::ostream &str, const Insn &in)
59 {
60  insnToStream(str, in);
61  return str;
62 }
63 
64 } // namespace CodeStorage
65 
66 #endif /* H_GUARD_CLDEBUG_H */