Skip to content

Commit 6ca73bf

Browse files
committed
[TPDE] Remove value comparison requirement
We no longer compare values, only their local indices.
1 parent ddd16e8 commit 6ca73bf

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

tpde/include/tpde/IRAdaptor.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ concept IRAdaptor = requires(T a) {
109109
requires requires(typename T::IRValueRef r, typename T::IRValueRef w) {
110110
{ r == T::INVALID_VALUE_REF } -> std::convertible_to<bool>;
111111
{ r != T::INVALID_VALUE_REF } -> std::convertible_to<bool>;
112-
{ r < w } -> std::convertible_to<bool>;
113112
};
114113

115114

tpde/src/test/TestIR.hpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,32 @@ struct TestIR {
120120
void print() const noexcept;
121121
};
122122

123+
class IRValueRef {
124+
u32 val;
125+
126+
public:
127+
explicit constexpr IRValueRef(u32 val) : val(val) {}
128+
explicit constexpr operator u32() const { return val; }
129+
bool operator==(const IRValueRef &other) const { return val == other.val; }
130+
};
131+
132+
class IRInstRef {
133+
u32 val;
134+
135+
public:
136+
explicit constexpr IRInstRef(u32 val) : val(val) {}
137+
explicit constexpr operator u32() const { return val; }
138+
explicit constexpr operator IRValueRef() const { return IRValueRef(val); }
139+
bool operator==(const IRInstRef &other) const { return val == other.val; }
140+
};
141+
123142
struct TestIRAdaptor {
124143
TestIR *ir;
125144

126145
explicit TestIRAdaptor(TestIR *ir) : ir(ir) {}
127146

128-
enum class IRValueRef : u32 {
129-
};
130-
enum class IRInstRef : u32 {
131-
};
147+
using IRValueRef = tpde::test::IRValueRef;
148+
using IRInstRef = tpde::test::IRInstRef;
132149
enum class IRBlockRef : u32 {
133150
};
134151
enum class IRFuncRef : u32 {

0 commit comments

Comments
 (0)