blob: 13e029fead94380406566b47ce07a6c6b46bcc47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <willow/IR/Value.h>
#include <willow/IR/Constant.h>
#include <ostream>
std::ostream &operator<<(std::ostream &os, const willow::Value &v) {
using willow::ValueKind;
auto ty = v.getType();
if (!v.isVoid())
os << ty << " ";
switch (v.getValueKind()) {
case ValueKind::Parameter:
[[fallthrough]];
case ValueKind::Instruction: {
return os << "%" << v.getName();
}
case ValueKind::BasicBlock: {
return os << "^" << v.getName();
}
case ValueKind::Function: {
return os << "@" << v.getName();
}
case ValueKind::Constant: {
return os << *static_cast<const willow::Constant*>(&v);
}
}
}
|