-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/chapter_20/int_only/no_coalescing/eax_live_at_exit.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Make sure we recognize that EAX is live at exit. | ||
* Don't inspect assembly; just validate the program's behavior. | ||
* Note: only works as intended once we've implemented register coalescing. | ||
* */ | ||
|
||
#include "util.h" | ||
|
||
int glob = 10; | ||
int glob2 = 0; | ||
|
||
// The first round of coalescing will coalesce x into EAX. | ||
// Then, if we don't realize that EAX is live at exit, we'll | ||
// coalesce the temporary that holds x + 100 into EAX, clobbering x. | ||
|
||
int target(void) { | ||
int x = glob + 1; // 11 | ||
glob2 = x + 100; | ||
return x; | ||
} | ||
|
||
int main(void) { | ||
int retval = target(); | ||
check_one_int(retval, 11); | ||
check_one_int(glob2, 111); | ||
return 0; | ||
} |
16 changes: 0 additions & 16 deletions
16
tests/chapter_20/int_only/with_coalescing/eax_live_at_exit.c
This file was deleted.
Oops, something went wrong.