Add the M6 aggregate gate (structs/unions by value, 6-byte/5-word returns, nested and mixed members, exact-copy guards) and scale every optimizer-created GEP after opt in tms-clang; --normalize treated SROA's aggregate-split byte offsets as bits. The generic sweep now passes multiple-return-values-cross- block-with-invoke.
38 lines
934 B
C
38 lines
934 B
C
/*
|
|
* switch.c -- a dense char switch, used by tests/m4/termtris.sh to pin the
|
|
* driver's late-GEP policy.
|
|
*
|
|
* The optimizer's switch-to-lookup-table transform creates a new i8 GEP after
|
|
* tms-bitaddr --scale. tms-clang's post-opt --scale converts that byte/element
|
|
* index to bits (M6 Task 6 generalized this beyond the old switch.table-only
|
|
* normalize rule). This source makes the hazard reachable at -O2 (termtris'
|
|
* init_game and runesc switches are the real cases): a missed scale would
|
|
* index the table one bit per slot.
|
|
*/
|
|
int sw_tile(int c)
|
|
{
|
|
switch(c) {
|
|
case '#': return 2;
|
|
case '.': return 1;
|
|
case '{': return 11;
|
|
case '}': return 12;
|
|
case '[': return 13;
|
|
case ']': return 14;
|
|
case '>': return 15;
|
|
case '<': return 16;
|
|
case '-': return 17;
|
|
case '(': return 18;
|
|
case ')': return 19;
|
|
default: return 0;
|
|
}
|
|
}
|
|
|
|
int sw_sum(const char *s)
|
|
{
|
|
int r = 0;
|
|
while(*s) {
|
|
r += sw_tile(*s++);
|
|
}
|
|
return r;
|
|
}
|