Skip to content

Commit

Permalink
[WIP] Implement live variable analysis
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Laszlo Kulcsar <kuladam@inf.u-szeged.hu>
  • Loading branch information
kulcsaradam committed May 7, 2024
1 parent dea5797 commit c062e79
Show file tree
Hide file tree
Showing 9 changed files with 1,907 additions and 356 deletions.
31 changes: 31 additions & 0 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
live_analysis

get-ből való kiindulás azért jobb mert valaminek be kell állítania az értékét

egy adott getből keresem vissza hogy milyen utakon lehet visszamenni az őt beállító utasításokig
multimap jó

listákban tartom az összes változóra a set-jeit és a get-jeit

jump + sets [T,p]
T - target, ahova ugrunk
p - position, ahonnan ugrottunk
+ listában a set-ek amelyek abban a blokban vannak

dump!!! - variableRange

[] hátra
() előre

s g
s ( g )

s [ ( g ) ]

[ (s ) g ]

[ s [ g ] g ] ( g )



s [ g ][ s g ]
30 changes: 30 additions & 0 deletions src/interpreter/ByteCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ class BinaryOperation : public ByteCode {
const ByteCodeStackOffset* srcOffset() const { return m_srcOffset; }
ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset o) { m_dstOffset = o; }
void setSrcOffset(ByteCodeStackOffset o, size_t index) { m_srcOffset[index] = o; }
#if !defined(NDEBUG)
void dump(size_t pos)
{
Expand Down Expand Up @@ -707,6 +708,14 @@ class UnaryOperation : public ByteCode {
}
ByteCodeStackOffset srcOffset() const { return m_srcOffset; }
ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset newOffset)
{
m_dstOffset = newOffset;
}
void setSrcOffset(ByteCodeStackOffset newOffset)
{
m_srcOffset = newOffset;
}
#if !defined(NDEBUG)
void dump(size_t pos)
{
Expand Down Expand Up @@ -876,6 +885,14 @@ class Move : public ByteCode {

ByteCodeStackOffset srcOffset() const { return m_srcOffset; }
ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset newOffset)
{
m_dstOffset = newOffset;
}
void setSrcOffset(ByteCodeStackOffset newOffset)
{
m_srcOffset = newOffset;
}

protected:
ByteCodeStackOffset m_srcOffset;
Expand Down Expand Up @@ -977,7 +994,9 @@ class Load32 : public ByteCode {
}

ByteCodeStackOffset srcOffset() const { return m_srcOffset; }
void setSrcOffset(ByteCodeStackOffset o) { m_srcOffset = o; }
ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset o) { m_dstOffset = o; }

#if !defined(NDEBUG)
void dump(size_t pos)
Expand Down Expand Up @@ -1029,7 +1048,9 @@ class Store32 : public ByteCode {
}

ByteCodeStackOffset src0Offset() const { return m_src0Offset; }
void setSrc0Offset(ByteCodeStackOffset o) { m_src0Offset = o; }
ByteCodeStackOffset src1Offset() const { return m_src1Offset; }
void setSrc1Offset(ByteCodeStackOffset o) { m_src1Offset = o; }

#if !defined(NDEBUG)
void dump(size_t pos)
Expand Down Expand Up @@ -1170,11 +1191,15 @@ class Select : public ByteCode {
}

ByteCodeStackOffset condOffset() const { return m_condOffset; }
void setCondOffset(ByteCodeStackOffset o) { m_condOffset = o; }
uint16_t valueSize() const { return m_valueSize; }
bool isFloat() const { return m_isFloat != 0; }
ByteCodeStackOffset src0Offset() const { return m_src0Offset; }
void setSrc0Offset(ByteCodeStackOffset o) { m_src0Offset = o; }
ByteCodeStackOffset src1Offset() const { return m_src1Offset; }
void setSrc1Offset(ByteCodeStackOffset o) { m_src1Offset = o; }
ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset o) { m_dstOffset = o; }

#if !defined(NDEBUG)
void dump(size_t pos)
Expand Down Expand Up @@ -1414,7 +1439,9 @@ class MemoryLoad : public ByteCode {

uint32_t offset() const { return m_offset; }
ByteCodeStackOffset srcOffset() const { return m_srcOffset; }
void setSrcOffset(ByteCodeStackOffset o) { m_srcOffset = o; }
ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset o) { m_dstOffset = o; }

#if !defined(NDEBUG)
void dump(size_t pos)
Expand Down Expand Up @@ -1512,7 +1539,9 @@ class MemoryStore : public ByteCode {

uint32_t offset() const { return m_offset; }
ByteCodeStackOffset src0Offset() const { return m_src0Offset; }
void setSrc0Offset(ByteCodeStackOffset o) { m_src0Offset = o; }
ByteCodeStackOffset src1Offset() const { return m_src1Offset; }
void setSrc1Offset(ByteCodeStackOffset o) { m_src1Offset = o; }

#if !defined(NDEBUG)
void dump(size_t pos)
Expand Down Expand Up @@ -2063,6 +2092,7 @@ class GlobalGet32 : public ByteCode {
}

ByteCodeStackOffset dstOffset() const { return m_dstOffset; }
void setDstOffset(ByteCodeStackOffset o) { m_dstOffset = o; }
uint32_t index() const { return m_index; }

#if !defined(NDEBUG)
Expand Down
Loading

0 comments on commit c062e79

Please sign in to comment.