#pragma once typedef struct _PCodeArg { unsigned int _0; unsigned int _4; unsigned int _8; } PCodeArg; typedef struct _PCode { struct _PCode *nextPCode; struct _PCode *prevPCode; struct _PCBlock *block; unsigned int xx_C; unsigned int _10; int flags; unsigned int _18; unsigned int _1C; short op; short argCount; PCodeArg args[0]; } PCode; typedef struct _PCLabel { struct _PCLabel *nextLabel; struct _PCBlock *block; short resolved; short index; } PCLabel; typedef struct _PCLink { struct _PCLink *nextLink; struct _PCBlock *block; } PCLink; typedef struct _PCBlock { struct _PCBlock *nextBlock; struct _PCBlock *prevBlock; PCLabel *labels; PCLink *predecessors; PCLink *successors; PCode *firstPCode; PCode *lastPCode; int blockIndex; int codeOffset; // in bytes int loopWeight; short pcodeCount; unsigned short flags; } PCBlock; /* PCode Flags */ enum { fPCodeFlag1 = 1, fPCodeFlag2 = 2, fPCodeFlag4 = 4, fPCodeFlag8 = 8, fPCodeFlag10 = 0x10, fIsPtrOp = 0x20, fIsConst = 0x40, fIsVolatile = 0x80, fSideEffects = 0x100, fPCodeFlag200 = 0x200, fPCodeFlag400 = 0x400, fPCodeFlag800 = 0x800, fPCodeFlag1000 = 0x1000, fCommutative = 0x2000, fIsCSE = 0x4000, fOverflow = 0x800000, fLink = 0x1000000, fBranchNotTaken = 0x4000000, fBranchTaken = 0x8000000, fAbsolute = 0x10000000, fSetsCarry = 0x10000000, }; enum { fPCBlockFlag1 = 1, fPCBlockFlag2 = 2, fPCBlockFlag4 = 4, fPCBlockFlag8 = 8, fPCBlockFlag10 = 0x10, fPCBlockFlag20 = 0x20 }; extern PCBlock *pcbasicblocks; extern PCBlock *pclastblock; extern void *prologue; extern void *epilogue; extern PCBlock **depthfirstordering; extern int pcblockcount; extern int pcloopweight; extern void initpcode(); extern PCode *makepcode(short op, ...); extern void emitpcode(short op, ...); extern PCode *copypcode(PCode *pcode); extern PCLabel *makepclabel(); extern PCBlock *makepcblock(); extern void pclabel(PCBlock *block, PCLabel *label); extern void pcbranch(PCBlock *block, PCLabel *label); extern void pccomputepredecessors(); extern void deleteblock(PCBlock *block); extern void deleteunreachableblocks(); extern void appendpcode(PCBlock *block, PCode *pcode); extern void deletepcode(PCode *pcode); extern void insertpcodebefore(PCode *anchor, PCode *newpcode); extern void insertpcodeafter(PCode *anchor, PCode *newpcode); extern void setpcodeflags(int flags); extern void clearpcodeflags(int flags); extern int pccomputeoffsets(); extern void computedepthfirstordering();