3
0
Fork 0
forked from suyu/suyu

Rename ARCHITECTURE_X64 definition to ARCHITECTURE_x86_64.

This commit is contained in:
bunnei 2015-08-14 22:29:08 -04:00
parent 0ee00861f6
commit b39c053785
11 changed files with 34 additions and 34 deletions

View file

@ -10,9 +10,21 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks) DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks)
endif() endif()
# Platform-agnostic definition to check if we are on x86_64
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "[xX]86_64" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "[aA][mM][dD]64")
set(ARCHITECTURE_x86_64 1)
add_definitions(-DARCHITECTURE_x86_64=1)
endif()
if (NOT MSVC) if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread -msse4.2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -msse4.2") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
if (ARCHITECTURE_x86_64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
endif()
else() else()
# Silence "deprecation" warnings # Silence "deprecation" warnings
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE) add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE)
@ -51,17 +63,6 @@ else()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
endif() endif()
# Platform-agnostic definition to check if we are on x86_64
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "[aA][mM][dD]64" OR
APPLE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE_X64 1)
add_definitions(-DARCHITECTURE_X64=1)
endif()
endif()
add_definitions(-DSINGLETHREADED) add_definitions(-DSINGLETHREADED)
# CMake seems to only define _DEBUG on Windows # CMake seems to only define _DEBUG on Windows
set_property(DIRECTORY APPEND PROPERTY set_property(DIRECTORY APPEND PROPERTY

View file

@ -58,7 +58,7 @@ set(HEADERS
vector_math.h vector_math.h
) )
if(ARCHITECTURE_X64) if(ARCHITECTURE_x86_64)
set(SRCS ${SRCS} set(SRCS ${SRCS}
x64/abi.cpp x64/abi.cpp
x64/cpu_detect.cpp x64/cpu_detect.cpp

View file

@ -35,7 +35,7 @@
#ifndef _MSC_VER #ifndef _MSC_VER
#if defined(__x86_64__) || defined(ARCHITECTURE_X64) #ifdef ARCHITECTURE_x86_64
#define Crash() __asm__ __volatile__("int $3") #define Crash() __asm__ __volatile__("int $3")
#elif defined(_M_ARM) #elif defined(_M_ARM)
#define Crash() __asm__ __volatile__("trap") #define Crash() __asm__ __volatile__("trap")

View file

@ -16,7 +16,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT)
#include <unistd.h> #include <unistd.h>
#define PAGE_MASK (getpagesize() - 1) #define PAGE_MASK (getpagesize() - 1)
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
@ -31,7 +31,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else #else
static char *map_hint = 0; static char *map_hint = 0;
#if defined(__x86_64__) && !defined(MAP_32BIT) #if defined(ARCHITECTURE_X64) && !defined(MAP_32BIT)
// This OS has no flag to enforce allocation below the 4 GB boundary, // This OS has no flag to enforce allocation below the 4 GB boundary,
// but if we hint that we want a low address it is very likely we will // but if we hint that we want a low address it is very likely we will
// get one. // get one.
@ -43,7 +43,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif #endif
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE MAP_ANON | MAP_PRIVATE
#if defined(__x86_64__) && defined(MAP_32BIT) #if defined(ARCHITECTURE_X64) && defined(MAP_32BIT)
| (low ? MAP_32BIT : 0) | (low ? MAP_32BIT : 0)
#endif #endif
, -1, 0); , -1, 0);
@ -62,7 +62,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif #endif
LOG_ERROR(Common_Memory, "Failed to allocate executable memory"); LOG_ERROR(Common_Memory, "Failed to allocate executable memory");
} }
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT)
else else
{ {
if (low) if (low)

View file

@ -27,7 +27,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Platform detection // Platform detection
#if defined(__x86_64__) || defined(ARCHITECTURE_X64) || defined(__aarch64__) #if defined(ARCHITECTURE_x86_64) || defined(__aarch64__)
#define EMU_ARCH_BITS 64 #define EMU_ARCH_BITS 64
#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) #elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
#define EMU_ARCH_BITS 32 #define EMU_ARCH_BITS 32

View file

@ -27,7 +27,7 @@ void XEmitter::ABI_EmitPrologue(int maxCallParams)
{ {
#ifdef _M_IX86 #ifdef _M_IX86
// Don't really need to do anything // Don't really need to do anything
#elif defined(ARCHITECTURE_X64) #elif defined(ARCHITECTURE_x86_64)
#if _WIN32 #if _WIN32
int stacksize = ((maxCallParams + 1) & ~1) * 8 + 8; int stacksize = ((maxCallParams + 1) & ~1) * 8 + 8;
// Set up a stack frame so that we can call functions // Set up a stack frame so that we can call functions
@ -43,7 +43,7 @@ void XEmitter::ABI_EmitEpilogue(int maxCallParams)
{ {
#ifdef _M_IX86 #ifdef _M_IX86
RET(); RET();
#elif defined(ARCHITECTURE_X64) #elif defined(ARCHITECTURE_x86_64)
#ifdef _WIN32 #ifdef _WIN32
int stacksize = ((maxCallParams+1)&~1)*8 + 8; int stacksize = ((maxCallParams+1)&~1)*8 + 8;
ADD(64, R(RSP), Imm8(stacksize)); ADD(64, R(RSP), Imm8(stacksize));

View file

@ -55,7 +55,7 @@
// 32-bit bog standard cdecl, shared between linux and windows // 32-bit bog standard cdecl, shared between linux and windows
// MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about. // MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about.
#elif ARCHITECTURE_X64 // 64 bit calling convention #elif ARCHITECTURE_x86_64 // 64 bit calling convention
#ifdef _WIN32 // 64-bit Windows - the really exotic calling convention #ifdef _WIN32 // 64-bit Windows - the really exotic calling convention

View file

@ -164,7 +164,7 @@ void XEmitter::WriteSIB(int scale, int index, int base)
void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const
{ {
if (customOp == -1) customOp = operandReg; if (customOp == -1) customOp = operandReg;
#ifdef ARCHITECTURE_X64 #ifdef ARCHITECTURE_x86_64
u8 op = 0x40; u8 op = 0x40;
// REX.W (whether operation is a 64-bit operation) // REX.W (whether operation is a 64-bit operation)
if (opBits == 64) op |= 8; if (opBits == 64) op |= 8;
@ -236,7 +236,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
_offsetOrBaseReg = 5; _offsetOrBaseReg = 5;
emit->WriteModRM(0, _operandReg, _offsetOrBaseReg); emit->WriteModRM(0, _operandReg, _offsetOrBaseReg);
//TODO : add some checks //TODO : add some checks
#ifdef ARCHITECTURE_X64 #ifdef ARCHITECTURE_x86_64
u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes; u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes;
s64 distance = (s64)offset - (s64)ripAddr; s64 distance = (s64)offset - (s64)ripAddr;
ASSERT_MSG( ASSERT_MSG(
@ -1463,7 +1463,7 @@ void XEmitter::MOVD_xmm(const OpArg &arg, X64Reg src) {WriteSSEOp(0x66, 0x7E, sr
void XEmitter::MOVQ_xmm(X64Reg dest, OpArg arg) void XEmitter::MOVQ_xmm(X64Reg dest, OpArg arg)
{ {
#ifdef ARCHITECTURE_X64 #ifdef ARCHITECTURE_x86_64
// Alternate encoding // Alternate encoding
// This does not display correctly in MSVC's debugger, it thinks it's a MOVD // This does not display correctly in MSVC's debugger, it thinks it's a MOVD
arg.operandReg = dest; arg.operandReg = dest;

View file

@ -21,7 +21,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/code_block.h" #include "common/code_block.h"
#if defined(ARCHITECTURE_X64) && !defined(_ARCH_64) #if defined(ARCHITECTURE_x86_64) && !defined(_ARCH_64)
#define _ARCH_64 #define _ARCH_64
#endif #endif

View file

@ -42,7 +42,7 @@ set(HEADERS
video_core.h video_core.h
) )
if(ARCHITECTURE_X64) if(ARCHITECTURE_x86_64)
set(SRCS ${SRCS} set(SRCS ${SRCS}
shader/shader_jit_x64.cpp) shader/shader_jit_x64.cpp)

View file

@ -16,20 +16,18 @@
#include "shader.h" #include "shader.h"
#include "shader_interpreter.h" #include "shader_interpreter.h"
#ifdef ARCHITECTURE_X64 #ifdef ARCHITECTURE_x86_64
#include "shader_jit_x64.h" #include "shader_jit_x64.h"
#endif // ARCHITECTURE_X64 #endif // ARCHITECTURE_x86_64
namespace Pica { namespace Pica {
namespace Shader { namespace Shader {
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64
static std::unordered_map<u64, CompiledShader*> shader_map; static std::unordered_map<u64, CompiledShader*> shader_map;
static JitCompiler jit; static JitCompiler jit;
static CompiledShader* jit_shader; static CompiledShader* jit_shader;
#endif // ARCHITECTURE_x86_64 #endif // ARCHITECTURE_x86_64
void Setup(UnitState& state) { void Setup(UnitState& state) {
@ -46,7 +44,8 @@ void Setup(UnitState& state) {
jit_shader = jit.Compile(); jit_shader = jit.Compile();
shader_map.emplace(cache_key, jit_shader); shader_map.emplace(cache_key, jit_shader);
} }
#endif // ARCHITECTURE_X64 }
#endif // ARCHITECTURE_x86_64
} }
void Shutdown() { void Shutdown() {
@ -95,7 +94,7 @@ OutputVertex Run(UnitState& state, const InputVertex& input, int num_attributes)
RunInterpreter(state); RunInterpreter(state);
#else #else
RunInterpreter(state); RunInterpreter(state);
#endif // ARCHITECTURE_X64 #endif // ARCHITECTURE_x86_64
#if PICA_DUMP_SHADERS #if PICA_DUMP_SHADERS
DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(), DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(),