1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef REGISTER_H 6#define REGISTER_H 7 8 9#include <SupportDefs.h> 10 11 12enum register_format { 13 REGISTER_FORMAT_INTEGER, 14 REGISTER_FORMAT_FLOAT 15}; 16 17enum register_type { 18 REGISTER_TYPE_INSTRUCTION_POINTER, 19 REGISTER_TYPE_STACK_POINTER, 20 REGISTER_TYPE_RETURN_ADDRESS, 21 REGISTER_TYPE_GENERAL_PURPOSE, 22 REGISTER_TYPE_SPECIAL_PURPOSE, 23 REGISTER_TYPE_EXTENDED 24}; 25 26 27class Register { 28public: 29 Register(int32 index, const char* name, 30 uint32 bitSize, uint32 valueType, 31 register_type type, bool calleePreserved); 32 // name will not be cloned 33 Register(const Register& other); 34 35 int32 Index() const { return fIndex; } 36 const char* Name() const { return fName; } 37 uint32 ValueType() const { return fValueType; } 38 register_format Format() const { return fFormat; } 39 uint32 BitSize() const { return fBitSize; } 40 register_type Type() const { return fType; } 41 bool IsCalleePreserved() const 42 { return fCalleePreserved; } 43 44private: 45 int32 fIndex; 46 const char* fName; 47 uint32 fBitSize; 48 uint32 fValueType; 49 register_format fFormat; 50 register_type fType; 51 bool fCalleePreserved; 52 53}; 54 55 56#endif // REGISTER_H 57