A fundamental problem of extremal graph theory is to ask, 'What is the maximum number of edges in an F-free graph on n vertices?' Recently Alon and Shikhelman proposed a more general, subgraph counting, version of this question. They considered the question of determining the maximum number of copies of a fixed graph T in an F-free graph on n vertices. In this more general context, where we are no longer counting edges, it is also natural to ask what is the maximum number of copies of T in an F-free graph with m edges and no restriction on the number of vertices. Frohmader, in a different context, determined the answer when T and F are both complete graphs. We prove results for this problem analogous to the Erdős--Stone theorem, the Erdős--Simonovits theorem, and the stability theorem of Erdős--Simonovits.