Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Utility / AddressableBits.cpp
blobc6e25f608da73d59d1babe4af17e58debe5fcd68
1 //===-- AddressableBits.cpp -----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/AddressableBits.h"
10 #include "lldb/Target/Process.h"
11 #include "lldb/lldb-types.h"
13 using namespace lldb;
14 using namespace lldb_private;
16 void AddressableBits::SetAddressableBits(uint32_t addressing_bits) {
17 m_low_memory_addr_bits = m_high_memory_addr_bits = addressing_bits;
20 void AddressableBits::SetAddressableBits(uint32_t lowmem_addressing_bits,
21 uint32_t highmem_addressing_bits) {
22 m_low_memory_addr_bits = lowmem_addressing_bits;
23 m_high_memory_addr_bits = highmem_addressing_bits;
26 void AddressableBits::SetLowmemAddressableBits(
27 uint32_t lowmem_addressing_bits) {
28 m_low_memory_addr_bits = lowmem_addressing_bits;
31 void AddressableBits::SetHighmemAddressableBits(
32 uint32_t highmem_addressing_bits) {
33 m_high_memory_addr_bits = highmem_addressing_bits;
36 void AddressableBits::SetProcessMasks(Process &process) {
37 if (m_low_memory_addr_bits == 0 && m_high_memory_addr_bits == 0)
38 return;
40 if (m_low_memory_addr_bits != 0) {
41 addr_t low_addr_mask = ~((1ULL << m_low_memory_addr_bits) - 1);
42 process.SetCodeAddressMask(low_addr_mask);
43 process.SetDataAddressMask(low_addr_mask);
46 if (m_high_memory_addr_bits != 0) {
47 addr_t hi_addr_mask = ~((1ULL << m_high_memory_addr_bits) - 1);
48 process.SetHighmemCodeAddressMask(hi_addr_mask);
49 process.SetHighmemDataAddressMask(hi_addr_mask);