-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptimize2.h
53 lines (43 loc) · 923 Bytes
/
optimize2.h
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* B compiler pseudo-assembly optimizations
*
* by Ben Jones
*
* 2/16/2019
*/
unsigned char OPTIMIZE2_CONTINUE;
#define UNDEFINED_VALUE 0
#define EQUALS_VALUE 1
#define BETWEEN_VALUE 2
#define NOTEQUALS_VALUE 3
/*
* Stores the possible values of a register
*
* Handle when the register either:
* 1. Has a determined value
* 2. Is between two values
* 3. Is not a determined value
* 4. Has no determinable value
*/
typedef struct reg_value reg_value;
struct reg_value{
unsigned char value_type;
unsigned long int register_state;
union{
unsigned int value;
struct{
unsigned int min_value;
unsigned int max_value;
};
unsigned int not_value;
};
};
/*
* Store the current possible values of all of the registers
*/
typedef struct reg_values reg_values;
struct reg_values{
reg_value *values;
unsigned int num_registers;
};
void sweep_instructions(instruction **instructions);