LLVM  13.0.0git
ConstantsContext.h
Go to the documentation of this file.
1 //===-- ConstantsContext.h - Constants-related Context Interals -*- C++ -*-===//
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 // This file defines various helper methods and classes used by
10 // LLVMContextImpl for creating and managing constants.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_IR_CONSTANTSCONTEXT_H
15 #define LLVM_LIB_IR_CONSTANTSCONTEXT_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/DenseMapInfo.h"
19 #include "llvm/ADT/DenseSet.h"
20 #include "llvm/ADT/Hashing.h"
21 #include "llvm/ADT/None.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/IR/Constant.h"
25 #include "llvm/IR/Constants.h"
26 #include "llvm/IR/DerivedTypes.h"
27 #include "llvm/IR/InlineAsm.h"
28 #include "llvm/IR/Instruction.h"
29 #include "llvm/IR/Instructions.h"
30 #include "llvm/IR/OperandTraits.h"
31 #include "llvm/Support/Casting.h"
32 #include "llvm/Support/Debug.h"
35 #include <cassert>
36 #include <cstddef>
37 #include <cstdint>
38 #include <utility>
39 
40 #define DEBUG_TYPE "ir"
41 
42 namespace llvm {
43 
44 /// UnaryConstantExpr - This class is private to Constants.cpp, and is used
45 /// behind the scenes to implement unary constant exprs.
46 class UnaryConstantExpr final : public ConstantExpr {
47 public:
48  UnaryConstantExpr(unsigned Opcode, Constant *C, Type *Ty)
49  : ConstantExpr(Ty, Opcode, &Op<0>(), 1) {
50  Op<0>() = C;
51  }
52 
53  // allocate space for exactly one operand
54  void *operator new(size_t s) {
55  return User::operator new(s, 1);
56  }
57 
59 
60  static bool classof(const ConstantExpr *CE) {
61  return Instruction::isCast(CE->getOpcode()) ||
62  Instruction::isUnaryOp(CE->getOpcode());
63  }
64  static bool classof(const Value *V) {
65  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
66  }
67 };
68 
69 /// BinaryConstantExpr - This class is private to Constants.cpp, and is used
70 /// behind the scenes to implement binary constant exprs.
71 class BinaryConstantExpr final : public ConstantExpr {
72 public:
73  BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2,
74  unsigned Flags)
75  : ConstantExpr(C1->getType(), Opcode, &Op<0>(), 2) {
76  Op<0>() = C1;
77  Op<1>() = C2;
78  SubclassOptionalData = Flags;
79  }
80 
81  // allocate space for exactly two operands
82  void *operator new(size_t s) {
83  return User::operator new(s, 2);
84  }
85 
86  /// Transparently provide more efficient getOperand methods.
88 
89  static bool classof(const ConstantExpr *CE) {
90  return Instruction::isBinaryOp(CE->getOpcode());
91  }
92  static bool classof(const Value *V) {
93  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
94  }
95 };
96 
97 /// SelectConstantExpr - This class is private to Constants.cpp, and is used
98 /// behind the scenes to implement select constant exprs.
99 class SelectConstantExpr final : public ConstantExpr {
100 public:
102  : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) {
103  Op<0>() = C1;
104  Op<1>() = C2;
105  Op<2>() = C3;
106  }
107 
108  // allocate space for exactly three operands
109  void *operator new(size_t s) {
110  return User::operator new(s, 3);
111  }
112 
113  /// Transparently provide more efficient getOperand methods.
115 
116  static bool classof(const ConstantExpr *CE) {
117  return CE->getOpcode() == Instruction::Select;
118  }
119  static bool classof(const Value *V) {
120  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
121  }
122 };
123 
124 /// ExtractElementConstantExpr - This class is private to
125 /// Constants.cpp, and is used behind the scenes to implement
126 /// extractelement constant exprs.
128 public:
130  : ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
131  Instruction::ExtractElement, &Op<0>(), 2) {
132  Op<0>() = C1;
133  Op<1>() = C2;
134  }
135 
136  // allocate space for exactly two operands
137  void *operator new(size_t s) {
138  return User::operator new(s, 2);
139  }
140 
141  /// Transparently provide more efficient getOperand methods.
143 
144  static bool classof(const ConstantExpr *CE) {
145  return CE->getOpcode() == Instruction::ExtractElement;
146  }
147  static bool classof(const Value *V) {
148  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
149  }
150 };
151 
152 /// InsertElementConstantExpr - This class is private to
153 /// Constants.cpp, and is used behind the scenes to implement
154 /// insertelement constant exprs.
156 public:
158  : ConstantExpr(C1->getType(), Instruction::InsertElement,
159  &Op<0>(), 3) {
160  Op<0>() = C1;
161  Op<1>() = C2;
162  Op<2>() = C3;
163  }
164 
165  // allocate space for exactly three operands
166  void *operator new(size_t s) {
167  return User::operator new(s, 3);
168  }
169 
170  /// Transparently provide more efficient getOperand methods.
172 
173  static bool classof(const ConstantExpr *CE) {
174  return CE->getOpcode() == Instruction::InsertElement;
175  }
176  static bool classof(const Value *V) {
177  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
178  }
179 };
180 
181 /// ShuffleVectorConstantExpr - This class is private to
182 /// Constants.cpp, and is used behind the scenes to implement
183 /// shufflevector constant exprs.
185 public:
188  cast<VectorType>(C1->getType())->getElementType(),
190  Instruction::ShuffleVector, &Op<0>(), 2) {
192  "Invalid shuffle vector instruction operands!");
193  Op<0>() = C1;
194  Op<1>() = C2;
195  ShuffleMask.assign(Mask.begin(), Mask.end());
198  }
199 
202 
203  void *operator new(size_t s) { return User::operator new(s, 2); }
204 
205  /// Transparently provide more efficient getOperand methods.
207 
208  static bool classof(const ConstantExpr *CE) {
209  return CE->getOpcode() == Instruction::ShuffleVector;
210  }
211  static bool classof(const Value *V) {
212  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
213  }
214 };
215 
216 /// ExtractValueConstantExpr - This class is private to
217 /// Constants.cpp, and is used behind the scenes to implement
218 /// extractvalue constant exprs.
220 public:
222  Type *DestTy)
223  : ConstantExpr(DestTy, Instruction::ExtractValue, &Op<0>(), 1),
224  Indices(IdxList.begin(), IdxList.end()) {
225  Op<0>() = Agg;
226  }
227 
228  // allocate space for exactly one operand
229  void *operator new(size_t s) {
230  return User::operator new(s, 1);
231  }
232 
233  /// Indices - These identify which value to extract.
235 
236  /// Transparently provide more efficient getOperand methods.
238 
239  static bool classof(const ConstantExpr *CE) {
240  return CE->getOpcode() == Instruction::ExtractValue;
241  }
242  static bool classof(const Value *V) {
243  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
244  }
245 };
246 
247 /// InsertValueConstantExpr - This class is private to
248 /// Constants.cpp, and is used behind the scenes to implement
249 /// insertvalue constant exprs.
250 class InsertValueConstantExpr final : public ConstantExpr {
251 public:
253  ArrayRef<unsigned> IdxList, Type *DestTy)
254  : ConstantExpr(DestTy, Instruction::InsertValue, &Op<0>(), 2),
255  Indices(IdxList.begin(), IdxList.end()) {
256  Op<0>() = Agg;
257  Op<1>() = Val;
258  }
259 
260  // allocate space for exactly one operand
261  void *operator new(size_t s) {
262  return User::operator new(s, 2);
263  }
264 
265  /// Indices - These identify the position for the insertion.
267 
268  /// Transparently provide more efficient getOperand methods.
270 
271  static bool classof(const ConstantExpr *CE) {
272  return CE->getOpcode() == Instruction::InsertValue;
273  }
274  static bool classof(const Value *V) {
275  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
276  }
277 };
278 
279 /// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is
280 /// used behind the scenes to implement getelementpr constant exprs.
282  Type *SrcElementTy;
283  Type *ResElementTy;
284 
285  GetElementPtrConstantExpr(Type *SrcElementTy, Constant *C,
286  ArrayRef<Constant *> IdxList, Type *DestTy);
287 
288 public:
289  static GetElementPtrConstantExpr *Create(Type *SrcElementTy, Constant *C,
290  ArrayRef<Constant *> IdxList,
291  Type *DestTy, unsigned Flags) {
292  GetElementPtrConstantExpr *Result = new (IdxList.size() + 1)
293  GetElementPtrConstantExpr(SrcElementTy, C, IdxList, DestTy);
294  Result->SubclassOptionalData = Flags;
295  return Result;
296  }
297 
298  Type *getSourceElementType() const;
299  Type *getResultElementType() const;
300 
301  /// Transparently provide more efficient getOperand methods.
303 
304  static bool classof(const ConstantExpr *CE) {
305  return CE->getOpcode() == Instruction::GetElementPtr;
306  }
307  static bool classof(const Value *V) {
308  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
309  }
310 };
311 
312 // CompareConstantExpr - This class is private to Constants.cpp, and is used
313 // behind the scenes to implement ICmp and FCmp constant expressions. This is
314 // needed in order to store the predicate value for these instructions.
315 class CompareConstantExpr final : public ConstantExpr {
316 public:
317  unsigned short predicate;
319  unsigned short pred, Constant* LHS, Constant* RHS)
320  : ConstantExpr(ty, opc, &Op<0>(), 2), predicate(pred) {
321  Op<0>() = LHS;
322  Op<1>() = RHS;
323  }
324 
325  // allocate space for exactly two operands
326  void *operator new(size_t s) {
327  return User::operator new(s, 2);
328  }
329 
330  /// Transparently provide more efficient getOperand methods.
332 
333  static bool classof(const ConstantExpr *CE) {
334  return CE->getOpcode() == Instruction::ICmp ||
335  CE->getOpcode() == Instruction::FCmp;
336  }
337  static bool classof(const Value *V) {
338  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
339  }
340 };
341 
342 template <>
344  : public FixedNumOperandTraits<UnaryConstantExpr, 1> {};
346 
347 template <>
349  : public FixedNumOperandTraits<BinaryConstantExpr, 2> {};
351 
352 template <>
354  : public FixedNumOperandTraits<SelectConstantExpr, 3> {};
356 
357 template <>
359  : public FixedNumOperandTraits<ExtractElementConstantExpr, 2> {};
361 
362 template <>
364  : public FixedNumOperandTraits<InsertElementConstantExpr, 3> {};
366 
367 template <>
369  : public FixedNumOperandTraits<ShuffleVectorConstantExpr, 2> {};
371 
372 template <>
374  : public FixedNumOperandTraits<ExtractValueConstantExpr, 1> {};
376 
377 template <>
379  : public FixedNumOperandTraits<InsertValueConstantExpr, 2> {};
381 
382 template <>
384  : public VariadicOperandTraits<GetElementPtrConstantExpr, 1> {};
385 
387 
388 template <>
390  : public FixedNumOperandTraits<CompareConstantExpr, 2> {};
392 
393 template <class ConstantClass> struct ConstantAggrKeyType;
394 struct InlineAsmKeyType;
395 struct ConstantExprKeyType;
396 
397 template <class ConstantClass> struct ConstantInfo;
398 template <> struct ConstantInfo<ConstantExpr> {
400  using TypeClass = Type;
401 };
402 template <> struct ConstantInfo<InlineAsm> {
405 };
406 template <> struct ConstantInfo<ConstantArray> {
409 };
410 template <> struct ConstantInfo<ConstantStruct> {
413 };
414 template <> struct ConstantInfo<ConstantVector> {
417 };
418 
419 template <class ConstantClass> struct ConstantAggrKeyType {
421 
423 
425  : Operands(Operands) {}
426 
427  ConstantAggrKeyType(const ConstantClass *C,
428  SmallVectorImpl<Constant *> &Storage) {
429  assert(Storage.empty() && "Expected empty storage");
430  for (unsigned I = 0, E = C->getNumOperands(); I != E; ++I)
431  Storage.push_back(C->getOperand(I));
432  Operands = Storage;
433  }
434 
435  bool operator==(const ConstantAggrKeyType &X) const {
436  return Operands == X.Operands;
437  }
438 
439  bool operator==(const ConstantClass *C) const {
440  if (Operands.size() != C->getNumOperands())
441  return false;
442  for (unsigned I = 0, E = Operands.size(); I != E; ++I)
443  if (Operands[I] != C->getOperand(I))
444  return false;
445  return true;
446  }
447 
448  unsigned getHash() const {
449  return hash_combine_range(Operands.begin(), Operands.end());
450  }
451 
453 
454  ConstantClass *create(TypeClass *Ty) const {
455  return new (Operands.size()) ConstantClass(Ty, Operands);
456  }
457 };
458 
466  bool CanThrow;
467 
474 
476  : AsmString(Asm->getAsmString()), Constraints(Asm->getConstraintString()),
477  FTy(Asm->getFunctionType()), HasSideEffects(Asm->hasSideEffects()),
478  IsAlignStack(Asm->isAlignStack()), AsmDialect(Asm->getDialect()),
479  CanThrow(Asm->canThrow()) {}
480 
481  bool operator==(const InlineAsmKeyType &X) const {
482  return HasSideEffects == X.HasSideEffects &&
483  IsAlignStack == X.IsAlignStack && AsmDialect == X.AsmDialect &&
484  AsmString == X.AsmString && Constraints == X.Constraints &&
485  FTy == X.FTy && CanThrow == X.CanThrow;
486  }
487 
488  bool operator==(const InlineAsm *Asm) const {
489  return HasSideEffects == Asm->hasSideEffects() &&
490  IsAlignStack == Asm->isAlignStack() &&
491  AsmDialect == Asm->getDialect() &&
492  AsmString == Asm->getAsmString() &&
493  Constraints == Asm->getConstraintString() &&
494  FTy == Asm->getFunctionType() && CanThrow == Asm->canThrow();
495  }
496 
497  unsigned getHash() const {
500  }
501 
503 
504  InlineAsm *create(TypeClass *Ty) const {
506  return new InlineAsm(FTy, std::string(AsmString), std::string(Constraints),
508  }
509 };
510 
512 private:
513  uint8_t Opcode;
514  uint8_t SubclassOptionalData;
515  uint16_t SubclassData;
517  ArrayRef<unsigned> Indexes;
518  ArrayRef<int> ShuffleMask;
519  Type *ExplicitTy;
520 
521  static ArrayRef<int> getShuffleMaskIfValid(const ConstantExpr *CE) {
522  if (CE->getOpcode() == Instruction::ShuffleVector)
523  return CE->getShuffleMask();
524  return None;
525  }
526 
527  static ArrayRef<unsigned> getIndicesIfValid(const ConstantExpr *CE) {
528  if (CE->hasIndices())
529  return CE->getIndices();
530  return None;
531  }
532 
533  static Type *getSourceElementTypeIfValid(const ConstantExpr *CE) {
534  if (auto *GEPCE = dyn_cast<GetElementPtrConstantExpr>(CE))
535  return GEPCE->getSourceElementType();
536  return nullptr;
537  }
538 
539 public:
541  unsigned short SubclassData = 0,
542  unsigned short SubclassOptionalData = 0,
543  ArrayRef<unsigned> Indexes = None,
544  ArrayRef<int> ShuffleMask = None,
545  Type *ExplicitTy = nullptr)
546  : Opcode(Opcode), SubclassOptionalData(SubclassOptionalData),
547  SubclassData(SubclassData), Ops(Ops), Indexes(Indexes),
548  ShuffleMask(ShuffleMask), ExplicitTy(ExplicitTy) {}
549 
551  : Opcode(CE->getOpcode()),
552  SubclassOptionalData(CE->getRawSubclassOptionalData()),
553  SubclassData(CE->isCompare() ? CE->getPredicate() : 0), Ops(Operands),
554  Indexes(getIndicesIfValid(CE)), ShuffleMask(getShuffleMaskIfValid(CE)),
555  ExplicitTy(getSourceElementTypeIfValid(CE)) {}
556 
559  : Opcode(CE->getOpcode()),
560  SubclassOptionalData(CE->getRawSubclassOptionalData()),
561  SubclassData(CE->isCompare() ? CE->getPredicate() : 0),
562  Indexes(getIndicesIfValid(CE)), ShuffleMask(getShuffleMaskIfValid(CE)),
563  ExplicitTy(getSourceElementTypeIfValid(CE)) {
564  assert(Storage.empty() && "Expected empty storage");
565  for (unsigned I = 0, E = CE->getNumOperands(); I != E; ++I)
566  Storage.push_back(CE->getOperand(I));
567  Ops = Storage;
568  }
569 
570  bool operator==(const ConstantExprKeyType &X) const {
571  return Opcode == X.Opcode && SubclassData == X.SubclassData &&
572  SubclassOptionalData == X.SubclassOptionalData && Ops == X.Ops &&
573  Indexes == X.Indexes && ShuffleMask == X.ShuffleMask &&
574  ExplicitTy == X.ExplicitTy;
575  }
576 
577  bool operator==(const ConstantExpr *CE) const {
578  if (Opcode != CE->getOpcode())
579  return false;
580  if (SubclassOptionalData != CE->getRawSubclassOptionalData())
581  return false;
582  if (Ops.size() != CE->getNumOperands())
583  return false;
584  if (SubclassData != (CE->isCompare() ? CE->getPredicate() : 0))
585  return false;
586  for (unsigned I = 0, E = Ops.size(); I != E; ++I)
587  if (Ops[I] != CE->getOperand(I))
588  return false;
589  if (Indexes != getIndicesIfValid(CE))
590  return false;
591  if (ShuffleMask != getShuffleMaskIfValid(CE))
592  return false;
593  if (ExplicitTy != getSourceElementTypeIfValid(CE))
594  return false;
595  return true;
596  }
597 
598  unsigned getHash() const {
599  return hash_combine(
600  Opcode, SubclassOptionalData, SubclassData,
601  hash_combine_range(Ops.begin(), Ops.end()),
602  hash_combine_range(Indexes.begin(), Indexes.end()),
603  hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
604  }
605 
607 
609  switch (Opcode) {
610  default:
611  if (Instruction::isCast(Opcode) ||
612  (Opcode >= Instruction::UnaryOpsBegin &&
613  Opcode < Instruction::UnaryOpsEnd))
614  return new UnaryConstantExpr(Opcode, Ops[0], Ty);
615  if ((Opcode >= Instruction::BinaryOpsBegin &&
616  Opcode < Instruction::BinaryOpsEnd))
617  return new BinaryConstantExpr(Opcode, Ops[0], Ops[1],
618  SubclassOptionalData);
619  llvm_unreachable("Invalid ConstantExpr!");
620  case Instruction::Select:
621  return new SelectConstantExpr(Ops[0], Ops[1], Ops[2]);
622  case Instruction::ExtractElement:
623  return new ExtractElementConstantExpr(Ops[0], Ops[1]);
624  case Instruction::InsertElement:
625  return new InsertElementConstantExpr(Ops[0], Ops[1], Ops[2]);
626  case Instruction::ShuffleVector:
627  return new ShuffleVectorConstantExpr(Ops[0], Ops[1], ShuffleMask);
628  case Instruction::InsertValue:
629  return new InsertValueConstantExpr(Ops[0], Ops[1], Indexes, Ty);
630  case Instruction::ExtractValue:
631  return new ExtractValueConstantExpr(Ops[0], Indexes, Ty);
632  case Instruction::GetElementPtr:
633  return GetElementPtrConstantExpr::Create(ExplicitTy, Ops[0], Ops.slice(1),
634  Ty, SubclassOptionalData);
635  case Instruction::ICmp:
636  return new CompareConstantExpr(Ty, Instruction::ICmp, SubclassData,
637  Ops[0], Ops[1]);
638  case Instruction::FCmp:
639  return new CompareConstantExpr(Ty, Instruction::FCmp, SubclassData,
640  Ops[0], Ops[1]);
641  }
642  }
643 };
644 
645 // Free memory for a given constant. Assumes the constant has already been
646 // removed from all relevant maps.
647 void deleteConstant(Constant *C);
648 
649 template <class ConstantClass> class ConstantUniqueMap {
650 public:
653  using LookupKey = std::pair<TypeClass *, ValType>;
654 
655  /// Key and hash together, so that we compute the hash only once and reuse it.
656  using LookupKeyHashed = std::pair<unsigned, LookupKey>;
657 
658 private:
659  struct MapInfo {
660  using ConstantClassInfo = DenseMapInfo<ConstantClass *>;
661 
662  static inline ConstantClass *getEmptyKey() {
663  return ConstantClassInfo::getEmptyKey();
664  }
665 
666  static inline ConstantClass *getTombstoneKey() {
667  return ConstantClassInfo::getTombstoneKey();
668  }
669 
670  static unsigned getHashValue(const ConstantClass *CP) {
672  return getHashValue(LookupKey(CP->getType(), ValType(CP, Storage)));
673  }
674 
675  static bool isEqual(const ConstantClass *LHS, const ConstantClass *RHS) {
676  return LHS == RHS;
677  }
678 
679  static unsigned getHashValue(const LookupKey &Val) {
680  return hash_combine(Val.first, Val.second.getHash());
681  }
682 
683  static unsigned getHashValue(const LookupKeyHashed &Val) {
684  return Val.first;
685  }
686 
687  static bool isEqual(const LookupKey &LHS, const ConstantClass *RHS) {
688  if (RHS == getEmptyKey() || RHS == getTombstoneKey())
689  return false;
690  if (LHS.first != RHS->getType())
691  return false;
692  return LHS.second == RHS;
693  }
694 
695  static bool isEqual(const LookupKeyHashed &LHS, const ConstantClass *RHS) {
696  return isEqual(LHS.second, RHS);
697  }
698  };
699 
700 public:
702 
703 private:
704  MapTy Map;
705 
706 public:
707  typename MapTy::iterator begin() { return Map.begin(); }
708  typename MapTy::iterator end() { return Map.end(); }
709 
710  void freeConstants() {
711  for (auto &I : Map)
712  deleteConstant(I);
713  }
714 
715 private:
716  ConstantClass *create(TypeClass *Ty, ValType V, LookupKeyHashed &HashKey) {
717  ConstantClass *Result = V.create(Ty);
718 
719  assert(Result->getType() == Ty && "Type specified is not correct!");
720  Map.insert_as(Result, HashKey);
721 
722  return Result;
723  }
724 
725 public:
726  /// Return the specified constant from the map, creating it if necessary.
727  ConstantClass *getOrCreate(TypeClass *Ty, ValType V) {
728  LookupKey Key(Ty, V);
729  /// Hash once, and reuse it for the lookup and the insertion if needed.
730  LookupKeyHashed Lookup(MapInfo::getHashValue(Key), Key);
731 
732  ConstantClass *Result = nullptr;
733 
734  auto I = Map.find_as(Lookup);
735  if (I == Map.end())
736  Result = create(Ty, V, Lookup);
737  else
738  Result = *I;
739  assert(Result && "Unexpected nullptr");
740 
741  return Result;
742  }
743 
744  /// Remove this constant from the map
745  void remove(ConstantClass *CP) {
746  typename MapTy::iterator I = Map.find(CP);
747  assert(I != Map.end() && "Constant not found in constant table!");
748  assert(*I == CP && "Didn't find correct element?");
749  Map.erase(I);
750  }
751 
753  ConstantClass *CP, Value *From,
754  Constant *To, unsigned NumUpdated = 0,
755  unsigned OperandNo = ~0u) {
756  LookupKey Key(CP->getType(), ValType(Operands, CP));
757  /// Hash once, and reuse it for the lookup and the insertion if needed.
758  LookupKeyHashed Lookup(MapInfo::getHashValue(Key), Key);
759 
760  auto ItMap = Map.find_as(Lookup);
761  if (ItMap != Map.end())
762  return *ItMap;
763 
764  // Update to the new value. Optimize for the case when we have a single
765  // operand that we're changing, but handle bulk updates efficiently.
766  remove(CP);
767  if (NumUpdated == 1) {
768  assert(OperandNo < CP->getNumOperands() && "Invalid index");
769  assert(CP->getOperand(OperandNo) != To && "I didn't contain From!");
770  CP->setOperand(OperandNo, To);
771  } else {
772  for (unsigned I = 0, E = CP->getNumOperands(); I != E; ++I)
773  if (CP->getOperand(I) == From)
774  CP->setOperand(I, To);
775  }
776  Map.insert_as(CP, Lookup);
777  return nullptr;
778  }
779 
780  void dump() const {
781  LLVM_DEBUG(dbgs() << "Constant.cpp: ConstantUniqueMap\n");
782  }
783 };
784 
786  for (auto &I : Map)
787  delete I;
788 }
789 
790 } // end namespace llvm
791 
792 #endif // LLVM_LIB_IR_CONSTANTSCONTEXT_H
llvm::CompareConstantExpr::CompareConstantExpr
CompareConstantExpr(Type *ty, Instruction::OtherOps opc, unsigned short pred, Constant *LHS, Constant *RHS)
Definition: ConstantsContext.h:318
llvm::ShuffleVectorConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::ConstantAggrKeyType::operator==
bool operator==(const ConstantAggrKeyType &X) const
Definition: ConstantsContext.h:435
llvm::ExtractValueConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:242
llvm::InlineAsmKeyType::IsAlignStack
bool IsAlignStack
Definition: ConstantsContext.h:464
llvm::ConstantExprKeyType::ConstantExprKeyType
ConstantExprKeyType(unsigned Opcode, ArrayRef< Constant * > Ops, unsigned short SubclassData=0, unsigned short SubclassOptionalData=0, ArrayRef< unsigned > Indexes=None, ArrayRef< int > ShuffleMask=None, Type *ExplicitTy=nullptr)
Definition: ConstantsContext.h:540
llvm::cast
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
Definition: Casting.h:254
llvm::UnaryConstantExpr::UnaryConstantExpr
UnaryConstantExpr(unsigned Opcode, Constant *C, Type *Ty)
Definition: ConstantsContext.h:48
llvm::ScalableVectorType
Class to represent scalable SIMD vectors.
Definition: DerivedTypes.h:574
llvm::InsertValueConstantExpr::Indices
const SmallVector< unsigned, 4 > Indices
Indices - These identify the position for the insertion.
Definition: ConstantsContext.h:266
llvm
Definition: AllocatorList.h:23
llvm::CompareConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::InlineAsm::AsmDialect
AsmDialect
Definition: InlineAsm.h:33
llvm::deleteConstant
void deleteConstant(Constant *C)
Definition: Constants.cpp:500
llvm::ConstantAggrKeyType::TypeClass
typename ConstantInfo< ConstantClass >::TypeClass TypeClass
Definition: ConstantsContext.h:452
llvm::Value::SubclassOptionalData
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
Definition: Value.h:91
llvm::ConstantUniqueMap::replaceOperandsInPlace
ConstantClass * replaceOperandsInPlace(ArrayRef< Constant * > Operands, ConstantClass *CP, Value *From, Constant *To, unsigned NumUpdated=0, unsigned OperandNo=~0u)
Definition: ConstantsContext.h:752
llvm::InlineAsmKeyType::InlineAsmKeyType
InlineAsmKeyType(StringRef AsmString, StringRef Constraints, FunctionType *FTy, bool HasSideEffects, bool IsAlignStack, InlineAsm::AsmDialect AsmDialect, bool canThrow)
Definition: ConstantsContext.h:468
llvm::Instruction::isCast
bool isCast() const
Definition: Instruction.h:168
StringRef.h
llvm::VariadicOperandTraits
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
Definition: OperandTraits.h:68
llvm::ConstantExprKeyType::getHash
unsigned getHash() const
Definition: ConstantsContext.h:598
C1
instcombine should handle this C2 when C1
Definition: README.txt:263
llvm::SmallVector< int, 4 >
InlineAsm.h
llvm::isa
LLVM_NODISCARD bool isa(const Y &Val)
Definition: Casting.h:141
ErrorHandling.h
llvm::CompareConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:337
llvm::InsertValueConstantExpr::InsertValueConstantExpr
InsertValueConstantExpr(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList, Type *DestTy)
Definition: ConstantsContext.h:252
llvm::GetElementPtrConstantExpr
GetElementPtrConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to ...
Definition: ConstantsContext.h:281
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:233
DEFINE_TRANSPARENT_OPERAND_ACCESSORS
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
Definition: OperandTraits.h:125
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:224
llvm::ExtractValueConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::ExtractElementConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:144
llvm::BinaryConstantExpr::BinaryConstantExpr
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2, unsigned Flags)
Definition: ConstantsContext.h:73
llvm::UnaryConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:64
llvm::ExtractElementConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:147
llvm::ShuffleVectorInst::isValidOperands
static bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
Return true if a shufflevector instruction can be formed with the specified operands.
Definition: Instructions.cpp:2002
Hashing.h
llvm::ConstantUniqueMap< llvm::ConstantExpr >::ValType
typename ConstantInfo< llvm::ConstantExpr >::ValType ValType
Definition: ConstantsContext.h:651
llvm::InsertValueConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:274
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:359
llvm::ConstantUniqueMap::dump
void dump() const
Definition: ConstantsContext.h:780
llvm::BitmaskEnumDetail::Mask
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
llvm::ConstantAggrKeyType::Operands
ArrayRef< Constant * > Operands
Definition: ConstantsContext.h:420
llvm::isEqual
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
Definition: GCNRegPressure.cpp:55
llvm::InlineAsmKeyType::AsmDialect
InlineAsm::AsmDialect AsmDialect
Definition: ConstantsContext.h:465
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:122
llvm::InlineAsmKeyType::InlineAsmKeyType
InlineAsmKeyType(const InlineAsm *Asm, SmallVectorImpl< Constant * > &)
Definition: ConstantsContext.h:475
llvm::BinaryConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:92
llvm::ConstantExprKeyType::operator==
bool operator==(const ConstantExpr *CE) const
Definition: ConstantsContext.h:577
llvm::ConstantAggrKeyType::operator==
bool operator==(const ConstantClass *C) const
Definition: ConstantsContext.h:439
llvm::ExtractValueConstantExpr::ExtractValueConstantExpr
ExtractValueConstantExpr(Constant *Agg, ArrayRef< unsigned > IdxList, Type *DestTy)
Definition: ConstantsContext.h:221
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::ConstantInfo
Definition: ConstantsContext.h:397
Instruction.h
llvm::DenseMapInfo
Definition: APInt.h:34
llvm::InlineAsmKeyType::TypeClass
ConstantInfo< InlineAsm >::TypeClass TypeClass
Definition: ConstantsContext.h:502
llvm::ConstantAggrKeyType::ConstantAggrKeyType
ConstantAggrKeyType(ArrayRef< Constant * > Operands, const ConstantClass *)
Definition: ConstantsContext.h:424
llvm::UnaryConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:60
llvm::OperandTraits
Compile-time customization of User operands.
Definition: User.h:42
Constants.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::InlineAsmKeyType
Definition: ConstantsContext.h:459
llvm::ConstantExprKeyType::TypeClass
ConstantInfo< ConstantExpr >::TypeClass TypeClass
Definition: ConstantsContext.h:606
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::ConstantExprKeyType::create
ConstantExpr * create(TypeClass *Ty) const
Definition: ConstantsContext.h:608
llvm::ShuffleVectorConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:211
llvm::UnaryConstantExpr
UnaryConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to implemen...
Definition: ConstantsContext.h:46
llvm::ConstantUniqueMap::end
MapTy::iterator end()
Definition: ConstantsContext.h:708
canThrow
static bool canThrow(const Value *V)
Definition: WebAssemblyLowerEmscriptenEHSjLj.cpp:280
getOpcode
static Optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
Definition: VPlanSLP.cpp:199
llvm::Instruction::OtherOps
OtherOps
Definition: Instruction.h:796
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
DenseSet.h
llvm::ConstantArray
ConstantArray - Constant Array Declarations.
Definition: Constants.h:407
llvm::BinaryConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:89
llvm::ExtractValueConstantExpr::Indices
const SmallVector< unsigned, 4 > Indices
Indices - These identify which value to extract.
Definition: ConstantsContext.h:234
llvm::Instruction
Definition: Instruction.h:45
llvm::InsertValueConstantExpr
InsertValueConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to im...
Definition: ConstantsContext.h:250
llvm::ShuffleVectorConstantExpr
ShuffleVectorConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to ...
Definition: ConstantsContext.h:184
OperandTraits.h
llvm::GetElementPtrConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:307
llvm::UnaryConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
llvm::ExtractValueConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:239
llvm::ExtractElementConstantExpr::ExtractElementConstantExpr
ExtractElementConstantExpr(Constant *C1, Constant *C2)
Definition: ConstantsContext.h:129
llvm::SelectConstantExpr
SelectConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to impleme...
Definition: ConstantsContext.h:99
llvm::ArrayRef::slice
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Definition: ArrayRef.h:193
llvm::ConstantUniqueMap::begin
MapTy::iterator begin()
Definition: ConstantsContext.h:707
llvm::None
const NoneType None
Definition: None.h:23
llvm::InsertElementConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:173
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
Operands
mir Rename Register Operands
Definition: MIRNamerPass.cpp:78
llvm::ShuffleVectorConstantExpr::ShuffleMaskForBitcode
Constant * ShuffleMaskForBitcode
Definition: ConstantsContext.h:201
llvm::InlineAsm
Definition: InlineAsm.h:31
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:391
llvm::ShuffleVectorConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:208
llvm::DenseSet< llvm::ConstantExpr *, MapInfo >
llvm::ConstantAggrKeyType::create
ConstantClass * create(TypeClass *Ty) const
Definition: ConstantsContext.h:454
llvm::InlineAsmKeyType::CanThrow
bool CanThrow
Definition: ConstantsContext.h:466
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::PointerType::getUnqual
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Definition: DerivedTypes.h:653
llvm::ConstantAggrKeyType
Definition: Constants.h:44
llvm::GetElementPtrConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:304
llvm::InsertValueConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::GetElementPtrConstantExpr::getSourceElementType
Type * getSourceElementType() const
Definition: Constants.cpp:2884
llvm::CompareConstantExpr::predicate
unsigned short predicate
Definition: ConstantsContext.h:317
llvm::ConstantExpr::get
static Constant * get(unsigned Opcode, Constant *C1, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)
get - Return a unary operator constant expression, folding if possible.
Definition: Constants.cpp:2255
llvm::InlineAsmKeyType::operator==
bool operator==(const InlineAsm *Asm) const
Definition: ConstantsContext.h:488
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::ExtractValueConstantExpr
ExtractValueConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to i...
Definition: ConstantsContext.h:219
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:634
ArrayRef.h
llvm::ConstantUniqueMap::getOrCreate
ConstantClass * getOrCreate(TypeClass *Ty, ValType V)
Return the specified constant from the map, creating it if necessary.
Definition: ConstantsContext.h:727
llvm::CompareConstantExpr
Definition: ConstantsContext.h:315
llvm::ConstantAggrKeyType::ConstantAggrKeyType
ConstantAggrKeyType(const ConstantClass *C, SmallVectorImpl< Constant * > &Storage)
Definition: ConstantsContext.h:427
llvm::ConstantVector
Constant Vector Declarations.
Definition: Constants.h:492
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::InlineAsmKeyType::HasSideEffects
bool HasSideEffects
Definition: ConstantsContext.h:463
llvm::InlineAsmKeyType::Constraints
StringRef Constraints
Definition: ConstantsContext.h:461
llvm::InlineAsmKeyType::operator==
bool operator==(const InlineAsmKeyType &X) const
Definition: ConstantsContext.h:481
llvm::InsertElementConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::Instruction::isBinaryOp
bool isBinaryOp() const
Definition: Instruction.h:165
llvm::ConstantUniqueMap< llvm::ConstantExpr >::TypeClass
typename ConstantInfo< llvm::ConstantExpr >::TypeClass TypeClass
Definition: ConstantsContext.h:652
llvm::InsertValueConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:271
llvm::ConstantStruct
Definition: Constants.h:439
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1463
llvm::SelectConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:116
llvm::InsertElementConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:176
llvm::ShuffleVectorConstantExpr::ShuffleVectorConstantExpr
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, ArrayRef< int > Mask)
Definition: ConstantsContext.h:186
llvm::ArrayRef< int >
None.h
llvm::StructType
Class to represent struct types.
Definition: DerivedTypes.h:212
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::ConstantUniqueMap< llvm::ConstantExpr >::LookupKeyHashed
std::pair< unsigned, LookupKey > LookupKeyHashed
Key and hash together, so that we compute the hash only once and reuse it.
Definition: ConstantsContext.h:656
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
llvm::CompareConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:333
llvm::ConstantExprKeyType
Definition: ConstantsContext.h:511
llvm::InlineAsmKeyType::create
InlineAsm * create(TypeClass *Ty) const
Definition: ConstantsContext.h:504
llvm::ConstantAggrKeyType::ConstantAggrKeyType
ConstantAggrKeyType(ArrayRef< Constant * > Operands)
Definition: ConstantsContext.h:422
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:162
llvm::HexagonISD::CP
@ CP
Definition: HexagonISelLowering.h:53
llvm::SelectConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
Constant.h
llvm::ConstantExpr
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:931
llvm::PPC::getPredicate
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
Definition: PPCPredicates.h:87
llvm::InlineAsmKeyType::FTy
FunctionType * FTy
Definition: ConstantsContext.h:462
uint16_t
llvm::SmallVectorImpl::assign
void assign(size_type NumElts, ValueParamT Elt)
Definition: SmallVector.h:669
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:151
Casting.h
llvm::ConstantUniqueMap::remove
void remove(ConstantClass *CP)
Remove this constant from the map.
Definition: ConstantsContext.h:745
llvm::InlineAsmKeyType::getHash
unsigned getHash() const
Definition: ConstantsContext.h:497
Lookup
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
Definition: X86FloatingPoint.cpp:599
llvm::SelectConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:119
llvm::ExtractElementConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::GetElementPtrConstantExpr::getResultElementType
Type * getResultElementType() const
Definition: Constants.cpp:2888
llvm::BinaryConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
Instructions.h
llvm::InsertElementConstantExpr
InsertElementConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to ...
Definition: ConstantsContext.h:155
SmallVector.h
llvm::hash_combine
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition: Hashing.h:604
llvm::hash_combine_range
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition: Hashing.h:482
llvm::BinaryConstantExpr
BinaryConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to impleme...
Definition: ConstantsContext.h:71
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::Instruction::isUnaryOp
bool isUnaryOp() const
Definition: Instruction.h:164
llvm::FixedNumOperandTraits
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
Definition: OperandTraits.h:30
llvm::ConstantUniqueMap< llvm::ConstantExpr >::LookupKey
std::pair< TypeClass *, ValType > LookupKey
Definition: ConstantsContext.h:653
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
DenseMapInfo.h
llvm::SelectConstantExpr::SelectConstantExpr
SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3)
Definition: ConstantsContext.h:101
DerivedTypes.h
llvm::InlineAsmKeyType::AsmString
StringRef AsmString
Definition: ConstantsContext.h:460
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
pred
hexagon gen pred
Definition: HexagonGenPredicate.cpp:134
llvm::User::Op
Use & Op()
Definition: User.h:133
llvm::GetElementPtrConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
raw_ostream.h
llvm::ShuffleVectorConstantExpr::ShuffleMask
SmallVector< int, 4 > ShuffleMask
Definition: ConstantsContext.h:200
llvm::ConstantAggrKeyType::getHash
unsigned getHash() const
Definition: ConstantsContext.h:448
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
Debug.h
llvm::ConstantExprKeyType::ConstantExprKeyType
ConstantExprKeyType(ArrayRef< Constant * > Operands, const ConstantExpr *CE)
Definition: ConstantsContext.h:550
llvm::ConstantExprKeyType::ConstantExprKeyType
ConstantExprKeyType(const ConstantExpr *CE, SmallVectorImpl< Constant * > &Storage)
Definition: ConstantsContext.h:557
llvm::ShuffleVectorInst::convertShuffleMaskForBitcode
static Constant * convertShuffleMaskForBitcode(ArrayRef< int > Mask, Type *ResultTy)
Definition: Instructions.cpp:2082
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:152
llvm::InsertElementConstantExpr::InsertElementConstantExpr
InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3)
Definition: ConstantsContext.h:157
llvm::ConstantUniqueMap::freeConstants
void freeConstants()
Definition: ConstantsContext.h:710
llvm::detail::DenseSetImpl< llvm::ConstantExpr *, DenseMap< llvm::ConstantExpr *, detail::DenseSetEmpty, MapInfo, detail::DenseSetPair< llvm::ConstantExpr * > >, MapInfo >::iterator
Iterator iterator
Definition: DenseSet.h:170
llvm::ExtractElementConstantExpr
ExtractElementConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to...
Definition: ConstantsContext.h:127
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:102
llvm::GetElementPtrConstantExpr::Create
static GetElementPtrConstantExpr * Create(Type *SrcElementTy, Constant *C, ArrayRef< Constant * > IdxList, Type *DestTy, unsigned Flags)
Definition: ConstantsContext.h:289
llvm::ConstantExprKeyType::operator==
bool operator==(const ConstantExprKeyType &X) const
Definition: ConstantsContext.h:570