-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended inline asm: handle missing cases.
Bitfields: better translation of initializers and compound literals; run this pass before unblocking. Transform.stmt: extend with ability to treat unblocked code. test/regression: more bitfield tests.
- Loading branch information
1 parent
3c6f534
commit b04bb78
Showing
8 changed files
with
105 additions
and
19 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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,10 @@ | ||
glob_s = { a = -12, b = 1 } | ||
glob_t = { c = 123, d = 0, e = -45 } | ||
loc_s = { a = 11, b = 2 } | ||
loc_t = { c = 11, d = 1, e = 2 } | ||
compound_s = { a = 2, b = 3 } | ||
compound_t = { c = 2, d = 0, e = -11 } | ||
loc_s = { a = 7, b = 2 } | ||
loc_t = { c = 7, d = 1, e = 50 } | ||
compound_s = { a = -14, b = 3 } | ||
compound_t = { c = 50, d = 0, e = -7 } |
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,49 @@ | ||
#include <stdio.h> | ||
|
||
/* Initialization of bit-fields */ | ||
|
||
struct s { | ||
signed char a: 6; | ||
unsigned int b: 2; | ||
}; | ||
|
||
struct t { | ||
unsigned int c: 16; | ||
unsigned int d: 1; | ||
short e: 8; | ||
}; | ||
|
||
void print_s(char * msg, struct s p) | ||
{ | ||
printf("%s = { a = %d, b = %d }\n", msg, p.a, p.b); | ||
} | ||
|
||
void print_t(char * msg, struct t p) | ||
{ | ||
printf("%s = { c = %d, d = %d, e = %d }\n", msg, p.c, p.d, p.e); | ||
} | ||
|
||
/* Global initialization */ | ||
struct s glob_s = { -12, 1 }; | ||
struct t glob_t = { 123, 0, -45 }; | ||
|
||
/* Local initialization */ | ||
void f(int x, int y) | ||
{ | ||
struct s loc_s = { x, y }; | ||
struct t loc_t = { x, 1, y }; | ||
print_s("loc_s", loc_s); | ||
print_t("loc_t", loc_t); | ||
print_s("compound_s", (struct s) { y, x }); | ||
print_t("compound_t", (struct t) { y, 0, -x }); | ||
} | ||
|
||
int main() | ||
{ | ||
print_s("glob_s", glob_s); | ||
print_t("glob_t", glob_t); | ||
f(11, 2); | ||
f(7, 50); | ||
return 0; | ||
} | ||
|