forked from petrv7/llvm2c
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or request
Description
(Just tracking the ideas for the future...)
// struct declarations
// anonymous struct declarations
// type definitions
// struct definitions
// function declarations
int main();
void test_assert(unsigned int var0);
// global variable definitions
int main(){
unsigned int var0;
unsigned int var1;
unsigned int var2;
unsigned int var3;
block0: ;
var0 = 0;
var1 = 0;
var2 = 1;
var3 = 3;
var1 = (((int)var2) + ((int)var3));
var2 = 3;
var3 = 5;
test_assert((unsigned int)(var1 == 4));
return 0;
}This code has several issues that we could remove:
-
the comments at the beginning of the program are not needed if nothing is generated for them
-
Set the signess of a variable in declaration if it is always used with a sign. #26 (var2 and var3)
-
Functions with no arguments should have void keyword specified #25 (the main function)
-
we could get rid of the
;afterblock0:in cases where there's no declaration immediately after the label -
we can remove labels that are not referred to by any goto (
block0in this case) -
we can remove unconditional jumps on labels that are going to be executed even without the jump (when the C code immediately follows the jump) (not in this code)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request