mirror of
https://github.com/irmen/prog8.git
synced 2025-05-12 19:47:48 +00:00
clearer error message
This commit is contained in:
parent
98505d27b1
commit
4d91f92a2e
@ -190,6 +190,7 @@ memory (name, size, alignment)
|
||||
with the given name. The name must be a string literal, it cannot be empty or be a variable.
|
||||
The block is *uninitialized memory*; unlike other variables in Prog8 it is *not* set to zero at the start of the program!
|
||||
(if that is required, you can do so yourself using ``memset``).
|
||||
No *dynamic* allocation is done; the block with this name is placed in memory only once!
|
||||
If you specify an alignment value >1, it means the block of memory will
|
||||
be aligned to such a dividable address in memory, for instance an alignment of $100 means the
|
||||
memory block is aligned on a page boundary, and $2 means word aligned (even addresses).
|
||||
|
@ -8,6 +8,7 @@ Future Things and Ideas
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- STRUCTS: are now being developed in their own separate branch "structs". This will be for the next major version of the compiler (v12)
|
||||
- targetStatement() method could only take IBuiltinFunctions rather than program, optionally even if you don't want/have to check the builtin functions
|
||||
- is "checkAssignmentCompatible" redundant (gets called just 1 time!) when we also have "checkValueTypeAndRange" ?
|
||||
- romable: should we have a way to explicitly set the memory address for the BSS area (instead of only the highram bank number on X16, allow a memory address too for the -varshigh option?)
|
||||
- Kotlin: can we use inline value classes in certain spots?
|
||||
@ -32,7 +33,8 @@ Future Things and Ideas
|
||||
IR/VM
|
||||
-----
|
||||
- getting it in shape for code generation...: the IR file should be able to encode every detail about a prog8 program (the VM doesn't have to actually be able to run all of it though!)
|
||||
- fix call() return value handling
|
||||
- fix call() return value handling (... what's wrong with it again?)
|
||||
- encode asmsub/extsub clobber info in the call , or maybe include these definitions in the p8ir file itself too. (return registers are already encoded in the CALL instruction)
|
||||
- proper code gen for the CALLI instruction and that it (optionally) returns a word value that needs to be assigned to a reg
|
||||
- implement fast code paths for TODO("inplace split....
|
||||
- implement more TODOs in AssignmentGen
|
||||
@ -42,6 +44,8 @@ IR/VM
|
||||
cx16.r0sL = cx16.r1s as byte }
|
||||
- do something with the 'split' tag on split word arrays
|
||||
- add more optimizations in IRPeepholeOptimizer
|
||||
- reduce register usage via linear-scan algorithm (based on live intervals) https://anoopsarkar.github.io/compilers-class/assets/lectures/opt3-regalloc-linearscan.pdf
|
||||
don't forget to take into account the data type of the register when it's going to be reused!
|
||||
- idea: (but LLVM IR simply keeps the variables, so not a good idea then?...): replace all scalar variables by an allocated register. Keep a table of the variable to register mapping (including the datatype)
|
||||
global initialization values are simply a list of LOAD instructions.
|
||||
Variables replaced include all subroutine parameters! So the only variables that remain as variables are arrays and strings.
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
cx16.r0 = &txt.print ; IR: this is ok
|
||||
uword[] @shared vectors = [ &txt.print ] ; IR: ERROR no chunk with label txt.print
|
||||
cx16.r0 = foo()
|
||||
}
|
||||
|
||||
extsub $f000 = foo() clobbers(X) -> uword @AY
|
||||
}
|
||||
|
@ -895,7 +895,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[reg1]
|
||||
if (existingType!=null) {
|
||||
if (existingType != actualtype)
|
||||
throw IllegalArgumentException("register $reg1 assigned multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register $reg1 given multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[reg1] = actualtype
|
||||
}
|
||||
@ -907,7 +907,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[reg1]
|
||||
if (existingType!=null) {
|
||||
if (existingType != actualtype)
|
||||
throw IllegalArgumentException("register $reg1 assigned multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register $reg1 given multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[reg1] = actualtype
|
||||
|
||||
@ -921,7 +921,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[reg1]
|
||||
if (existingType!=null) {
|
||||
if (existingType != actualtype)
|
||||
throw IllegalArgumentException("register $reg1 assigned multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register $reg1 given multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[reg1] = actualtype
|
||||
|
||||
@ -937,7 +937,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[reg2]
|
||||
if (existingType!=null) {
|
||||
if (existingType != actualtype)
|
||||
throw IllegalArgumentException("register $reg2 assigned multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register $reg2 given multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[reg2] = actualtype
|
||||
}
|
||||
@ -953,7 +953,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[reg3]
|
||||
if (existingType!=null) {
|
||||
if (existingType != actualtype)
|
||||
throw IllegalArgumentException("register $reg3 assigned multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register $reg3 given multiple types! $existingType and $actualtype in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[reg3] = actualtype
|
||||
}
|
||||
@ -986,7 +986,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[it.registerNum]
|
||||
if (existingType!=null) {
|
||||
if (existingType != it.dt)
|
||||
throw IllegalArgumentException("register ${it.registerNum} assigned multiple types! $existingType and ${it.dt} in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register ${it.registerNum} given multiple types! $existingType and ${it.dt} in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[it.registerNum] = it.dt
|
||||
}
|
||||
@ -999,7 +999,7 @@ data class IRInstruction(
|
||||
val existingType = regsTypes[it.reg.registerNum]
|
||||
if (existingType!=null) {
|
||||
if (existingType != it.reg.dt)
|
||||
throw IllegalArgumentException("register ${it.reg.registerNum} assigned multiple types! $existingType and ${it.reg.dt} in label ${chunk?.label} chunk $chunk")
|
||||
throw IllegalArgumentException("register ${it.reg.registerNum} given multiple types! $existingType and ${it.reg.dt} in label ${chunk?.label} chunk $chunk")
|
||||
} else
|
||||
regsTypes[it.reg.registerNum] = it.reg.dt
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ class IRProgram(val name: String,
|
||||
val existingType = regsTypes[reg]
|
||||
if (existingType!=null) {
|
||||
if (existingType != type)
|
||||
throw IllegalArgumentException("register $reg assigned multiple types! $existingType and $type ${this.name}<--${child.label ?: child}")
|
||||
throw IllegalArgumentException("register $reg given multiple types! $existingType and $type ${this.name}<--${child.label ?: child}")
|
||||
} else
|
||||
regsTypes[reg] = type
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user