Refactor SkVMGenerator construction.

Previously, the ctor for SkVMGenerator did a lot of setup work and
emitted the global-variable logic directly. Callers were responsible for
calling `writeFunction` exactly one time, to emit main.

Now, the ctor of SkVMGenerator just sets up members, and callers need to
call `writeProgram`. `writeProgram` emits all the setup code as well as
main.

This makes the ctor a little less scary looking, and gives us a natural
place to insert a dsl::Start/End pair.

Change-Id: I713a0ea70def64f9eeeda4eb7504028112b5d7ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451743
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
1 file changed