#ifndef _REG_H_ #define _REG_H_ /* * file reg.h */ typedef enum { reg_bad_type, reg_real, // a real register reg_virtual // a virtual register } reg_kind; typedef enum { r0=0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, r30, r31, bad_rreg } real_reg_num; class registor { private: unsigned short int vreg : 16; reg_kind kind : 8; real_reg_num rreg : 8; public: registor(void) { vreg = 0; kind = reg_bad_type; rreg = bad_rreg; } void set_vreg( unsigned short int v ) { vreg = v; } void set_rreg( real_reg_num r ) { rreg = r; } unsigned short int get_vreg(void) { return vreg; } real_reg_num get_rreg(void) { return (real_reg_num)rreg; } reg_kind get_reg_kind(void) { return kind; } }; // registor #endif
back to Polymorphic Types in C++