コード例 #1
0
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);
}
コード例 #2
0
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);
}
コード例 #3
0
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);
}
コード例 #4
0
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);
}
コード例 #5
0
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;
}
コード例 #6
0
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;
}