mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-16 04:52:16 +00:00
LowerBitSets: Add debugging output.
Differential Revision: http://reviews.llvm.org/D11583 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243546 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
607fe5bb28
commit
63aeece879
@ -28,6 +28,7 @@ namespace llvm {
|
|||||||
class DataLayout;
|
class DataLayout;
|
||||||
class GlobalVariable;
|
class GlobalVariable;
|
||||||
class Value;
|
class Value;
|
||||||
|
class raw_ostream;
|
||||||
|
|
||||||
struct BitSetInfo {
|
struct BitSetInfo {
|
||||||
// The indices of the set bits in the bitset.
|
// The indices of the set bits in the bitset.
|
||||||
@ -57,6 +58,8 @@ struct BitSetInfo {
|
|||||||
bool containsValue(const DataLayout &DL,
|
bool containsValue(const DataLayout &DL,
|
||||||
const DenseMap<GlobalVariable *, uint64_t> &GlobalLayout,
|
const DenseMap<GlobalVariable *, uint64_t> &GlobalLayout,
|
||||||
Value *V, uint64_t COffset = 0) const;
|
Value *V, uint64_t COffset = 0) const;
|
||||||
|
|
||||||
|
void print(raw_ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BitSetBuilder {
|
struct BitSetBuilder {
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/IR/Operator.h"
|
#include "llvm/IR/Operator.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -90,6 +92,22 @@ bool BitSetInfo::containsValue(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BitSetInfo::print(raw_ostream &OS) const {
|
||||||
|
OS << "offset " << ByteOffset << " size " << BitSize << " align "
|
||||||
|
<< (1 << AlignLog2);
|
||||||
|
|
||||||
|
if (isAllOnes()) {
|
||||||
|
OS << " all-ones\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OS << " { ";
|
||||||
|
for (uint64_t B : Bits)
|
||||||
|
OS << B << ' ';
|
||||||
|
OS << "}\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BitSetInfo BitSetBuilder::build() {
|
BitSetInfo BitSetBuilder::build() {
|
||||||
if (Min > Max)
|
if (Min > Max)
|
||||||
Min = 0;
|
Min = 0;
|
||||||
@ -532,6 +550,10 @@ void LowerBitSets::buildBitSetsFromGlobals(
|
|||||||
for (MDString *BS : BitSets) {
|
for (MDString *BS : BitSets) {
|
||||||
// Build the bitset.
|
// Build the bitset.
|
||||||
BitSetInfo BSI = buildBitSet(BS, GlobalLayout);
|
BitSetInfo BSI = buildBitSet(BS, GlobalLayout);
|
||||||
|
DEBUG({
|
||||||
|
dbgs() << BS->getString() << ": ";
|
||||||
|
BSI.print(dbgs());
|
||||||
|
});
|
||||||
|
|
||||||
ByteArrayInfo *BAI = 0;
|
ByteArrayInfo *BAI = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user