/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/SystemZ/SystemZConstantPoolValue.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===-- SystemZConstantPoolValue.cpp - SystemZ constant-pool value --------===// |
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 "SystemZConstantPoolValue.h" |
11 | | #include "llvm/ADT/FoldingSet.h" |
12 | | #include "llvm/IR/DerivedTypes.h" |
13 | | #include "llvm/IR/GlobalValue.h" |
14 | | #include "llvm/Support/raw_ostream.h" |
15 | | |
16 | | using namespace llvm; |
17 | | |
18 | | SystemZConstantPoolValue:: |
19 | | SystemZConstantPoolValue(const GlobalValue *gv, |
20 | | SystemZCP::SystemZCPModifier modifier) |
21 | 17 | : MachineConstantPoolValue(gv->getType()), GV(gv), Modifier(modifier) {} |
22 | | |
23 | | SystemZConstantPoolValue * |
24 | | SystemZConstantPoolValue::Create(const GlobalValue *GV, |
25 | 17 | SystemZCP::SystemZCPModifier Modifier) { |
26 | 17 | return new SystemZConstantPoolValue(GV, Modifier); |
27 | 17 | } |
28 | | |
29 | | int SystemZConstantPoolValue:: |
30 | 17 | getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) { |
31 | 17 | unsigned AlignMask = Alignment - 1; |
32 | 17 | const std::vector<MachineConstantPoolEntry> &Constants = CP->getConstants(); |
33 | 27 | for (unsigned I = 0, E = Constants.size(); I != E27 ; ++I10 ) { |
34 | 10 | if (Constants[I].isMachineConstantPoolEntry() && |
35 | 10 | (Constants[I].getAlignment() & AlignMask) == 010 ) { |
36 | 10 | auto *ZCPV = |
37 | 10 | static_cast<SystemZConstantPoolValue *>(Constants[I].Val.MachineCPVal); |
38 | 10 | if (ZCPV->GV == GV && 10 ZCPV->Modifier == Modifier4 ) |
39 | 0 | return I; |
40 | 10 | } |
41 | 10 | } |
42 | 17 | return -1; |
43 | 17 | } |
44 | | |
45 | 50 | void SystemZConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) { |
46 | 50 | ID.AddPointer(GV); |
47 | 50 | ID.AddInteger(Modifier); |
48 | 50 | } |
49 | | |
50 | 0 | void SystemZConstantPoolValue::print(raw_ostream &O) const { |
51 | 0 | O << GV << "@" << int(Modifier); |
52 | 0 | } |