Remove some unnecessary/duplicate code.

This mainly comments out statements that zero out data that was already set to zero by a preceding Calloc call.
This commit is contained in:
Stephen Heumann 2022-07-18 21:19:44 -05:00
parent 60efb4d882
commit fd54fd70d0
3 changed files with 11 additions and 15 deletions

View File

@ -3343,7 +3343,7 @@ var
str^.opcode := pc_str; str^.opcode := pc_str;
str^.optype := optype; str^.optype := optype;
str^.r := llab; str^.r := llab;
str^.q := 0; {str^.q := 0;}
str^.left := op2; str^.left := op2;
if lop = nil then begin {insert the store in the basic block} if lop = nil then begin {insert the store in the basic block}
str^.next := bb^.code; str^.next := bb^.code;
@ -4941,7 +4941,7 @@ var
str^.opcode := pc_str; str^.opcode := pc_str;
str^.optype := optype; str^.optype := optype;
str^.r := loc^.r; str^.r := loc^.r;
str^.q := 0; {str^.q := 0;}
str^.left := op2; str^.left := op2;
str^.next := loc^.next; {insert the store in the basic block} str^.next := loc^.next; {insert the store in the basic block}
loc^.next := str; loc^.next := str;

View File

@ -1971,15 +1971,11 @@ var
{get controlling type after conversions} {get controlling type after conversions}
if expressionType^.kind = functionType then begin if expressionType^.kind = functionType then begin
controllingType.size := cgPointerSize; controllingType.size := cgPointerSize;
controllingType.saveDisp := 0;
controllingType.qualifiers := [];
controllingType.kind := pointerType; controllingType.kind := pointerType;
controllingType.pType := expressionType; controllingType.pType := expressionType;
end {if} end {if}
else if expressionType^.kind in [structType,unionType] then begin else if expressionType^.kind in [structType,unionType] then begin
controllingType.size := expressionType^.size; controllingType.size := expressionType^.size;
controllingType.saveDisp := 0;
controllingType.qualifiers := [];
controllingType.kind := definedType; controllingType.kind := definedType;
controllingType.dType := expressionType; controllingType.dType := expressionType;
end {else if} end {else if}
@ -1988,9 +1984,9 @@ var
if controllingType.kind = arrayType then begin if controllingType.kind = arrayType then begin
controllingType.kind := pointerType; controllingType.kind := pointerType;
controllingType.size := cgPointerSize; controllingType.size := cgPointerSize;
controllingType.saveDisp := 0;
end; {if} end; {if}
controllingType.qualifiers := []; controllingType.qualifiers := [];
controllingType.saveDisp := 0;
typesSeen := nil; typesSeen := nil;
resultExpr := nil; resultExpr := nil;
@ -2068,7 +2064,7 @@ var
resultExpr := pointer(Calloc(sizeof(tokenRecord))); resultExpr := pointer(Calloc(sizeof(tokenRecord)));
resultExpr^.token.kind := intconst; resultExpr^.token.kind := intconst;
resultExpr^.token.class := intConstant; resultExpr^.token.class := intConstant;
resultExpr^.token.ival := 0; {resultExpr^.token.ival := 0;}
end; {if} end; {if}
if resultExpr <> nil then begin if resultExpr <> nil then begin
resultExpr^.next := stack; {stack the resulting expression} resultExpr^.next := stack; {stack the resulting expression}

View File

@ -4684,8 +4684,8 @@ table := functionTable;
len := ord(functionName^[0]) + 1; len := ord(functionName^[0]) + 1;
tp := pointer(GCalloc(sizeof(typeRecord))); tp := pointer(GCalloc(sizeof(typeRecord)));
tp^.size := len; tp^.size := len;
tp^.saveDisp := 0; {tp^.saveDisp := 0;}
tp^.qualifiers := []; {tp^.qualifiers := [];}
tp^.kind := arrayType; tp^.kind := arrayType;
tp^.aType := constCharPtr; tp^.aType := constCharPtr;
tp^.elements := len; tp^.elements := len;
@ -4695,13 +4695,13 @@ sval := pointer(GCalloc(len + sizeof(integer)));
sval^.length := len; sval^.length := len;
for i := 1 to len-1 do for i := 1 to len-1 do
sval^.str[i] := functionName^[i]; sval^.str[i] := functionName^[i];
sval^.str[len] := chr(0); {sval^.str[len] := chr(0);}
iPtr := pointer(GCalloc(sizeof(initializerRecord))); iPtr := pointer(GCalloc(sizeof(initializerRecord)));
iPtr^.next := nil; {iPtr^.next := nil;}
iPtr^.count := 1; iPtr^.count := 1;
iPtr^.bitdisp := 0; {iPtr^.bitdisp := 0;}
iPtr^.bitsize := 0; {iPtr^.bitsize := 0;}
iPtr^.isStructOrUnion := false; {iPtr^.isStructOrUnion := false;}
iPtr^.isConstant := true; iPtr^.isConstant := true;
iPtr^.itype := cgString; iPtr^.itype := cgString;
iPtr^.sval := sval; iPtr^.sval := sval;