The need for computing power is constantly increasing and this has popularized the utilization of specialized computing units, such as a Graphics Processing Unit (GPU), for general-purpose computing. General-purpose GPUs provide tremendous computing power with relatively low power consumption. The addition of a GPU to a system makes the computing architecture heterogeneous and more complex. In order to fully take advantage of the computing power of both the Central Processing Unit (CPU) and the GPU, applications must be specifically programmed for such a system composition. Programming heterogeneous systems is complex, time-consuming and often requires detailed knowledge of the underlying hardware architecture. In an effort to minimize the effort needed to utilize the GPU, Didem Unat created the Mint programming model and the Mint source-to-source translator. Even though the Mint translator is very good, we recognize potential for improvements. In this thesis we present Spearmint, our source-to-source translator that accepts Mint-annotated C and C++ code and generates CUDA C/C++ code that can be run on a CPU-GPU system. The source-to-source translator presented in this thesis is based on the LLVM compiler infrastructure and supports all common operating systems. We implemented an optimization that utilizes Nvidia’s Kepler architecture’s read-only data cache. Our comparisons show that Spearmint delivers comparable or higher performance than the Mint translator for three commonly used stencil computations on one of Nvidia’s Kepler GPUs. We also found that the Spearmint-generated CUDA code is shorter, less involved and resembles the input code more than the Mint-generated code.