Clean up generated assembly - the switch takes care of the primitive size so we need only pass a length of 1 for variables.
This commit is contained in:
parent
4f75085348
commit
245daeb6f9
|
@ -512,9 +512,9 @@ void AsNewSymb(int ID) {
|
||||||
|
|
||||||
for(int i = 0; i < Symbols[ID].Length; i++) {
|
for(int i = 0; i < Symbols[ID].Length; i++) {
|
||||||
switch(TypeSize) {
|
switch(TypeSize) {
|
||||||
case 1: fprintf(OutputFile, "\t.byte\t0\n", Symbols[ID].Name); break;
|
case 1: fprintf(OutputFile, "\t.byte\t0\r\n", Symbols[ID].Name); break;
|
||||||
case 4: fprintf(OutputFile, "\t.long\t0\n", Symbols[ID].Name); break;
|
case 4: fprintf(OutputFile, "\t.long\t0\r\n", Symbols[ID].Name); break;
|
||||||
case 8: fprintf(OutputFile, "\t.quad\t0\n", Symbols[ID].Name); break;
|
case 8: fprintf(OutputFile, "\t.quad\t0\r\n", Symbols[ID].Name); break;
|
||||||
default: DieDecimal("Unknown type in AsNewSymbol", TypeSize); break;
|
default: DieDecimal("Unknown type in AsNewSymbol", TypeSize); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ void BeginVariableDeclaration(int Type) {
|
||||||
while(1) {
|
while(1) {
|
||||||
//printf("Identifier: %s\n", CurrentIdentifier);
|
//printf("Identifier: %s\n", CurrentIdentifier);
|
||||||
printf("Adding symbol %s of type %s.\n", CurrentIdentifier, TypeNames[Type]);
|
printf("Adding symbol %s of type %s.\n", CurrentIdentifier, TypeNames[Type]);
|
||||||
ID = AddSymbol(CurrentIdentifier, Type, ST_VAR, TypeSizes[Type]);
|
ID = AddSymbol(CurrentIdentifier, Type, ST_VAR, 1);
|
||||||
AsNewSymb(ID);
|
AsNewSymb(ID);
|
||||||
|
|
||||||
if(CurrentToken.type == LI_SEMIC) {
|
if(CurrentToken.type == LI_SEMIC) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user