Skip to content

Commit 92f39c1

Browse files
committed
[verbose] Even more verbose comments
1 parent 5ab3370 commit 92f39c1

6 files changed

+18
-14
lines changed

filter/bccon/contract_collect.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void rewrite_chain_add_sub(vector<bh_instruction*>& chain)
6060
bh_instruction& last = *chain.back();
6161

6262
if (!chain_has_same_type(chain)) {
63-
verbose_print("[Collect] Addsub chain doesn't have same type.");
63+
verbose_print("[Collect] \tAddsub chain doesn't have same type.");
6464
return;
6565
}
6666

@@ -69,7 +69,7 @@ static void rewrite_chain_add_sub(vector<bh_instruction*>& chain)
6969
case BH_COMPLEX64:
7070
case BH_COMPLEX128:
7171
case BH_R123:
72-
verbose_print("[Collect] Don't know how to do complex types, yet.");
72+
verbose_print("[Collect] \tDon't know how to do complex types, yet.");
7373
return;
7474
}
7575

@@ -116,7 +116,7 @@ static void rewrite_chain_mul_div(vector<bh_instruction*>& chain)
116116
bh_instruction& last = *chain.back();
117117

118118
if (!chain_has_same_type(chain)) {
119-
verbose_print("[Collect] Muldiv chain doesn't have same type.");
119+
verbose_print("[Collect] \tMuldiv chain doesn't have same type.");
120120
return;
121121
}
122122

@@ -125,7 +125,7 @@ static void rewrite_chain_mul_div(vector<bh_instruction*>& chain)
125125
case BH_COMPLEX64:
126126
case BH_COMPLEX128:
127127
case BH_R123:
128-
verbose_print("[Collect] Don't know how to do complex types, yet.");
128+
verbose_print("[Collect] \tDon't know how to do complex types, yet.");
129129
return;
130130
}
131131

filter/bccon/contract_muladd.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ static bool rewrite_chain(bh_ir &bhir, const vector<bh_instruction*>& chain, con
5454
if (view == instr.operand[0] or
5555
view == instr.operand[1] or
5656
view == instr.operand[2]) {
57-
verbose_print("[Muladd] Can't rewrite - Found use of view in other place!");
57+
verbose_print("[Muladd] \tCan't rewrite - Found use of view in other place!");
5858
return false;
5959
}
6060
}
6161
}
6262
}
6363

6464
if (frees.size() != temps.size()) {
65-
verbose_print("[Muladd] Can't rewrite - Not same amount of views as frees!");
65+
verbose_print("[Muladd] \tCan't rewrite - Not same amount of views as frees!");
6666
return false;
6767
}
6868

filter/bccon/contract_repeats.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void Contracter::contract_repeats(bh_ir &bhir)
134134
bhir.instr_list = new_bh_instr_list;
135135
}
136136
} catch(std::runtime_error& e) {
137-
verbose_print("[Repeat] Regex failed - Moving on");
137+
verbose_print("[Repeat] \tRegex failed - Moving on");
138138
return;
139139
}
140140

filter/bccon/contract_stupidmath.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void Contracter::contract_stupidmath(bh_ir &bhir)
9090
bh_instruction& instr = bhir.instr_list[pc];
9191

9292
if (is_doing_stupid_math(instr)) {
93+
verbose_print("[Stupid math] Is doing stupid math with a " + std::string(bh_opcode_text(instr.opcode)));
9394

9495
// We could have the following:
9596
// BH_MULTIPLY B A 0
@@ -120,6 +121,7 @@ void Contracter::contract_stupidmath(bh_ir &bhir)
120121
}
121122

122123
if (!freed) {
124+
verbose_print("[Stupid math] \tCan't rectify as it isn't freeing in same flush.");
123125
continue;
124126
}
125127

@@ -137,6 +139,7 @@ void Contracter::contract_stupidmath(bh_ir &bhir)
137139

138140
// Only if we FREE B in the same flush, are we allowed to change things.
139141
if (created_before) {
142+
verbose_print("[Stupid math] \tCan't rectify as other view isn't created in same flush.");
140143
continue;
141144
}
142145

@@ -157,7 +160,7 @@ void Contracter::contract_stupidmath(bh_ir &bhir)
157160
}
158161

159162
// Remove self
160-
verbose_print("[Stupid math] Removing " + std::string(bh_opcode_text(instr.opcode)));
163+
verbose_print("[Stupid math] \tRemoving " + std::string(bh_opcode_text(instr.opcode)));
161164
instr.opcode = BH_NONE;
162165
}
163166
}

filter/bcexp/expand_powk.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ static const int64_t max_exponent_unfolding = 100;
3030

3131
int Expander::expand_powk(bh_ir& bhir, int pc)
3232
{
33+
verbose_print("[Powk] Expanding BH_POWER");
34+
3335
int start_pc = pc;
3436

3537
// Grab the BH_POWER instruction
@@ -50,22 +52,21 @@ int Expander::expand_powk(bh_ir& bhir, int pc)
5052
exponent = instr.constant.get_int64();
5153
} catch (overflow_error& e) {
5254
// Give up, if we cannot get a signed integer
53-
verbose_print("[Powk] Can't expand BH_POWER with non-integer");
55+
verbose_print("[Powk] \tCan't expand BH_POWER with non-integer");
5456
return 0;
5557
}
5658

5759
if (0 > exponent || exponent > max_exponent_unfolding) {
58-
verbose_print("[Powk] Can't expand BH_POWER with exponent " + std::to_string(exponent));
60+
verbose_print("[Powk] \tCan't expand BH_POWER with exponent " + std::to_string(exponent));
5961
return 0;
6062
}
6163

6264
// TODO: Add support for this case by using intermediates.
6365
if (instr.operand[0].base == instr.operand[1].base) {
64-
verbose_print("[Powk] Can't expand BH_POWER without intermediates.");
66+
verbose_print("[Powk] \tCan't expand BH_POWER without intermediates.");
6567
return 0;
6668
}
6769

68-
verbose_print("[Powk] Expanding BH_POWER");
6970
// Lazy choice... no re-use just NOP it.
7071
instr.opcode = BH_NONE;
7172

filter/bcexp/expand_reduce1d.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int Expander::expand_reduce1d(bh_ir& bhir, int pc, int thread_limit)
4545
bh_instruction& instr = bhir.instr_list[pc];
4646
bh_opcode opcode = instr.opcode;
4747
bh_index elements = bh_nelements(instr.operand[1]);
48+
verbose_print("[Reduce1D] Expanding " + string(bh_opcode_text(opcode)));
4849

4950
if (elements * 2 < thread_limit) {
5051
return 0;
@@ -59,7 +60,7 @@ int Expander::expand_reduce1d(bh_ir& bhir, int pc, int thread_limit)
5960
}
6061

6162
if (fold < 2) {
62-
verbose_print("[Reduce1D] Can't expand " + string(bh_opcode_text(opcode)) + " with a fold less than 2.");
63+
verbose_print("[Reduce1D] \tCan't expand " + string(bh_opcode_text(opcode)) + " with a fold less than 2.");
6364
return 0;
6465
}
6566

@@ -83,7 +84,6 @@ int Expander::expand_reduce1d(bh_ir& bhir, int pc, int thread_limit)
8384
inject(bhir, ++pc, opcode, out, temp, 0, BH_INT64);
8485
inject(bhir, ++pc, BH_FREE, temp);
8586

86-
verbose_print("[Reduce1D] Expanding " + string(bh_opcode_text(opcode)));
8787
return pc - start_pc;
8888
}
8989

0 commit comments

Comments
 (0)