1. A computer implemented method for accessing threadprivate memory for threadprivate variables in a parallel program during program compilation, comprising: aggregating threadprivate variables in the program; replacing references of the threadprivate variables by indirect references for a defined procedure; moving address load operations of the threadprivate variables; and replacing the address load operations of the threadprivate variables by calls to runtime routines to access the threadprivate memory.