Subzero: Update tests and build scripts for sandboxing.

Spec2k now runs sandboxed, using all filetypes (asm, iasm, obj).

The new build-runtime.py script builds the native and sandboxed runtimes in build/runtime/ .  The various Subzero driver scripts are updated to use that.

Fixes a stack frame bug in sandboxed mode when the integrated assembler is used.  The stack adjustment for setting up a function call wasn't being rolled back for the second emitIAS() pass, so stack variables passed as arguments to the callee were being copied from the wrong stack slot.

Notes:

1. The hybrid Subzero/llc bisection debugging builds probably do not work as intended for -filetype=obj since the ELF emitter doesn't yet support -ffunction-sections.  (This was also true for non-sandboxed hybrid builds.)

2. The cross tests have not yet been adapted for testing sandboxing.  I'd prefer to first make progress on https://code.google.com/p/nativeclient/issues/detail?id=4085 in order to avoid blindly doubling the number of tests.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4079
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/944333002
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index c7a3d81..02b9aac 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -901,8 +901,9 @@
   BundleEmitHelper &operator=(const BundleEmitHelper &) = delete;
 
 public:
-  BundleEmitHelper(Assembler *Asm, const InstList &Insts)
-      : Asm(Asm), End(Insts.end()), BundleLockStart(End),
+  BundleEmitHelper(Assembler *Asm, TargetLowering *Target,
+                   const InstList &Insts)
+      : Asm(Asm), Target(Target), End(Insts.end()), BundleLockStart(End),
         BundleSize(1 << Asm->getBundleAlignLog2Bytes()),
         BundleMaskLo(BundleSize - 1), BundleMaskHi(~BundleMaskLo),
         SizeSnapshotPre(0), SizeSnapshotPost(0) {}
@@ -948,6 +949,7 @@
     BundleLockStart = I;
     SizeSnapshotPre = Asm->getBufferSize();
     Asm->setPreliminary(true);
+    Target->snapshotEmitState();
     assert(isInBundleLockRegion());
   }
   // Update bookkeeping when the bundle_unlock instruction is
@@ -989,10 +991,12 @@
     assert(isInBundleLockRegion());
     Asm->setBufferSize(SizeSnapshotPre);
     Asm->setPreliminary(false);
+    Target->rollbackEmitState();
   }
 
 private:
   Assembler *const Asm;
+  TargetLowering *const Target;
   // End is a sentinel value such that BundleLockStart==End implies
   // that we are not in a bundle_lock region.
   const InstList::const_iterator End;
@@ -1047,7 +1051,7 @@
   // of label bindings, label links, and relocation fixups.  Instead,
   // the first pass just disables all mutation of that state.
 
-  BundleEmitHelper Helper(Asm, Insts);
+  BundleEmitHelper Helper(Asm, Func->getTarget(), Insts);
   InstList::const_iterator End = Insts.end();
   // Retrying indicates that we had to roll back to the bundle_lock
   // instruction to apply padding before the bundle_lock sequence.