Skip to content

Commit

Permalink
SPU LLVM: disable GHC CC for chunks on Windows
Browse files Browse the repository at this point in the history
Causes fatal error inside LLVM.
  • Loading branch information
Nekotekina committed May 10, 2019
1 parent 5d33d9a commit 8194c92
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rpcs3/Emu/Cell/SPURecompiler.cpp
Expand Up @@ -3075,7 +3075,9 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
result->setLinkage(llvm::GlobalValue::InternalLinkage);
result->addAttribute(1, llvm::Attribute::NoAlias);
result->addAttribute(2, llvm::Attribute::NoAlias);
#ifndef _WIN32
result->setCallingConv(llvm::CallingConv::GHC);
#endif

empl.first->second.chunk = result;

Expand All @@ -3096,7 +3098,9 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
fn->setLinkage(llvm::GlobalValue::InternalLinkage);
fn->addAttribute(1, llvm::Attribute::NoAlias);
fn->addAttribute(2, llvm::Attribute::NoAlias);
#ifndef _WIN32
fn->setCallingConv(llvm::CallingConv::GHC);
#endif
empl.first->second.fn = fn;
}
}
Expand All @@ -3111,7 +3115,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
void tail_chunk(llvm::Value* chunk, llvm::Value* base_pc = nullptr)
{
auto call = m_ir->CreateCall(chunk, {m_thread, m_lsptr, base_pc ? base_pc : m_base_pc});
call->setCallingConv(llvm::CallingConv::GHC);
call->setCallingConv(m_finfo ? m_finfo->chunk->getCallingConv() : llvm::cast<llvm::Function>(chunk)->getCallingConv());
call->setTailCall();
m_ir->CreateRetVoid();
}
Expand Down Expand Up @@ -3146,7 +3150,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator

const auto _call = m_ir->CreateCall(verify(HERE, fn), {m_thread, m_lsptr, m_base_pc, sp, args[0], args[1]});

_call->setCallingConv(llvm::CallingConv::GHC);
_call->setCallingConv(fn->getCallingConv());

// Tail call using loaded LR value (gateway from a chunk)
if (!m_finfo->fn)
Expand Down Expand Up @@ -4074,7 +4078,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
gateway->setLinkage(GlobalValue::InternalLinkage);
gateway->setCallingConv(CallingConv::GHC);

m_ir->CreateCall(gateway, {m_thread, m_lsptr, m_base_pc})->setCallingConv(CallingConv::GHC);
m_ir->CreateCall(gateway, {m_thread, m_lsptr, m_base_pc})->setCallingConv(gateway->getCallingConv());
m_ir->CreateRetVoid();
m_ir->SetInsertPoint(label_stop);
m_ir->CreateRetVoid();
Expand Down Expand Up @@ -4324,7 +4328,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator

const auto null = cast<Function>(module->getOrInsertFunction("spu-null", entry_chunk->chunk->getFunctionType()).getCallee());
null->setLinkage(llvm::GlobalValue::InternalLinkage);
null->setCallingConv(llvm::CallingConv::GHC);
null->setCallingConv(entry_chunk->chunk->getCallingConv());
set_function(null);
m_ir->CreateRetVoid();

Expand Down Expand Up @@ -4378,7 +4382,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
if (si->getOperand(0) == m_ir->getFalse())
{
ci = m_ir->CreateCall(m_test_state, {&*f->arg_begin()});
ci->setCallingConv(CallingConv::PreserveAll);
ci->setCallingConv(m_test_state->getCallingConv());
}
else
{
Expand Down

0 comments on commit 8194c92

Please sign in to comment.