Commit 6652f0b6 by Antonio Maiorano

Subzero: fix calling C functions on Windows x86

Bug: b/142132927 Change-Id: I1221f85a6a84c8ff54d900b8acb444764f18cf40 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37274Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 7fefd483
...@@ -315,9 +315,9 @@ namespace rr ...@@ -315,9 +315,9 @@ namespace rr
case R_386_32: case R_386_32:
*patchSite = (int32_t)((intptr_t)symbolValue + *patchSite); *patchSite = (int32_t)((intptr_t)symbolValue + *patchSite);
break; break;
// case R_386_PC32: case R_386_PC32:
// *patchSite = (int32_t)((intptr_t)symbolValue + *patchSite - (intptr_t)patchSite); *patchSite = (int32_t)((intptr_t)symbolValue + *patchSite - (intptr_t)patchSite);
// break; break;
default: default:
ASSERT(false && "Unsupported relocation type"); ASSERT(false && "Unsupported relocation type");
return nullptr; return nullptr;
...@@ -3487,7 +3487,14 @@ namespace rr ...@@ -3487,7 +3487,14 @@ namespace rr
RValue<Pointer<Byte>> ConstantPointer(void const * ptr) RValue<Pointer<Byte>> ConstantPointer(void const * ptr)
{ {
return RValue<Pointer<Byte>>(V(::context->getConstantInt64(reinterpret_cast<intptr_t>(ptr)))); if (sizeof(void*) == 8)
{
return RValue<Pointer<Byte>>(V(::context->getConstantInt64(reinterpret_cast<intptr_t>(ptr))));
}
else
{
return RValue<Pointer<Byte>>(V(::context->getConstantInt32(reinterpret_cast<intptr_t>(ptr))));
}
} }
Value* Call(RValue<Pointer<Byte>> fptr, Type* retTy, std::initializer_list<Value*> args, std::initializer_list<Type*> argTys) Value* Call(RValue<Pointer<Byte>> fptr, Type* retTy, std::initializer_list<Value*> args, std::initializer_list<Type*> argTys)
......
...@@ -317,6 +317,18 @@ struct TargetX8632Traits { ...@@ -317,6 +317,18 @@ struct TargetX8632Traits {
return ByteRegs[RegNum]; return ByteRegs[RegNum];
} }
static bool isXmm(RegNumT RegNum) {
static const bool IsXmm[RegisterSet::Reg_NUM] = {
#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \
isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, is16To8, \
isTrunc8Rcvr, isAhRcvr, aliases) \
isXmm,
REGX8632_TABLE
#undef X
};
return IsXmm[RegNum];
}
static XmmRegister getEncodedXmm(RegNumT RegNum) { static XmmRegister getEncodedXmm(RegNumT RegNum) {
static const XmmRegister XmmRegs[RegisterSet::Reg_NUM] = { static const XmmRegister XmmRegs[RegisterSet::Reg_NUM] = {
#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \ #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment