MachineInfo

This commit is contained in:
Ben Vanik 2014-02-08 22:00:21 -08:00
parent ee69696485
commit 2403f367b1
6 changed files with 72 additions and 0 deletions

View File

@ -18,6 +18,7 @@ using namespace alloy::runtime;
Backend::Backend(Runtime* runtime) :
runtime_(runtime) {
xe_zero_struct(&machine_info_, sizeof(machine_info_));
}
Backend::~Backend() {

View File

@ -11,6 +11,7 @@
#define ALLOY_BACKEND_BACKEND_H_
#include <alloy/core.h>
#include <alloy/backend/machine_info.h>
namespace alloy { namespace runtime { class Runtime; } }
@ -27,6 +28,7 @@ public:
virtual ~Backend();
runtime::Runtime* runtime() const { return runtime_; }
const MachineInfo* machine_info() const { return &machine_info_; }
virtual int Initialize();
@ -37,6 +39,7 @@ public:
protected:
runtime::Runtime* runtime_;
MachineInfo machine_info_;
};

View File

@ -34,6 +34,20 @@ int IVMBackend::Initialize() {
return result;
}
machine_info_.register_sets[0] = {
0,
"gpr",
MachineInfo::RegisterSet::INT_TYPES,
10,
};
machine_info_.register_sets[1] = {
1,
"vec",
MachineInfo::RegisterSet::FLOAT_TYPES |
MachineInfo::RegisterSet::VEC_TYPES,
10,
};
alloy::tracing::WriteEvent(EventType::Init({
}));

View File

@ -0,0 +1,39 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef ALLOY_BACKEND_MACHINE_INFO_H_
#define ALLOY_BACKEND_MACHINE_INFO_H_
#include <alloy/core.h>
namespace alloy {
namespace backend {
struct MachineInfo {
struct RegisterSet {
enum Types {
INT_TYPES = (1 << 1),
FLOAT_TYPES = (1 << 2),
VEC_TYPES = (1 << 3),
};
uint8_t id;
char name[4];
uint32_t types;
uint32_t count;
} register_sets[8];
};
} // namespace backend
} // namespace alloy
#endif // ALLOY_BACKEND_MACHINE_INFO_H_

View File

@ -5,6 +5,7 @@
'assembler.h',
'backend.cc',
'backend.h',
'machine_info.h',
'tracing.h',
],

View File

@ -41,6 +41,20 @@ int X64Backend::Initialize() {
return result;
}
machine_info_.register_sets[0] = {
0,
"gpr",
MachineInfo::RegisterSet::INT_TYPES,
10,
};
machine_info_.register_sets[1] = {
1,
"xmm",
MachineInfo::RegisterSet::FLOAT_TYPES |
MachineInfo::RegisterSet::VEC_TYPES,
10,
};
code_cache_ = new X64CodeCache();
result = code_cache_->Initialize();
if (result) {