void Recompiler::lbzu(Instruction code) { llvm::Value* addr = builder.getInt64(code.ds << 2); llvm::Value* rd; addr = builder.CreateAdd(addr, getGPR(code.ra)); rd = readMemory(addr, 8); rd = builder.CreateZExt(rd, builder.getInt64Ty()); setGPR(code.ra, addr); setGPR(code.rd, rd); }
void Recompiler::lfs(Instruction code) { llvm::Value* addr = builder.getInt64(code.d); llvm::Value* frd; if (code.ra) { addr = builder.CreateAdd(addr, getGPR(code.ra)); } frd = readMemory(addr, 32); setGPR(code.frd, frd); }
void Recompiler::stfs(Instruction code) { llvm::Value* addr = builder.getInt64(code.d); llvm::Value* frs = getFPR(code.frs); if (code.ra) { addr = builder.CreateAdd(addr, getGPR(code.ra)); } frs = builder.CreateFPTrunc(frs, builder.getFloatTy()); frs = builder.CreateBitCast(frs, builder.getInt32Ty()); writeMemory(addr, frs); }
void Recompiler::lwa(Instruction code) { llvm::Value* addr = builder.getInt64(code.ds << 2); llvm::Value* rd; if (code.ra) { addr = builder.CreateAdd(addr, getGPR(code.ra)); } rd = readMemory(addr, 32); rd = builder.CreateSExt(rd, builder.getInt64Ty()); setGPR(code.rd, rd); }
Real LinearFunctional:: mean() { GPR* gpr=getGPR(); int N=gpr->get_N(); // the vector of unconditional expectations E[A_k]: const RealArray1D& mu=gpr->getPriorMean(); // the sequence of values integral(gpr->psi_k) RealArray1D l=valuesOnBasisFunctions(); Real I=0.0; for(int k=0;k<=N;k++) I+=mu[k]*l[k]; return I; }
Real LinearFunctional:: covariance(int j) { // see gpr-notes, equation (39), p34. GPR* gpr=getGPR(); int N=gpr->get_N(); // the sequence of values integral(gpr->psi_k) RealArray1D l=valuesOnBasisFunctions(); // the matrix psi_k(s_j) const RealMatrix& psi=gpr->get_psi(); Real cv=0.0; for(int k=0;k<=N;k++) cv+=psi(k,j)*l[k]; return cv; }