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

Unified Diff: lib/Transforms/MinSFI/Utils.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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
« no previous file with comments | « lib/Transforms/MinSFI/SubstituteUndefs.cpp ('k') | lib/Transforms/NaCl/AddPNaClExternalDecls.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/MinSFI/Utils.cpp
diff --git a/lib/Transforms/MinSFI/Utils.cpp b/lib/Transforms/MinSFI/Utils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a1f02e2c05ff3c1e0d7d91a180bb903d8659241d
--- /dev/null
+++ b/lib/Transforms/MinSFI/Utils.cpp
@@ -0,0 +1,28 @@
+//===-- Utils.cpp - Helper functions for MinSFI passes --------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Transforms/MinSFI.h"
+
+using namespace llvm;
+
+static cl::opt<uint32_t>
+PointerSizeInBits("minsfi-ptrsize", cl::init(32),
+ cl::desc("Size of the address subspace in bits"));
+
+uint32_t minsfi::GetPointerSizeInBits() {
+ if (PointerSizeInBits < 20 || PointerSizeInBits > 32)
+ report_fatal_error("MinSFI: Size of the sandboxed pointers is out of "
+ "bounds (20-32)");
+ return PointerSizeInBits;
+}
+
+uint64_t minsfi::GetAddressSubspaceSize() {
+ return 1LL << GetPointerSizeInBits();
+}
« no previous file with comments | « lib/Transforms/MinSFI/SubstituteUndefs.cpp ('k') | lib/Transforms/NaCl/AddPNaClExternalDecls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698