An optimized register allocator for individual Prolog clauses containing temporary variables is described. It is based on a determination of a relative order of compilation of individual argument registers of a clause head, and of a first non-built goal. A precise description of the clause structure, its convenient representation, classification of temporary variables and clauses, and a new approach to the solving of register conflicts enable optimal compilation of all clauses of the given class, whose number of temporary variables is from a predetermined interval. In some cases this interval may be expanded to a subset of finite clauses that may be well translated into an optimal abstract code during real time of compilation.