Eliminate Subzero sandboxing support

Subzero supported sandboxing for the PNaCl platform. Reactor does not
support sandboxing at the JIT level, and we don't have a need for it
since Chromium provides sandboxing as part of the "GPU process". Thus
we can remove it and reduce code complexity.

Note that Subzero's sandboxing implementation comes at a performance
penalty. Project Bunker provides a better solution for SwiftShader,
which is probably also more secure in light of speculative execution
vulnerabilities.

If we ever do need sandboxing support in Reactor itself (e.g. outside of
SwiftShader, when process isolation is not feasible), it is best to
use an actively developed JIT-compiler where security always takes
priority over peformance, like Chromium's WebAssembly JIT.

Bug: b/179832693
Change-Id: I7364d22183e123c5145caae9f546d3855012d73e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55488
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Commit-Queue: Nicolas Capens <nicolascapens@google.com>
diff --git a/third_party/subzero/src/IceTargetLowering.h b/third_party/subzero/src/IceTargetLowering.h
index a62e26e..d55e48c 100644
--- a/third_party/subzero/src/IceTargetLowering.h
+++ b/third_party/subzero/src/IceTargetLowering.h
@@ -94,7 +94,7 @@
   InstList::iterator getNext() const { return Next; }
   InstList::iterator getEnd() const { return End; }
   void insert(Inst *Instr);
-  template <typename Inst, typename... Args> Inst *insert(Args &&... A) {
+  template <typename Inst, typename... Args> Inst *insert(Args &&...A) {
     auto *New = Inst::create(Node->getCfg(), std::forward<Args>(A)...);
     insert(New);
     return New;
@@ -343,46 +343,11 @@
   virtual ~TargetLowering() = default;
 
 private:
-  // This control variable is used by AutoBundle (RAII-style bundle
-  // locking/unlocking) to prevent nested bundles.
-  bool AutoBundling = false;
-
   /// This indicates whether we are in the genTargetHelperCalls phase, and
   /// therefore can do things like scalarization.
   bool GeneratingTargetHelpers = false;
 
-  // _bundle_lock(), and _bundle_unlock(), were made private to force subtargets
-  // to use the AutoBundle helper.
-  void
-  _bundle_lock(InstBundleLock::Option BundleOption = InstBundleLock::Opt_None) {
-    Context.insert<InstBundleLock>(BundleOption);
-  }
-  void _bundle_unlock() { Context.insert<InstBundleUnlock>(); }
-
 protected:
-  /// AutoBundle provides RIAA-style bundling. Sub-targets are expected to use
-  /// it when emitting NaCl Bundles to ensure proper bundle_unlocking, and
-  /// prevent nested bundles.
-  ///
-  /// AutoBundle objects will emit a _bundle_lock during construction (but only
-  /// if sandboxed code generation was requested), and a bundle_unlock() during
-  /// destruction. By carefully scoping objects of this type, Subtargets can
-  /// ensure proper bundle emission.
-  class AutoBundle {
-    AutoBundle() = delete;
-    AutoBundle(const AutoBundle &) = delete;
-    AutoBundle &operator=(const AutoBundle &) = delete;
-
-  public:
-    explicit AutoBundle(TargetLowering *Target, InstBundleLock::Option Option =
-                                                    InstBundleLock::Opt_None);
-    ~AutoBundle();
-
-  private:
-    TargetLowering *const Target;
-    const bool NeedSandboxing;
-  };
-
   explicit TargetLowering(Cfg *Func);
   // Applies command line filters to TypeToRegisterSet array.
   static void filterTypeToRegisterSet(
@@ -501,7 +466,7 @@
   template <typename... Operands,
             typename F = std::function<Inst *(Variable *, Operands *...)>>
   void scalarizeInstruction(Variable *Dest, F insertScalarInstruction,
-                            Operands *... Srcs) {
+                            Operands *...Srcs) {
     assert(GeneratingTargetHelpers &&
            "scalarizeInstruction called during incorrect phase");
     const Type DestTy = Dest->getType();
@@ -580,15 +545,6 @@
     return insertScalarInstruction(Res, Src0, Src1, Src2);
   }
 
-  /// SandboxType enumerates all possible sandboxing strategies that
-  enum SandboxType {
-    ST_None,
-    ST_NaCl,
-    ST_Nonsfi,
-  };
-
-  static SandboxType determineSandboxTypeFromFlags(const ClFlags &Flags);
-
   Cfg *Func;
   GlobalContext *Ctx;
   bool HasComputedFrame = false;
@@ -596,9 +552,6 @@
   SizeT NextLabelNumber = 0;
   SizeT NextJumpTableNumber = 0;
   LoweringContext Context;
-  const SandboxType SandboxingType = ST_None;
-
-  const static constexpr char *H_getIP_prefix = "__Sz_getIP_";
 };
 
 /// TargetDataLowering is used for "lowering" data including initializers for