codegen for Gibbs