OLD | NEW |
(Empty) | |
| 1 //===-- Utils.cpp - Helper functions for MinSFI passes --------------------===// |
| 2 // |
| 3 // The LLVM Compiler Infrastructure |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 |
| 10 #include "llvm/Support/CommandLine.h" |
| 11 #include "llvm/Transforms/MinSFI.h" |
| 12 |
| 13 using namespace llvm; |
| 14 |
| 15 static cl::opt<uint32_t> |
| 16 PointerSizeInBits("minsfi-ptrsize", cl::init(32), |
| 17 cl::desc("Size of the address subspace in bits")); |
| 18 |
| 19 uint32_t minsfi::GetPointerSizeInBits() { |
| 20 if (PointerSizeInBits < 20 || PointerSizeInBits > 32) |
| 21 report_fatal_error("MinSFI: Size of the sandboxed pointers is out of " |
| 22 "bounds (20-32)"); |
| 23 return PointerSizeInBits; |
| 24 } |
| 25 |
| 26 uint64_t minsfi::GetAddressSubspaceSize() { |
| 27 return 1LL << GetPointerSizeInBits(); |
| 28 } |
OLD | NEW |