mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-01 16:51:12 +00:00
Working on log output readability. #534
This commit is contained in:
parent
e3cd22ecab
commit
f117db148d
@ -90,7 +90,7 @@ public class StatementAssignment extends StatementBase implements StatementLValu
|
|||||||
public String toString(Program program, boolean aliveInfo) {
|
public String toString(Program program, boolean aliveInfo) {
|
||||||
return
|
return
|
||||||
super.idxString() +
|
super.idxString() +
|
||||||
lValue.toString(program) + " ← " +
|
lValue.toString(program) + " = " +
|
||||||
(rValue1 == null ? "" : rValue1.toString(program) + " ") +
|
(rValue1 == null ? "" : rValue1.toString(program) + " ") +
|
||||||
(operator == null ? "" : operator + " ") +
|
(operator == null ? "" : operator + " ") +
|
||||||
rValue2.toString(program) +
|
rValue2.toString(program) +
|
||||||
|
@ -89,7 +89,7 @@ public class StatementCall extends StatementBase implements StatementLValue, Sta
|
|||||||
res.append(super.idxString());
|
res.append(super.idxString());
|
||||||
if(lValue != null) {
|
if(lValue != null) {
|
||||||
res.append(lValue.toString(program));
|
res.append(lValue.toString(program));
|
||||||
res.append(" ← ");
|
res.append(" = ");
|
||||||
}
|
}
|
||||||
res.append("call ");
|
res.append("call ");
|
||||||
if(procedure != null) {
|
if(procedure != null) {
|
||||||
|
@ -61,7 +61,7 @@ public class StatementCallFinalize extends StatementBase implements StatementLVa
|
|||||||
res.append(super.idxString());
|
res.append(super.idxString());
|
||||||
if(lValue != null) {
|
if(lValue != null) {
|
||||||
res.append(lValue.toString(program));
|
res.append(lValue.toString(program));
|
||||||
res.append(" ← ");
|
res.append(" = ");
|
||||||
}
|
}
|
||||||
res.append("callfinalize ");
|
res.append("callfinalize ");
|
||||||
if(procedure != null) {
|
if(procedure != null) {
|
||||||
|
@ -80,7 +80,7 @@ public class StatementCallPointer extends StatementBase implements StatementLVal
|
|||||||
res.append(super.idxString());
|
res.append(super.idxString());
|
||||||
if(lValue != null) {
|
if(lValue != null) {
|
||||||
res.append(lValue.toString(program));
|
res.append(lValue.toString(program));
|
||||||
res.append(" ← ");
|
res.append(" = ");
|
||||||
}
|
}
|
||||||
res.append("call ");
|
res.append("call ");
|
||||||
res.append(procedure.toString(program) + " ");
|
res.append(procedure.toString(program) + " ");
|
||||||
|
@ -81,9 +81,14 @@ public class StatementPhiBlock extends StatementBase {
|
|||||||
for(PhiVariable phiVariable : variables) {
|
for(PhiVariable phiVariable : variables) {
|
||||||
s.append(super.idxString());
|
s.append(super.idxString());
|
||||||
s.append(phiVariable.getVariable().toString(program));
|
s.append(phiVariable.getVariable().toString(program));
|
||||||
s.append(" ← phi(");
|
s.append(" = phi(");
|
||||||
|
boolean first = true;
|
||||||
for(PhiRValue phiRValue : phiVariable.getValues()) {
|
for(PhiRValue phiRValue : phiVariable.getValues()) {
|
||||||
|
if(first)
|
||||||
s.append(" ");
|
s.append(" ");
|
||||||
|
else
|
||||||
|
s.append(", ");
|
||||||
|
first = false;
|
||||||
s.append(phiRValue.getPredecessor().toString(null));
|
s.append(phiRValue.getPredecessor().toString(null));
|
||||||
s.append("/");
|
s.append("/");
|
||||||
RValue rValue = phiRValue.getrValue();
|
RValue rValue = phiRValue.getrValue();
|
||||||
|
@ -96,7 +96,7 @@ public class Label implements Symbol {
|
|||||||
if(program == null) {
|
if(program == null) {
|
||||||
return getFullName();
|
return getFullName();
|
||||||
} else {
|
} else {
|
||||||
return "(" + getType().getTypeName() + ") " + getFullName();
|
return getType().getTypeName() + " " + getFullName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,9 +256,7 @@ public class Procedure extends Scope {
|
|||||||
if(interruptType != null) {
|
if(interruptType != null) {
|
||||||
res.append("interrupt(").append(interruptType).append(")");
|
res.append("interrupt(").append(interruptType).append(")");
|
||||||
}
|
}
|
||||||
res.append("(").append(getType().getTypeName()).append(") ");
|
res.append(getType().getTypeName()).append(" ").append(getFullName()).append("(");
|
||||||
res.append(getFullName());
|
|
||||||
res.append("(");
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
if(parameterNames != null) {
|
if(parameterNames != null) {
|
||||||
for(Variable parameter : getParameters()) {
|
for(Variable parameter : getParameters()) {
|
||||||
|
@ -370,7 +370,7 @@ public abstract class Scope implements Symbol, Serializable {
|
|||||||
Variable symVar = (Variable) symbol;
|
Variable symVar = (Variable) symbol;
|
||||||
if(!onlyVars || symVar.isVariable()) {
|
if(!onlyVars || symVar.isVariable()) {
|
||||||
// Output if not instructed to only output variables - or if it is a variable
|
// Output if not instructed to only output variables - or if it is a variable
|
||||||
res.append(symbol.toString(program));
|
res.append(symVar.typeString() + " " + symVar.toString());
|
||||||
if(symVar.isArray()) {
|
if(symVar.isArray()) {
|
||||||
res.append("[");
|
res.append("[");
|
||||||
if(symVar.getArraySize() != null) {
|
if(symVar.getArraySize() != null) {
|
||||||
|
@ -629,13 +629,22 @@ public class Variable implements Symbol {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toString(null);
|
return getFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Program program) {
|
public String toString(Program program) {
|
||||||
return new StringBuilder()
|
return toString();
|
||||||
.append("(")
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a string describing the type of the variable
|
||||||
|
*
|
||||||
|
* @return The type as a string
|
||||||
|
*/
|
||||||
|
public String typeString() {
|
||||||
|
final StringBuilder print = new StringBuilder();
|
||||||
|
print
|
||||||
.append(isKindConstant() ? "const " : "")
|
.append(isKindConstant() ? "const " : "")
|
||||||
.append(isNoModify() ? "nomodify " : "")
|
.append(isNoModify() ? "nomodify " : "")
|
||||||
.append(isVolatile() ? "volatile " : "")
|
.append(isVolatile() ? "volatile " : "")
|
||||||
@ -643,8 +652,8 @@ public class Variable implements Symbol {
|
|||||||
.append(isToVolatile() ? "to_volatile " : "")
|
.append(isToVolatile() ? "to_volatile " : "")
|
||||||
.append(getType().getTypeName())
|
.append(getType().getTypeName())
|
||||||
.append(isKindIntermediate() ? "~" : "")
|
.append(isKindIntermediate() ? "~" : "")
|
||||||
.append(") ")
|
;
|
||||||
.append(getFullName()).toString();
|
return print.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,11 +65,7 @@ public class ConstantChar implements ConstantEnumerable<Character> {
|
|||||||
@Override
|
@Override
|
||||||
public String toString(Program program) {
|
public String toString(Program program) {
|
||||||
String enc = (encoding.equals(StringEncoding.SCREENCODE_MIXED)) ? "" : encoding.suffix;
|
String enc = (encoding.equals(StringEncoding.SCREENCODE_MIXED)) ? "" : encoding.suffix;
|
||||||
if(program == null) {
|
|
||||||
return "'" + value + "'" + enc;
|
return "'" + value + "'" + enc;
|
||||||
} else {
|
|
||||||
return "(" + SymbolType.BYTE.getTypeName() + ") " + "'" + value + "'" + enc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,11 +57,7 @@ public class ConstantInteger implements ConstantEnumerable<Long> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Program program) {
|
public String toString(Program program) {
|
||||||
if(program == null) {
|
|
||||||
return AsmFormat.getAsmNumber(number);
|
return AsmFormat.getAsmNumber(number);
|
||||||
} else {
|
|
||||||
return "(" + getType(program.getScope()).getTypeName() + ") " + AsmFormat.getAsmNumber(number);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +37,10 @@ public class PointerDereferenceIndexed implements PointerDereference {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Program program) {
|
public String toString(Program program) {
|
||||||
return "*(" + pointer.toString(program) + " + " + index.toString(program) + ')';
|
String pointerString = pointer.toString(program);
|
||||||
|
if(!pointerString.matches("[a-zA-Z0-9:#$]*"))
|
||||||
|
pointerString = "(" + pointerString + ")";
|
||||||
|
return pointerString + "[" + index.toString(program) + ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user