  Quantum computers promise to transform our notions of computation by offering
a completely new paradigm. To achieve scalable quantum computation, optimizing
compilers and a corresponding software design flow will be essential. We
present a software architecture for compiling quantum programs from a
high-level language program to hardware-specific instructions. We describe the
necessary layers of abstraction and their differences and similarities to
classical layers of a computer-aided design flow. For each layer of the stack,
we discuss the underlying methods for compilation and optimization. Our
software methodology facilitates more rapid innovation among quantum algorithm
designers, quantum hardware engineers, and experimentalists. It enables
scalable compilation of complex quantum algorithms and can be targeted to any
specific quantum hardware implementation.
