summaryrefslogtreecommitdiff
path: root/includes/compiler/PCode.h
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-12-29 12:32:55 +0000
committerAsh Wolf <ninji@wuffs.org>2022-12-29 12:32:55 +0000
commitfcfbafff31869ed808bff0639532db1828660e92 (patch)
tree7425b346b031c4cb47a06250b3f6f950374d44ae /includes/compiler/PCode.h
parentbc1321735c15104ffad195e1509cab5f3a044260 (diff)
downloadMWCC-fcfbafff31869ed808bff0639532db1828660e92.tar.gz
MWCC-fcfbafff31869ed808bff0639532db1828660e92.zip
dump lots more code
Diffstat (limited to '')
-rw-r--r--includes/compiler/PCode.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/includes/compiler/PCode.h b/includes/compiler/PCode.h
index f1f786c..b38d9e1 100644
--- a/includes/compiler/PCode.h
+++ b/includes/compiler/PCode.h
@@ -34,19 +34,19 @@ enum {
typedef enum {
RefType_0,
- RefType_1,
- RefType_2,
- RefType_3,
+ RefType_1, // like D, but 32-bit?
+ RefType_2, // matches MW_RELOC_3?
+ RefType_3, // matches MW_RELOC_4?
RefType_4,
RefType_5,
- RefType_6,
- RefType_7,
- RefType_8,
+ RefType_6, // LO16?
+ RefType_7, // HI16?
+ RefType_8, // HA16?
RefType_9,
- RefType_A,
- RefType_B,
- RefType_C,
- RefType_D
+ RefType_A, // another LO
+ RefType_B, // another HA
+ RefType_C, // another HA
+ RefType_D // another LO
} PCRefType;
struct PCodeArg {
@@ -94,6 +94,12 @@ struct PCodeArg {
(_op)->data.reg.reg == (_reg) && \
((_op)->data.reg.effect & EffectWrite))
+#define PC_OP_IS_R_OR_W_REGISTER(_op, _rclass, _reg) \
+((_op)->kind == PCOp_REGISTER && \
+ (_op)->arg == (_rclass) && \
+ (_op)->data.reg.reg == (_reg) && \
+ ((_op)->data.reg.effect & (EffectRead | EffectWrite)))
+
#define PC_OP_IS_ANY_REGISTER(_op, _rclass) \
((_op)->kind == PCOp_REGISTER && \
(_op)->arg == (_rclass))
@@ -152,16 +158,16 @@ struct PCodeBlock {
/* PCode Flags */
enum {
- fPCodeFlag1 = 1,
- fPCodeFlag2 = 2, // some kinda load
- fPCodeFlag4 = 4, // some kinda store
- fPCodeFlag8 = 8,
- fPCodeFlag10 = 0x10,
- fPCodeFlag20 = 0x20,
+ 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
// Always valid
fIsConst = 0x40,
fIsVolatile = 0x80,
- fSideEffects = 0x100,
+ fSideEffects = 0x100, // instructions that do weird stuff with PPC state
fPCodeFlag200 = 0x200, // ?
fPCodeFlag400 = 0x400, // ?
fPCodeFlag800 = 0x800, // ?
@@ -171,23 +177,24 @@ enum {
fPCodeFlag8000 = 0x8000,
fPCodeFlag20000 = 0x20000, // some kinda load?
fPCodeFlag40000 = 0x40000, // some kinda store?
- // Set 1 only
+ // Set 1 (branches) only
fLink = 0x1000000,
fBranchNotTaken = 0x4000000,
fBranchTaken = 0x8000000,
fAbsolute = 0x10000000,
- // Set 2 only
+ // Set 2 (non-branches) only
fIsPtrOp = 0x20,
fOverflow = 0x800000,
fSetsCarry = 0x10000000,
+ fPCodeFlag20000000 = 0x20000000, // record bit?
// ??
fPCodeFlag2000000 = 0x2000000,
fPCodeFlag4000000 = 0x4000000,
fPCodeFlag8000000 = 0x8000000,
fPCodeFlag10000000 = 0x10000000,
- fPCodeFlag20000000 = 0x20000000, // record bit?
fPCodeFlag40000000 = 0x40000000,
- fPCodeFlag80000000 = 0x80000000
+ fPCodeFlag80000000 = 0x80000000,
+ fPCodeFlagC0000000 = 0xC0000000
};
enum {
@@ -198,7 +205,9 @@ enum {
fPCBlockFlag10 = 0x10,
fPCBlockFlag20 = 0x20,
fPCBlockFlag2000 = 0x2000,
- fPCBlockFlag4000 = 0x4000
+ fPCBlockFlag4000 = 0x4000,
+ fPCBlockFlag6000 = 0x6000,
+ fPCBlockFlag8000 = 0x8000
};
extern PCodeBlock *pcbasicblocks;