diff options
Diffstat (limited to 'includes/compiler/PCode.h')
-rw-r--r-- | includes/compiler/PCode.h | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/includes/compiler/PCode.h b/includes/compiler/PCode.h index b56ed2f..cebab6f 100644 --- a/includes/compiler/PCode.h +++ b/includes/compiler/PCode.h @@ -16,7 +16,10 @@ enum { EffectRead = 1, - EffectWrite = 2 + EffectWrite = 2, + Effect4 = 4, + Effect8 = 8, + Effect40 = 0x40 // spilled register? }; /*typedef enum { @@ -48,7 +51,7 @@ typedef enum { struct PCodeArg { PCOpKind kind; - char arg; + unsigned char arg; union { struct { unsigned short effect; @@ -74,14 +77,46 @@ struct PCodeArg { } data; }; +#define PC_OP_IS_REGISTER(_op, _rclass, _reg) \ +((_op)->kind == PCOp_REGISTER && \ + (char) (_op)->arg == (_rclass) && \ + (_op)->data.reg.reg == (_reg)) + +#define PC_OP_IS_READ_REGISTER(_op, _rclass, _reg) \ +((_op)->kind == PCOp_REGISTER && \ + (char) (_op)->arg == (_rclass) && \ + (_op)->data.reg.reg == (_reg) && \ + ((_op)->data.reg.effect & EffectRead)) + +#define PC_OP_IS_WRITE_REGISTER(_op, _rclass, _reg) \ +((_op)->kind == PCOp_REGISTER && \ + (char) (_op)->arg == (_rclass) && \ + (_op)->data.reg.reg == (_reg) && \ + ((_op)->data.reg.effect & EffectWrite)) + +#define PC_OP_IS_ANY_REGISTER(_op, _rclass) \ +((_op)->kind == PCOp_REGISTER && \ + (char) (_op)->arg == (_rclass)) + +#define PC_OP_IS_READ_ANY_REGISTER(_op, _rclass) \ +((_op)->kind == PCOp_REGISTER && \ + (char) (_op)->arg == (_rclass) && \ + ((_op)->data.reg.effect & EffectRead)) + +#define PC_OP_IS_WRITE_ANY_REGISTER(_op, _rclass) \ +((_op)->kind == PCOp_REGISTER && \ + (char) (_op)->arg == (_rclass) && \ + ((_op)->data.reg.effect & EffectWrite)) + + struct PCode { PCode *nextPCode; PCode *prevPCode; PCodeBlock *block; - unsigned int xx_C; - unsigned int _10; - int flags; - void *_18; + int useID; + int defID; + UInt32 flags; + struct Alias *alias; SInt32 sourceoffset; short op; short argCount; @@ -92,7 +127,7 @@ struct PCodeLabel { PCodeLabel *nextLabel; PCodeBlock *block; short resolved; - short index; + unsigned short index; }; typedef struct _PCLink { @@ -118,8 +153,8 @@ struct PCodeBlock { /* PCode Flags */ enum { fPCodeFlag1 = 1, - fPCodeFlag2 = 2, - fPCodeFlag4 = 4, + fPCodeFlag2 = 2, // some kinda load + fPCodeFlag4 = 4, // some kinda store fPCodeFlag8 = 8, fPCodeFlag10 = 0x10, fPCodeFlag20 = 0x20, @@ -134,8 +169,8 @@ enum { fCommutative = 0x2000, fIsCSE = 0x4000, fPCodeFlag8000 = 0x8000, - fPCodeFlag20000 = 0x20000, // ? - fPCodeFlag40000 = 0x40000, // ? + fPCodeFlag20000 = 0x20000, // some kinda load? + fPCodeFlag40000 = 0x40000, // some kinda store? // Set 1 only fLink = 0x1000000, fBranchNotTaken = 0x4000000, @@ -150,7 +185,7 @@ enum { fPCodeFlag4000000 = 0x4000000, fPCodeFlag8000000 = 0x8000000, fPCodeFlag10000000 = 0x10000000, - fPCodeFlag20000000 = 0x20000000, + fPCodeFlag20000000 = 0x20000000, // record bit? fPCodeFlag40000000 = 0x40000000, fPCodeFlag80000000 = 0x80000000 }; @@ -159,9 +194,10 @@ enum { fPCBlockFlag1 = 1, // prologue fPCBlockFlag2 = 2, // epilogue fPCBlockFlag4 = 4, - fPCBlockFlag8 = 8, + fPCBlockFlag8 = 8, // scheduled? fPCBlockFlag10 = 0x10, fPCBlockFlag20 = 0x20, + fPCBlockFlag2000 = 0x2000, fPCBlockFlag4000 = 0x4000 }; |