summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-12-14 01:00:56 +0000
committerAsh Wolf <ninji@wuffs.org>2022-12-14 01:00:56 +0000
commitbc1321735c15104ffad195e1509cab5f3a044260 (patch)
tree8b2a54226e10e8a564a2287cd8e65b577e0fd6c2 /includes
parent25bab8b1fb2fc851ea3f1f630b3de65ca6afdc22 (diff)
downloadMWCC-bc1321735c15104ffad195e1509cab5f3a044260.tar.gz
MWCC-bc1321735c15104ffad195e1509cab5f3a044260.zip
rename some stuff and use an enum for RegClass
Diffstat (limited to 'includes')
-rw-r--r--includes/compiler/Coloring.h4
-rw-r--r--includes/compiler/InlineAsm.h2
-rw-r--r--includes/compiler/InlineAsmRegisters.h2
-rw-r--r--includes/compiler/LiveInfo.h10
-rw-r--r--includes/compiler/PCode.h14
-rw-r--r--includes/compiler/PCodeInfo.h1
-rw-r--r--includes/compiler/RegisterInfo.h14
-rw-r--r--includes/compiler/Registers.h29
-rw-r--r--includes/compiler/UseDefChains.h3
-rw-r--r--includes/compiler/common.h15
10 files changed, 42 insertions, 52 deletions
diff --git a/includes/compiler/Coloring.h b/includes/compiler/Coloring.h
index a84d5ee..c62da64 100644
--- a/includes/compiler/Coloring.h
+++ b/includes/compiler/Coloring.h
@@ -2,10 +2,8 @@
#define COMPILER_COLORING_H
#include "compiler/common.h"
-#include "compiler/Registers.h"
-//extern RegClass coloring_class;
-extern char coloring_class;
+extern RegClass coloring_class;
extern void colorinstructions(Object *proc);
diff --git a/includes/compiler/InlineAsm.h b/includes/compiler/InlineAsm.h
index b3b201b..ba92400 100644
--- a/includes/compiler/InlineAsm.h
+++ b/includes/compiler/InlineAsm.h
@@ -17,7 +17,7 @@ typedef struct IAMnemonic {
typedef struct IARegister {
char *name;
- char rclass;
+ RegClass rclass;
SInt32 num;
Object *object;
} IARegister;
diff --git a/includes/compiler/InlineAsmRegisters.h b/includes/compiler/InlineAsmRegisters.h
index 6cd8ef7..4e77f8d 100644
--- a/includes/compiler/InlineAsmRegisters.h
+++ b/includes/compiler/InlineAsmRegisters.h
@@ -5,7 +5,7 @@
#include "compiler/InlineAsm.h"
extern void InlineAsm_InitializeRegisters(void);
-extern void InlineAsm_InsertRegister(char *name, char rclass, short num, Object *object);
+extern void InlineAsm_InsertRegister(char *name, RegClass rclass, short num, Object *object);
extern IARegister *InlineAsm_LookupRegister(char *name);
#endif
diff --git a/includes/compiler/LiveInfo.h b/includes/compiler/LiveInfo.h
index 6f70c59..9d0c2f9 100644
--- a/includes/compiler/LiveInfo.h
+++ b/includes/compiler/LiveInfo.h
@@ -4,15 +4,15 @@
#include "compiler/common.h"
typedef struct LiveInfo {
- UInt32 *vec0; // use
- UInt32 *vec4; // def
- UInt32 *vec8; // in
- UInt32 *vecC; // out
+ UInt32 *use;
+ UInt32 *def;
+ UInt32 *in;
+ UInt32 *out;
} LiveInfo;
extern LiveInfo *liveinfo;
extern void computelivevariables(Object *proc);
-extern int dead(PCode *instr, char rclass, UInt32 *vec);
+extern int dead(PCode *instr, RegClass rclass, UInt32 *vec);
#endif
diff --git a/includes/compiler/PCode.h b/includes/compiler/PCode.h
index cebab6f..f1f786c 100644
--- a/includes/compiler/PCode.h
+++ b/includes/compiler/PCode.h
@@ -51,7 +51,7 @@ typedef enum {
struct PCodeArg {
PCOpKind kind;
- unsigned char arg;
+ RegClass arg;
union {
struct {
unsigned short effect;
@@ -79,33 +79,33 @@ struct PCodeArg {
#define PC_OP_IS_REGISTER(_op, _rclass, _reg) \
((_op)->kind == PCOp_REGISTER && \
- (char) (_op)->arg == (_rclass) && \
+ (_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)->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)->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))
+ (_op)->arg == (_rclass))
#define PC_OP_IS_READ_ANY_REGISTER(_op, _rclass) \
((_op)->kind == PCOp_REGISTER && \
- (char) (_op)->arg == (_rclass) && \
+ (_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)->arg == (_rclass) && \
((_op)->data.reg.effect & EffectWrite))
diff --git a/includes/compiler/PCodeInfo.h b/includes/compiler/PCodeInfo.h
index 8f81179..09b0535 100644
--- a/includes/compiler/PCodeInfo.h
+++ b/includes/compiler/PCodeInfo.h
@@ -18,6 +18,7 @@ typedef enum {
} PCOpKind;
typedef enum {
+ PCOpMemory0 = 0,
PCOpMemory1 = 1
} PCOpMemoryArg;
diff --git a/includes/compiler/RegisterInfo.h b/includes/compiler/RegisterInfo.h
index 2ef2a82..d8a263a 100644
--- a/includes/compiler/RegisterInfo.h
+++ b/includes/compiler/RegisterInfo.h
@@ -12,12 +12,12 @@ extern short _CALLER_SP_;
extern char *special_register_names[RegClassMax][RegisterMax];
extern short spr_to_sysreg[4];
-extern void asm_used_register(char rclass, short reg);
-extern void retain_register(Object *obj, char rclass, short reg);
+extern void asm_used_register(RegClass rclass, short reg);
+extern void retain_register(Object *obj, RegClass rclass, short reg);
extern void retain_GPR_pair(Object *obj, short reg, short regHi);
extern int is_register_object(Object *obj);
-extern int GetABIFirstNonVolatile(char rclass);
-extern char GetRegisterClassName(char rclass);
+extern int GetABIFirstNonVolatile(RegClass rclass);
+extern char GetRegisterClassName(RegClass rclass);
extern void setup_diagnostic_reg_strings(void);
extern void init_target_registers(void);
extern void assign_register_by_type(Object *obj);
@@ -27,9 +27,9 @@ extern void set_last_exception_registers(void);
extern VarInfo *Registers_GetVarInfo(Object *obj);
extern int used_vrstate_VRs(void);
extern UInt32 colored_vrs_as_vrsave(PCodeBlock *block);
-extern void save_before_coloring_nonvolatile_registers(char rclass);
-extern void reset_nonvolatile_registers(char rclass);
-extern int is_nonvolatile_register(char rclass, int reg);
+extern void save_before_coloring_nonvolatile_registers(RegClass rclass);
+extern void reset_nonvolatile_registers(RegClass rclass);
+extern int is_nonvolatile_register(RegClass rclass, int reg);
extern void init_endian(void);
extern void update_asm_nonvolatile_registers(void);
diff --git a/includes/compiler/Registers.h b/includes/compiler/Registers.h
index 4d02306..689e895 100644
--- a/includes/compiler/Registers.h
+++ b/includes/compiler/Registers.h
@@ -8,25 +8,6 @@ enum {
Register2 = 2,
RegisterMax = 32
};
-/*const char RegClass_SPR = 0;
-const char RegClass_CRFIELD = 1;
-const char RegClass_VR = 2;
-const char RegClass_FPR = 3;
-const char RegClass_GPR = 4;
-const char RegClassMax = 5;
-const char RegClass_6 = 6;
-const char RegClass_DCR = 7;*/
-typedef enum RegClass {
- RegClass_Invalid = -1,
- RegClass_SPR = 0,
- RegClass_CRFIELD = 1,
- RegClass_VR = 2,
- RegClass_FPR = 3,
- RegClass_GPR = 4,
- RegClassMax = 5,
- RegClass_6 = 6,
- RegClass_DCR = 7
-} RegClass;
enum {
RegState0 = 0,
@@ -51,11 +32,11 @@ extern int coloring;
extern int optimizing;
extern void init_registers(void);
-extern void assign_register_to_variable(Object *obj, char rclass);
-extern void retain_register_for_argument(Object *obj, char rclass, short reg);
-extern int available_registers(char rclass);
-extern UInt32 volatile_registers(char rclass);
-extern short obtain_nonvolatile_register(char rclass);
+extern void assign_register_to_variable(Object *obj, RegClass rclass);
+extern void retain_register_for_argument(Object *obj, RegClass rclass, short reg);
+extern int available_registers(RegClass rclass);
+extern UInt32 volatile_registers(RegClass rclass);
+extern short obtain_nonvolatile_register(RegClass rclass);
extern void open_temp_registers(void);
extern void check_temp_registers(void);
extern void close_temp_registers(void);
diff --git a/includes/compiler/UseDefChains.h b/includes/compiler/UseDefChains.h
index 6957897..365b331 100644
--- a/includes/compiler/UseDefChains.h
+++ b/includes/compiler/UseDefChains.h
@@ -2,7 +2,6 @@
#define COMPILER_USEDEFCHAINS_H
#include "compiler/common.h"
-#include "compiler/Registers.h"
#include "compiler/PCodeInfo.h"
#ifdef __MWERKS__
@@ -10,7 +9,7 @@
#endif
typedef struct TinyValue {
PCOpKind kind;
- unsigned char arg;
+ RegClass arg;
union {
short reg;
Object *object;
diff --git a/includes/compiler/common.h b/includes/compiler/common.h
index 5a1bd48..f2b2e87 100644
--- a/includes/compiler/common.h
+++ b/includes/compiler/common.h
@@ -10,8 +10,6 @@ typedef struct HashNameNode {
char name[1];
} HashNameNode;
-typedef struct CPrepFileInfo CPrepFileInfo;
-
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
@@ -118,6 +116,7 @@ typedef struct CI_FuncData CI_FuncData;
typedef struct CLabel CLabel;
typedef struct ClassList ClassList;
typedef struct CParams CParams;
+typedef struct CPrepFileInfo CPrepFileInfo;
typedef struct DeclInfo DeclInfo;
typedef struct DeclThing DeclThing; // rename me please
typedef struct DefArgCtorInfo DefArgCtorInfo;
@@ -307,6 +306,18 @@ enum {
EXPORT_FLAGS_EXPORT = 0x40
};
+typedef enum RegClass {
+ RegClass_Invalid = -1,
+ RegClass_SPR = 0,
+ RegClass_CRFIELD = 1,
+ RegClass_VR = 2,
+ RegClass_FPR = 3,
+ RegClass_GPR = 4,
+ RegClassMax = 5,
+ RegClass_6 = 6,
+ RegClass_DCR = 7
+} RegClass;
+
#ifdef __MWERKS__
#pragma options align=mac68k
#endif