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