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:
Curle 2020-11-23 19:23:41 +00:00
parent 4f75085348
commit 245daeb6f9
Signed by: TheCurle
GPG Key ID: 5942F13718443F79
2 changed files with 4 additions and 4 deletions

View File

@ -512,9 +512,9 @@ void AsNewSymb(int ID) {
for(int i = 0; i < Symbols[ID].Length; i++) {
switch(TypeSize) {
case 1: fprintf(OutputFile, "\t.byte\t0\n", Symbols[ID].Name); break;
case 4: fprintf(OutputFile, "\t.long\t0\n", Symbols[ID].Name); break;
case 8: fprintf(OutputFile, "\t.quad\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\r\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;
}
}

View File

@ -42,7 +42,7 @@ void BeginVariableDeclaration(int Type) {
while(1) {
//printf("Identifier: %s\n", CurrentIdentifier);
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);
if(CurrentToken.type == LI_SEMIC) {