Weight Matrix in Generalised Linear Models

I was wondering if I am trying to do IRLS for GLZ.
Is there a way to compute the weight matrix directly for the data I have?
I think its possible if the data is normally distributed , what about if the data is non-normal