summaryrefslogtreecommitdiff
path: root/includes/compiler/PCode.h
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-11 22:29:53 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-11 22:29:53 +0000
commit0bec4f557a96e1a40437cf5af20cc78a5eec8a63 (patch)
treec1e05ec804c43aa5a8f5f21b0ed02d0587d29563 /includes/compiler/PCode.h
parentaec1b8dddc68ecb8288ec6132932e4c7b4bca09f (diff)
downloadMWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.tar.gz
MWCC-0bec4f557a96e1a40437cf5af20cc78a5eec8a63.zip
getting closer
Diffstat (limited to 'includes/compiler/PCode.h')
-rw-r--r--includes/compiler/PCode.h62
1 files changed, 27 insertions, 35 deletions
diff --git a/includes/compiler/PCode.h b/includes/compiler/PCode.h
index 9b6103b..97f652d 100644
--- a/includes/compiler/PCode.h
+++ b/includes/compiler/PCode.h
@@ -8,11 +8,11 @@
#pragma options align=mac68k
#endif
-#define FLAG_SET_T(flags) (((flags) & (fPCodeFlag1 | fPCodeFlag8)) ? (flags) : 0)
-#define FLAG_SET_F(flags) (((flags) & (fPCodeFlag1 | fPCodeFlag8)) ? 0 : (flags))
+#define FLAG_SET_T(flags) (((flags) & (fIsBranch | fIsCall)) ? (flags) : 0)
+#define FLAG_SET_F(flags) (((flags) & (fIsBranch | fIsCall)) ? 0 : (flags))
-#define PCODE_FLAG_SET_T(pcode) (((pcode)->flags & (fPCodeFlag1 | fPCodeFlag8)) ? (pcode)->flags : 0)
-#define PCODE_FLAG_SET_F(pcode) (((pcode)->flags & (fPCodeFlag1 | fPCodeFlag8)) ? 0 : (pcode)->flags)
+#define PCODE_FLAG_SET_T(pcode) (((pcode)->flags & (fIsBranch | fIsCall)) ? (pcode)->flags : 0)
+#define PCODE_FLAG_SET_F(pcode) (((pcode)->flags & (fIsBranch | fIsCall)) ? 0 : (pcode)->flags)
enum {
EffectRead = 1,
@@ -22,16 +22,6 @@ enum {
Effect40 = 0x40 // spilled register?
};
-/*typedef enum {
- PCOp_REGISTER,
- PCOp_SYSREG,
- PCOp_IMMEDIATE,
- PCOp_MEMORY,
- PCOp_LABEL,
- PCOp_LABELDIFF,
- PCOp_PLACEHOLDEROPERAND
-} PCOpKind;*/
-
typedef enum {
RefType_0,
RefType_1, // like D, but 32-bit?
@@ -158,12 +148,11 @@ struct PCodeBlock {
/* PCode Flags */
enum {
- fPCodeFlag1 = 1, // some kinds of branches
- fPCodeFlag2 = 2, // read from memory
- fPCodeFlag4 = 4, // write to memory
- fPCodeFlag8 = 8, // other kinds of branches
- fPCodeFlag10 = 0x10, // moves
- fPCodeFlag20 = 0x20, // indexed operations
+ fIsBranch = 1,
+ fIsRead = 2, // read from memory
+ fIsWrite = 4, // write to memory
+ fIsCall = 8,
+ fIsMove = 0x10, // moves register (mcrf, mr, fmr, vmr, vmrp)
// Always valid
fIsConst = 0x40,
fIsVolatile = 0x80,
@@ -174,36 +163,39 @@ enum {
fPCodeFlag1000 = 0x1000, // ?
fCommutative = 0x2000,
fIsCSE = 0x4000,
- fPCodeFlag8000 = 0x8000,
+ fIsArgInit = 0x8000, // instruction that stores varargs from GPRs to the stack
fPCodeFlag20000 = 0x20000, // some kinda load?
fPCodeFlag40000 = 0x40000, // some kinda store?
// Set 1 (branches) only
fLink = 0x1000000,
+ fCanLink = 0x2000000, // is capable of being a link branch
fBranchNotTaken = 0x4000000,
fBranchTaken = 0x8000000,
fAbsolute = 0x10000000,
+ fCanBeAbsolute = 0x20000000, // is capable of having fAbsolute set
// Set 2 (non-branches) only
fIsPtrOp = 0x20,
+ fPCodeFlag200000 = 0x200000,
+ fPCodeFlag400000 = 0x400000,
fOverflow = 0x800000,
+ fUpdatesPtr = 0x2000000, // lbzu, lbzux, lwzu, stbu, stbux, etc
+ fCanSetCarry = 0x4000000, // is capable of having fSetsCarry set
+ fCanSetRecordBit = 0x8000000, // is capable of having fRecordBit set
fSetsCarry = 0x10000000,
- fPCodeFlag20000000 = 0x20000000, // record bit?
- // ??
- fPCodeFlag2000000 = 0x2000000,
- fPCodeFlag4000000 = 0x4000000,
- fPCodeFlag8000000 = 0x8000000,
- fPCodeFlag10000000 = 0x10000000,
- fPCodeFlag40000000 = 0x40000000,
- fPCodeFlag80000000 = 0x80000000,
- fPCodeFlagC0000000 = 0xC0000000
+ fRecordBit = 0x20000000,
+ fOpTypeFPR = 0x40000000,
+ fOpTypeGPR = 0x80000000,
+ fOpTypeVR = 0xC0000000,
+ fOpTypeMask = 0xC0000000
};
enum {
- fPCBlockFlag1 = 1, // fIsProlog
- fPCBlockFlag2 = 2, // fIsEpilogue
- fPCBlockFlag4 = 4, // fVisited
- fPCBlockFlag8 = 8, // fScheduled
+ fIsProlog = 1, // fIsProlog
+ fIsEpilogue = 2, // fIsEpilogue
+ fVisited = 4, // fVisited
+ fScheduled = 8, // fScheduled
fPCBlockFlag10 = 0x10, // maybe fIsSwitch based off v3?
- fPCBlockFlag20 = 0x20, // fDeleted
+ fDeleted = 0x20,
fPCBlockFlag2000 = 0x2000,
fPCBlockFlag4000 = 0x4000,
fPCBlockFlag6000 = 0x6000,