mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-23 08:32:39 +00:00
Fixed type inference for StackIdxValue. Added a few missing stack fragments for __stackcall with pointers.
This commit is contained in:
parent
ee18c2c414
commit
e1e17f6152
@ -0,0 +1,4 @@
|
||||
lda #>{c1}
|
||||
pha
|
||||
lda #<{c1}
|
||||
pha
|
@ -0,0 +1,4 @@
|
||||
lda {m1}+1
|
||||
pha
|
||||
lda {m1}
|
||||
pha
|
@ -0,0 +1,5 @@
|
||||
tsx
|
||||
lda STACK_BASE+{c1},x
|
||||
sta {m1}
|
||||
lda STACK_BASE+{c1}+1,x
|
||||
sta {m1}+1
|
@ -141,7 +141,7 @@ public class ControlFlowGraph implements Serializable {
|
||||
public List<ControlFlowBlock> getEntryPointBlocks(Program program) {
|
||||
List<ControlFlowBlock> entryPointBlocks = new ArrayList<>();
|
||||
for(Procedure procedure : program.getScope().getAllProcedures(true)) {
|
||||
if(Pass2ConstantIdentification.isAddressOfUsed(procedure.getRef(), program) || procedure.getCallingConvension().equals(Procedure.CallingConvension.STACK_CALL)) {
|
||||
if(Pass2ConstantIdentification.isAddressOfUsed(procedure.getRef(), program) || Procedure.CallingConvension.STACK_CALL.equals(procedure.getCallingConvension())) {
|
||||
// Address-of is used on the procedure
|
||||
Label procedureLabel = procedure.getLabel();
|
||||
ControlFlowBlock procedureBlock = getBlock(procedureLabel.getRef());
|
||||
|
@ -114,7 +114,7 @@ public class SymbolTypeInference {
|
||||
} else if(rValue instanceof ParamValue) {
|
||||
return inferType(symbols, ((ParamValue) rValue).getParameter());
|
||||
} else if(rValue instanceof StackIdxValue) {
|
||||
return SymbolType.BYTE;
|
||||
return ((StackIdxValue) rValue).getValueType();
|
||||
} else if(rValue instanceof MemsetValue) {
|
||||
return ((MemsetValue) rValue).getType();
|
||||
} else if(rValue instanceof MemcpyValue) {
|
||||
|
@ -21,7 +21,7 @@ public class Pass1AssertNoRecursion extends Pass1Base {
|
||||
Collection<Procedure> procedures = getScope().getAllProcedures(true);
|
||||
for(Procedure procedure : procedures) {
|
||||
Collection<ScopeRef> recursiveCalls = callGraph.getRecursiveCalls(procedure.getRef());
|
||||
if(recursiveCalls.contains(procedure.getRef()) && !procedure.getCallingConvension().equals(Procedure.CallingConvension.STACK_CALL)) {
|
||||
if(recursiveCalls.contains(procedure.getRef()) && !Procedure.CallingConvension.STACK_CALL.equals(procedure.getCallingConvension())) {
|
||||
throw new CompileError("ERROR! Recursion not allowed! Occurs in " + procedure.getRef());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user