Compute {Set,Dat,Const,Global,Mat}.cdim only once