antimony-lang/antimony

QBE: finish arrays

YerinAlexey opened this issue · 0 comments

QBE backend already implements array initialization but can't do anything with created arrays. Array access and assignment need to be implemented.

Big issue with those is that there's no way to get array's type, which is needed to calculate offsets to elements.


A solution may be to store types together with temporaries, this way they are easy to retrieve and will help with type mismatches because now one can't use incorrect type in assign_instr.

enum QbeValue {
    Temporary(QbeType, String),
    // ...
}

Then it can be Display'd as %name but other functions will be able to access the type (for example as a key into array map). Such an array map can be a mapping of temporary -> element type and length.