aboutsummaryrefslogtreecommitdiff
path: root/src/relooper/test_debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/relooper/test_debug.cpp')
-rw-r--r--src/relooper/test_debug.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/relooper/test_debug.cpp b/src/relooper/test_debug.cpp
new file mode 100644
index 00000000..14511b62
--- /dev/null
+++ b/src/relooper/test_debug.cpp
@@ -0,0 +1,30 @@
+
+#include "Relooper.h"
+
+int main() {
+ char buffer[10000];
+ rl_set_output_buffer(buffer, sizeof(buffer));
+
+ void *r = rl_new_relooper();
+ void *ep = rl_new_block("ep");
+ rl_relooper_add_block(r, ep);
+ void *LBB1 = rl_new_block("LBB1");
+ rl_relooper_add_block(r, LBB1);
+ void *LBB2 = rl_new_block("LBB2");
+ rl_relooper_add_block(r, LBB2);
+ void *LBB3 = rl_new_block("LBB3");
+ rl_relooper_add_block(r, LBB3);
+
+ rl_block_add_branch_to(ep, LBB1, "ep -> LBB1", NULL);
+ rl_block_add_branch_to(ep, LBB3, NULL, NULL);
+ rl_block_add_branch_to(LBB1, LBB2, "LBB1 -> LBB2", NULL);
+ rl_block_add_branch_to(LBB1, LBB3, NULL, NULL);
+ rl_block_add_branch_to(LBB2, LBB3, NULL, NULL);
+
+ rl_relooper_calculate(r, ep);
+ rl_relooper_render(r);
+ rl_delete_relooper(r);
+
+ puts(buffer);
+}
+