Specify a block preconditioner? KSPSetOperators(KSP ksp, Mat Amat, Mat Pmat)

Say

Mat A =[[UU, UP', UA'],
        [UP, 0,     0],
        [UA, 0,     0]];


Mat P=[[UU, 0, 0],
       [0, PP, 0],
       [0, 0, AA]];

How can we apply P as the preconditioner for solving Ax = f in FreeFem using syntax like

set(A , sparams = " ...  ", fields = usPETSc, names = names);
x = A^-1 * f ;

?

See Applying a modified preconditioner matrix in PETSc - #2 by prj.