Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: crosstest/insertelement.h

Issue 1560933002: Subzero: Enable Non-SFI vector cross tests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: crosstest/insertelement.h
diff --git a/crosstest/insertelement.h b/crosstest/insertelement.h
new file mode 100644
index 0000000000000000000000000000000000000000..701a0f8700e79b152f4061345e2fc9dbecaa099f
--- /dev/null
+++ b/crosstest/insertelement.h
@@ -0,0 +1,27 @@
+//===- subzero/crosstest/insertelement.h - Helper for PNaCl workaround. ---===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Helper function to work around a potential stack overflow issue.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef INSERTELEMENT_H
+#define INSERTELEMENT_H
+
+// Helper function to perform the insertelement bitcode instruction. The PNaCl
+// ABI simplifications transform insertelement/extractelement instructions with
+// a non-constant index into something involving alloca. This can cause a stack
+// overflow if the alloca is inside a loop.
+template <typename VectorType, typename ElementType>
+void __attribute__((noinline))
+setElement(VectorType &Value, size_t Index, ElementType Element) {
+ Value[Index] = Element;
+}
+
+#endif // INSERTELEMENT_H

Powered by Google App Engine
This is Rietveld 408576698