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/IceTargetLowering.h b/src/IceTargetLowering.h
index 92eed51..2ad2685 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -192,6 +192,17 @@
llvm::SmallVectorImpl<int32_t> &Permutation,
const llvm::SmallBitVector &ExcludeRegisters) const = 0;
+ // Save/restore any mutable state for the situation where code
+ // emission needs multiple passes, such as sandboxing or relaxation.
+ // Subclasses may provide their own implementation, but should be
+ // sure to also call the parent class's methods.
+ virtual void snapshotEmitState() {
+ SnapshotStackAdjustment = StackAdjustment;
+ }
+ virtual void rollbackEmitState() {
+ StackAdjustment = SnapshotStackAdjustment;
+ }
+
virtual void emitVariable(const Variable *Var) const = 0;
// Performs target-specific argument lowering.
@@ -239,6 +250,9 @@
// natural location, as arguments are pushed for a function call.
int32_t StackAdjustment;
LoweringContext Context;
+
+private:
+ int32_t SnapshotStackAdjustment;
};
// TargetDataLowering is used for "lowering" data including initializers