LLVM  14.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) { return User::operator new(S, 1); }
55  void operator delete(void *Ptr) { User::operator delete(Ptr); }
56 
58 
59  static bool classof(const ConstantExpr *CE) {
60  return Instruction::isCast(CE->getOpcode()) ||
61  Instruction::isUnaryOp(CE->getOpcode());
62  }
63  static bool classof(const Value *V) {
64  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
65  }
66 };
67 
68 /// BinaryConstantExpr - This class is private to Constants.cpp, and is used
69 /// behind the scenes to implement binary constant exprs.
70 class BinaryConstantExpr final : public ConstantExpr {
71 public:
72  BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2,
73  unsigned Flags)
74  : ConstantExpr(C1->getType(), Opcode, &Op<0>(), 2) {
75  Op<0>() = C1;
76  Op<1>() = C2;
77  SubclassOptionalData = Flags;
78  }
79 
80  // allocate space for exactly two operands
81  void *operator new(size_t S) { return User::operator new(S, 2); }
82  void operator delete(void *Ptr) { User::operator delete(Ptr); }
83 
84  /// Transparently provide more efficient getOperand methods.
86 
87  static bool classof(const ConstantExpr *CE) {
88  return Instruction::isBinaryOp(CE->getOpcode());
89  }
90  static bool classof(const Value *V) {
91  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
92  }
93 };
94 
95 /// SelectConstantExpr - This class is private to Constants.cpp, and is used
96 /// behind the scenes to implement select constant exprs.
97 class SelectConstantExpr final : public ConstantExpr {
98 public:
100  : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) {
101  Op<0>() = C1;
102  Op<1>() = C2;
103  Op<2>() = C3;
104  }
105 
106  // allocate space for exactly three operands
107  void *operator new(size_t S) { return User::operator new(S, 3); }
108  void operator delete(void *Ptr) { User::operator delete(Ptr); }
109 
110  /// Transparently provide more efficient getOperand methods.
112 
113  static bool classof(const ConstantExpr *CE) {
114  return CE->getOpcode() == Instruction::Select;
115  }
116  static bool classof(const Value *V) {
117  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
118  }
119 };
120 
121 /// ExtractElementConstantExpr - This class is private to
122 /// Constants.cpp, and is used behind the scenes to implement
123 /// extractelement constant exprs.
125 public:
127  : ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
128  Instruction::ExtractElement, &Op<0>(), 2) {
129  Op<0>() = C1;
130  Op<1>() = C2;
131  }
132 
133  // allocate space for exactly two operands
134  void *operator new(size_t S) { return User::operator new(S, 2); }
135  void operator delete(void *Ptr) { User::operator delete(Ptr); }
136 
137  /// Transparently provide more efficient getOperand methods.
139 
140  static bool classof(const ConstantExpr *CE) {
141  return CE->getOpcode() == Instruction::ExtractElement;
142  }
143  static bool classof(const Value *V) {
144  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
145  }
146 };
147 
148 /// InsertElementConstantExpr - This class is private to
149 /// Constants.cpp, and is used behind the scenes to implement
150 /// insertelement constant exprs.
152 public:
154  : ConstantExpr(C1->getType(), Instruction::InsertElement,
155  &Op<0>(), 3) {
156  Op<0>() = C1;
157  Op<1>() = C2;
158  Op<2>() = C3;
159  }
160 
161  // allocate space for exactly three operands
162  void *operator new(size_t S) { return User::operator new(S, 3); }
163  void operator delete(void *Ptr) { User::operator delete(Ptr); }
164 
165  /// Transparently provide more efficient getOperand methods.
167 
168  static bool classof(const ConstantExpr *CE) {
169  return CE->getOpcode() == Instruction::InsertElement;
170  }
171  static bool classof(const Value *V) {
172  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
173  }
174 };
175 
176 /// ShuffleVectorConstantExpr - This class is private to
177 /// Constants.cpp, and is used behind the scenes to implement
178 /// shufflevector constant exprs.
180 public:
183  cast<VectorType>(C1->getType())->getElementType(),
185  Instruction::ShuffleVector, &Op<0>(), 2) {
187  "Invalid shuffle vector instruction operands!");
188  Op<0>() = C1;
189  Op<1>() = C2;
190  ShuffleMask.assign(Mask.begin(), Mask.end());
193  }
194 
197 
198  void *operator new(size_t S) { return User::operator new(S, 2); }
199  void operator delete(void *Ptr) { return User::operator delete(Ptr); }
200 
201  /// Transparently provide more efficient getOperand methods.
203 
204  static bool classof(const ConstantExpr *CE) {
205  return CE->getOpcode() == Instruction::ShuffleVector;
206  }
207  static bool classof(const Value *V) {
208  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
209  }
210 };
211 
212 /// ExtractValueConstantExpr - This class is private to
213 /// Constants.cpp, and is used behind the scenes to implement
214 /// extractvalue constant exprs.
216 public:
218  Type *DestTy)
219  : ConstantExpr(DestTy, Instruction::ExtractValue, &Op<0>(), 1),
220  Indices(IdxList.begin(), IdxList.end()) {
221  Op<0>() = Agg;
222  }
223 
224  // allocate space for exactly one operand
225  void *operator new(size_t S) { return User::operator new(S, 1); }
226  void operator delete(void *Ptr) { User::operator delete(Ptr); }
227 
228  /// Indices - These identify which value to extract.
230 
231  /// Transparently provide more efficient getOperand methods.
233 
234  static bool classof(const ConstantExpr *CE) {
235  return CE->getOpcode() == Instruction::ExtractValue;
236  }
237  static bool classof(const Value *V) {
238  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
239  }
240 };
241 
242 /// InsertValueConstantExpr - This class is private to
243 /// Constants.cpp, and is used behind the scenes to implement
244 /// insertvalue constant exprs.
245 class InsertValueConstantExpr final : public ConstantExpr {
246 public:
248  ArrayRef<unsigned> IdxList, Type *DestTy)
249  : ConstantExpr(DestTy, Instruction::InsertValue, &Op<0>(), 2),
250  Indices(IdxList.begin(), IdxList.end()) {
251  Op<0>() = Agg;
252  Op<1>() = Val;
253  }
254 
255  // allocate space for exactly one operand
256  void *operator new(size_t S) { return User::operator new(S, 2); }
257  void operator delete(void *Ptr) { User::operator delete(Ptr); }
258 
259  /// Indices - These identify the position for the insertion.
261 
262  /// Transparently provide more efficient getOperand methods.
264 
265  static bool classof(const ConstantExpr *CE) {
266  return CE->getOpcode() == Instruction::InsertValue;
267  }
268  static bool classof(const Value *V) {
269  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
270  }
271 };
272 
273 /// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is
274 /// used behind the scenes to implement getelementpr constant exprs.
276  Type *SrcElementTy;
277  Type *ResElementTy;
278 
279  GetElementPtrConstantExpr(Type *SrcElementTy, Constant *C,
280  ArrayRef<Constant *> IdxList, Type *DestTy);
281 
282 public:
283  static GetElementPtrConstantExpr *Create(Type *SrcElementTy, Constant *C,
284  ArrayRef<Constant *> IdxList,
285  Type *DestTy, unsigned Flags) {
286  GetElementPtrConstantExpr *Result = new (IdxList.size() + 1)
287  GetElementPtrConstantExpr(SrcElementTy, C, IdxList, DestTy);
288  Result->SubclassOptionalData = Flags;
289  return Result;
290  }
291 
292  Type *getSourceElementType() const;
293  Type *getResultElementType() const;
294 
295  /// Transparently provide more efficient getOperand methods.
297 
298  static bool classof(const ConstantExpr *CE) {
299  return CE->getOpcode() == Instruction::GetElementPtr;
300  }
301  static bool classof(const Value *V) {
302  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
303  }
304 };
305 
306 // CompareConstantExpr - This class is private to Constants.cpp, and is used
307 // behind the scenes to implement ICmp and FCmp constant expressions. This is
308 // needed in order to store the predicate value for these instructions.
309 class CompareConstantExpr final : public ConstantExpr {
310 public:
311  unsigned short predicate;
313  unsigned short pred, Constant* LHS, Constant* RHS)
314  : ConstantExpr(ty, opc, &Op<0>(), 2), predicate(pred) {
315  Op<0>() = LHS;
316  Op<1>() = RHS;
317  }
318 
319  // allocate space for exactly two operands
320  void *operator new(size_t S) { return User::operator new(S, 2); }
321  void operator delete(void *Ptr) { return User::operator delete(Ptr); }
322 
323  /// Transparently provide more efficient getOperand methods.
325 
326  static bool classof(const ConstantExpr *CE) {
327  return CE->getOpcode() == Instruction::ICmp ||
328  CE->getOpcode() == Instruction::FCmp;
329  }
330  static bool classof(const Value *V) {
331  return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
332  }
333 };
334 
335 template <>
337  : public FixedNumOperandTraits<UnaryConstantExpr, 1> {};
339 
340 template <>
342  : public FixedNumOperandTraits<BinaryConstantExpr, 2> {};
344 
345 template <>
347  : public FixedNumOperandTraits<SelectConstantExpr, 3> {};
349 
350 template <>
352  : public FixedNumOperandTraits<ExtractElementConstantExpr, 2> {};
354 
355 template <>
357  : public FixedNumOperandTraits<InsertElementConstantExpr, 3> {};
359 
360 template <>
362  : public FixedNumOperandTraits<ShuffleVectorConstantExpr, 2> {};
364 
365 template <>
367  : public FixedNumOperandTraits<ExtractValueConstantExpr, 1> {};
369 
370 template <>
372  : public FixedNumOperandTraits<InsertValueConstantExpr, 2> {};
374 
375 template <>
377  : public VariadicOperandTraits<GetElementPtrConstantExpr, 1> {};
378 
380 
381 template <>
383  : public FixedNumOperandTraits<CompareConstantExpr, 2> {};
385 
386 template <class ConstantClass> struct ConstantAggrKeyType;
387 struct InlineAsmKeyType;
388 struct ConstantExprKeyType;
389 
390 template <class ConstantClass> struct ConstantInfo;
391 template <> struct ConstantInfo<ConstantExpr> {
393  using TypeClass = Type;
394 };
395 template <> struct ConstantInfo<InlineAsm> {
398 };
399 template <> struct ConstantInfo<ConstantArray> {
402 };
403 template <> struct ConstantInfo<ConstantStruct> {
406 };
407 template <> struct ConstantInfo<ConstantVector> {
410 };
411 
412 template <class ConstantClass> struct ConstantAggrKeyType {
414 
416 
418  : Operands(Operands) {}
419 
420  ConstantAggrKeyType(const ConstantClass *C,
421  SmallVectorImpl<Constant *> &Storage) {
422  assert(Storage.empty() && "Expected empty storage");
423  for (unsigned I = 0, E = C->getNumOperands(); I != E; ++I)
424  Storage.push_back(C->getOperand(I));
425  Operands = Storage;
426  }
427 
428  bool operator==(const ConstantAggrKeyType &X) const {
429  return Operands == X.Operands;
430  }
431 
432  bool operator==(const ConstantClass *C) const {
433  if (Operands.size() != C->getNumOperands())
434  return false;
435  for (unsigned I = 0, E = Operands.size(); I != E; ++I)
436  if (Operands[I] != C->getOperand(I))
437  return false;
438  return true;
439  }
440 
441  unsigned getHash() const {
442  return hash_combine_range(Operands.begin(), Operands.end());
443  }
444 
446 
447  ConstantClass *create(TypeClass *Ty) const {
448  return new (Operands.size()) ConstantClass(Ty, Operands);
449  }
450 };
451 
459  bool CanThrow;
460 
467 
469  : AsmString(Asm->getAsmString()), Constraints(Asm->getConstraintString()),
470  FTy(Asm->getFunctionType()), HasSideEffects(Asm->hasSideEffects()),
471  IsAlignStack(Asm->isAlignStack()), AsmDialect(Asm->getDialect()),
472  CanThrow(Asm->canThrow()) {}
473 
474  bool operator==(const InlineAsmKeyType &X) const {
475  return HasSideEffects == X.HasSideEffects &&
476  IsAlignStack == X.IsAlignStack && AsmDialect == X.AsmDialect &&
477  AsmString == X.AsmString && Constraints == X.Constraints &&
478  FTy == X.FTy && CanThrow == X.CanThrow;
479  }
480 
481  bool operator==(const InlineAsm *Asm) const {
482  return HasSideEffects == Asm->hasSideEffects() &&
483  IsAlignStack == Asm->isAlignStack() &&
484  AsmDialect == Asm->getDialect() &&
485  AsmString == Asm->getAsmString() &&
486  Constraints == Asm->getConstraintString() &&
487  FTy == Asm->getFunctionType() && CanThrow == Asm->canThrow();
488  }
489 
490  unsigned getHash() const {
493  }
494 
496 
497  InlineAsm *create(TypeClass *Ty) const {
499  return new InlineAsm(FTy, std::string(AsmString), std::string(Constraints),
501  }
502 };
503 
505 private:
506  uint8_t Opcode;
507  uint8_t SubclassOptionalData;
508  uint16_t SubclassData;
510  ArrayRef<unsigned> Indexes;
511  ArrayRef<int> ShuffleMask;
512  Type *ExplicitTy;
513 
514  static ArrayRef<int> getShuffleMaskIfValid(const ConstantExpr *CE) {
515  if (CE->getOpcode() == Instruction::ShuffleVector)
516  return CE->getShuffleMask();
517  return None;
518  }
519 
520  static ArrayRef<unsigned> getIndicesIfValid(const ConstantExpr *CE) {
521  if (CE->hasIndices())
522  return CE->getIndices();
523  return None;
524  }
525 
526  static Type *getSourceElementTypeIfValid(const ConstantExpr *CE) {
527  if (auto *GEPCE = dyn_cast<GetElementPtrConstantExpr>(CE))
528  return GEPCE->getSourceElementType();
529  return nullptr;
530  }
531 
532 public:
534  unsigned short SubclassData = 0,
535  unsigned short SubclassOptionalData = 0,
536  ArrayRef<unsigned> Indexes = None,
537  ArrayRef<int> ShuffleMask = None,
538  Type *ExplicitTy = nullptr)
539  : Opcode(Opcode), SubclassOptionalData(SubclassOptionalData),
540  SubclassData(SubclassData), Ops(Ops), Indexes(Indexes),
541  ShuffleMask(ShuffleMask), ExplicitTy(ExplicitTy) {}
542 
544  : Opcode(CE->getOpcode()),
545  SubclassOptionalData(CE->getRawSubclassOptionalData()),
546  SubclassData(CE->isCompare() ? CE->getPredicate() : 0), Ops(Operands),
547  Indexes(getIndicesIfValid(CE)), ShuffleMask(getShuffleMaskIfValid(CE)),
548  ExplicitTy(getSourceElementTypeIfValid(CE)) {}
549 
552  : Opcode(CE->getOpcode()),
553  SubclassOptionalData(CE->getRawSubclassOptionalData()),
554  SubclassData(CE->isCompare() ? CE->getPredicate() : 0),
555  Indexes(getIndicesIfValid(CE)), ShuffleMask(getShuffleMaskIfValid(CE)),
556  ExplicitTy(getSourceElementTypeIfValid(CE)) {
557  assert(Storage.empty() && "Expected empty storage");
558  for (unsigned I = 0, E = CE->getNumOperands(); I != E; ++I)
559  Storage.push_back(CE->getOperand(I));
560  Ops = Storage;
561  }
562 
563  bool operator==(const ConstantExprKeyType &X) const {
564  return Opcode == X.Opcode && SubclassData == X.SubclassData &&
565  SubclassOptionalData == X.SubclassOptionalData && Ops == X.Ops &&
566  Indexes == X.Indexes && ShuffleMask == X.ShuffleMask &&
567  ExplicitTy == X.ExplicitTy;
568  }
569 
570  bool operator==(const ConstantExpr *CE) const {
571  if (Opcode != CE->getOpcode())
572  return false;
573  if (SubclassOptionalData != CE->getRawSubclassOptionalData())
574  return false;
575  if (Ops.size() != CE->getNumOperands())
576  return false;
577  if (SubclassData != (CE->isCompare() ? CE->getPredicate() : 0))
578  return false;
579  for (unsigned I = 0, E = Ops.size(); I != E; ++I)
580  if (Ops[I] != CE->getOperand(I))
581  return false;
582  if (Indexes != getIndicesIfValid(CE))
583  return false;
584  if (ShuffleMask != getShuffleMaskIfValid(CE))
585  return false;
586  if (ExplicitTy != getSourceElementTypeIfValid(CE))
587  return false;
588  return true;
589  }
590 
591  unsigned getHash() const {
592  return hash_combine(
593  Opcode, SubclassOptionalData, SubclassData,
594  hash_combine_range(Ops.begin(), Ops.end()),
595  hash_combine_range(Indexes.begin(), Indexes.end()),
596  hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
597  }
598 
600 
602  switch (Opcode) {
603  default:
604  if (Instruction::isCast(Opcode) ||
605  (Opcode >= Instruction::UnaryOpsBegin &&
606  Opcode < Instruction::UnaryOpsEnd))
607  return new UnaryConstantExpr(Opcode, Ops[0], Ty);
608  if ((Opcode >= Instruction::BinaryOpsBegin &&
609  Opcode < Instruction::BinaryOpsEnd))
610  return new BinaryConstantExpr(Opcode, Ops[0], Ops[1],
611  SubclassOptionalData);
612  llvm_unreachable("Invalid ConstantExpr!");
613  case Instruction::Select:
614  return new SelectConstantExpr(Ops[0], Ops[1], Ops[2]);
615  case Instruction::ExtractElement:
616  return new ExtractElementConstantExpr(Ops[0], Ops[1]);
617  case Instruction::InsertElement:
618  return new InsertElementConstantExpr(Ops[0], Ops[1], Ops[2]);
619  case Instruction::ShuffleVector:
620  return new ShuffleVectorConstantExpr(Ops[0], Ops[1], ShuffleMask);
621  case Instruction::InsertValue:
622  return new InsertValueConstantExpr(Ops[0], Ops[1], Indexes, Ty);
623  case Instruction::ExtractValue:
624  return new ExtractValueConstantExpr(Ops[0], Indexes, Ty);
625  case Instruction::GetElementPtr:
626  return GetElementPtrConstantExpr::Create(ExplicitTy, Ops[0], Ops.slice(1),
627  Ty, SubclassOptionalData);
628  case Instruction::ICmp:
629  return new CompareConstantExpr(Ty, Instruction::ICmp, SubclassData,
630  Ops[0], Ops[1]);
631  case Instruction::FCmp:
632  return new CompareConstantExpr(Ty, Instruction::FCmp, SubclassData,
633  Ops[0], Ops[1]);
634  }
635  }
636 };
637 
638 // Free memory for a given constant. Assumes the constant has already been
639 // removed from all relevant maps.
640 void deleteConstant(Constant *C);
641 
642 template <class ConstantClass> class ConstantUniqueMap {
643 public:
646  using LookupKey = std::pair<TypeClass *, ValType>;
647 
648  /// Key and hash together, so that we compute the hash only once and reuse it.
649  using LookupKeyHashed = std::pair<unsigned, LookupKey>;
650 
651 private:
652  struct MapInfo {
653  using ConstantClassInfo = DenseMapInfo<ConstantClass *>;
654 
655  static inline ConstantClass *getEmptyKey() {
656  return ConstantClassInfo::getEmptyKey();
657  }
658 
659  static inline ConstantClass *getTombstoneKey() {
660  return ConstantClassInfo::getTombstoneKey();
661  }
662 
663  static unsigned getHashValue(const ConstantClass *CP) {
665  return getHashValue(LookupKey(CP->getType(), ValType(CP, Storage)));
666  }
667 
668  static bool isEqual(const ConstantClass *LHS, const ConstantClass *RHS) {
669  return LHS == RHS;
670  }
671 
672  static unsigned getHashValue(const LookupKey &Val) {
673  return hash_combine(Val.first, Val.second.getHash());
674  }
675 
676  static unsigned getHashValue(const LookupKeyHashed &Val) {
677  return Val.first;
678  }
679 
680  static bool isEqual(const LookupKey &LHS, const ConstantClass *RHS) {
681  if (RHS == getEmptyKey() || RHS == getTombstoneKey())
682  return false;
683  if (LHS.first != RHS->getType())
684  return false;
685  return LHS.second == RHS;
686  }
687 
688  static bool isEqual(const LookupKeyHashed &LHS, const ConstantClass *RHS) {
689  return isEqual(LHS.second, RHS);
690  }
691  };
692 
693 public:
695 
696 private:
697  MapTy Map;
698 
699 public:
700  typename MapTy::iterator begin() { return Map.begin(); }
701  typename MapTy::iterator end() { return Map.end(); }
702 
703  void freeConstants() {
704  for (auto &I : Map)
705  deleteConstant(I);
706  }
707 
708 private:
709  ConstantClass *create(TypeClass *Ty, ValType V, LookupKeyHashed &HashKey) {
710  ConstantClass *Result = V.create(Ty);
711 
712  assert(Result->getType() == Ty && "Type specified is not correct!");
713  Map.insert_as(Result, HashKey);
714 
715  return Result;
716  }
717 
718 public:
719  /// Return the specified constant from the map, creating it if necessary.
720  ConstantClass *getOrCreate(TypeClass *Ty, ValType V) {
721  LookupKey Key(Ty, V);
722  /// Hash once, and reuse it for the lookup and the insertion if needed.
723  LookupKeyHashed Lookup(MapInfo::getHashValue(Key), Key);
724 
725  ConstantClass *Result = nullptr;
726 
727  auto I = Map.find_as(Lookup);
728  if (I == Map.end())
729  Result = create(Ty, V, Lookup);
730  else
731  Result = *I;
732  assert(Result && "Unexpected nullptr");
733 
734  return Result;
735  }
736 
737  /// Remove this constant from the map
738  void remove(ConstantClass *CP) {
739  typename MapTy::iterator I = Map.find(CP);
740  assert(I != Map.end() && "Constant not found in constant table!");
741  assert(*I == CP && "Didn't find correct element?");
742  Map.erase(I);
743  }
744 
746  ConstantClass *CP, Value *From,
747  Constant *To, unsigned NumUpdated = 0,
748  unsigned OperandNo = ~0u) {
749  LookupKey Key(CP->getType(), ValType(Operands, CP));
750  /// Hash once, and reuse it for the lookup and the insertion if needed.
751  LookupKeyHashed Lookup(MapInfo::getHashValue(Key), Key);
752 
753  auto ItMap = Map.find_as(Lookup);
754  if (ItMap != Map.end())
755  return *ItMap;
756 
757  // Update to the new value. Optimize for the case when we have a single
758  // operand that we're changing, but handle bulk updates efficiently.
759  remove(CP);
760  if (NumUpdated == 1) {
761  assert(OperandNo < CP->getNumOperands() && "Invalid index");
762  assert(CP->getOperand(OperandNo) != To && "I didn't contain From!");
763  CP->setOperand(OperandNo, To);
764  } else {
765  for (unsigned I = 0, E = CP->getNumOperands(); I != E; ++I)
766  if (CP->getOperand(I) == From)
767  CP->setOperand(I, To);
768  }
769  Map.insert_as(CP, Lookup);
770  return nullptr;
771  }
772 
773  void dump() const {
774  LLVM_DEBUG(dbgs() << "Constant.cpp: ConstantUniqueMap\n");
775  }
776 };
777 
779  for (auto &I : Map)
780  delete I;
781 }
782 
783 } // end namespace llvm
784 
785 #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:312
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:428
llvm::ExtractValueConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:237
llvm::InlineAsmKeyType::IsAlignStack
bool IsAlignStack
Definition: ConstantsContext.h:457
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:533
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:572
llvm::InsertValueConstantExpr::Indices
const SmallVector< unsigned, 4 > Indices
Indices - These identify the position for the insertion.
Definition: ConstantsContext.h:260
llvm
---------------------— PointerInfo ------------------------------------—
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:501
llvm::ConstantAggrKeyType::TypeClass
typename ConstantInfo< ConstantClass >::TypeClass TypeClass
Definition: ConstantsContext.h:445
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:745
llvm::InlineAsmKeyType::InlineAsmKeyType
InlineAsmKeyType(StringRef AsmString, StringRef Constraints, FunctionType *FTy, bool HasSideEffects, bool IsAlignStack, InlineAsm::AsmDialect AsmDialect, bool canThrow)
Definition: ConstantsContext.h:461
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:591
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:330
llvm::InsertValueConstantExpr::InsertValueConstantExpr
InsertValueConstantExpr(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList, Type *DestTy)
Definition: ConstantsContext.h:247
llvm::GetElementPtrConstantExpr
GetElementPtrConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to ...
Definition: ConstantsContext.h:275
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
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:140
llvm::BinaryConstantExpr::BinaryConstantExpr
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2, unsigned Flags)
Definition: ConstantsContext.h:72
llvm::UnaryConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:63
llvm::ExtractElementConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:143
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:2055
Hashing.h
llvm::ConstantUniqueMap< llvm::ConstantExpr >::ValType
typename ConstantInfo< llvm::ConstantExpr >::ValType ValType
Definition: ConstantsContext.h:644
llvm::InsertValueConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:268
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:357
llvm::ConstantUniqueMap::dump
void dump() const
Definition: ConstantsContext.h:773
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:413
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:458
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::InlineAsmKeyType::InlineAsmKeyType
InlineAsmKeyType(const InlineAsm *Asm, SmallVectorImpl< Constant * > &)
Definition: ConstantsContext.h:468
llvm::BinaryConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:90
llvm::ConstantExprKeyType::operator==
bool operator==(const ConstantExpr *CE) const
Definition: ConstantsContext.h:570
llvm::ConstantAggrKeyType::operator==
bool operator==(const ConstantClass *C) const
Definition: ConstantsContext.h:432
llvm::ExtractValueConstantExpr::ExtractValueConstantExpr
ExtractValueConstantExpr(Constant *Agg, ArrayRef< unsigned > IdxList, Type *DestTy)
Definition: ConstantsContext.h:217
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::ConstantInfo
Definition: ConstantsContext.h:390
Instruction.h
llvm::DenseMapInfo
Definition: APInt.h:34
llvm::InlineAsmKeyType::TypeClass
ConstantInfo< InlineAsm >::TypeClass TypeClass
Definition: ConstantsContext.h:495
llvm::ConstantAggrKeyType::ConstantAggrKeyType
ConstantAggrKeyType(ArrayRef< Constant * > Operands, const ConstantClass *)
Definition: ConstantsContext.h:417
llvm::UnaryConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:59
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:452
llvm::ConstantExprKeyType::TypeClass
ConstantInfo< ConstantExpr >::TypeClass TypeClass
Definition: ConstantsContext.h:599
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::ConstantExprKeyType::create
ConstantExpr * create(TypeClass *Ty) const
Definition: ConstantsContext.h:601
llvm::ShuffleVectorConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:207
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:701
canThrow
static bool canThrow(const Value *V)
Definition: WebAssemblyLowerEmscriptenEHSjLj.cpp:398
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:813
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
DenseSet.h
llvm::ConstantArray
ConstantArray - Constant Array Declarations.
Definition: Constants.h:409
llvm::BinaryConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:87
llvm::ExtractValueConstantExpr::Indices
const SmallVector< unsigned, 4 > Indices
Indices - These identify which value to extract.
Definition: ConstantsContext.h:229
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:245
llvm::ShuffleVectorConstantExpr
ShuffleVectorConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to ...
Definition: ConstantsContext.h:179
OperandTraits.h
llvm::GetElementPtrConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:301
llvm::UnaryConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
llvm::ExtractValueConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:234
llvm::ExtractElementConstantExpr::ExtractElementConstantExpr
ExtractElementConstantExpr(Constant *C1, Constant *C2)
Definition: ConstantsContext.h:126
llvm::SelectConstantExpr
SelectConstantExpr - This class is private to Constants.cpp, and is used behind the scenes to impleme...
Definition: ConstantsContext.h:97
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:195
llvm::ConstantUniqueMap::begin
MapTy::iterator begin()
Definition: ConstantsContext.h:700
llvm::None
const NoneType None
Definition: None.h:23
llvm::InsertElementConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:168
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:196
llvm::InlineAsm
Definition: InlineAsm.h:31
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
llvm::ShuffleVectorConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:204
llvm::DenseSet< llvm::ConstantExpr *, MapInfo >
llvm::ConstantAggrKeyType::create
ConstantClass * create(TypeClass *Ty) const
Definition: ConstantsContext.h:447
llvm::InlineAsmKeyType::CanThrow
bool CanThrow
Definition: ConstantsContext.h:459
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:651
llvm::ConstantAggrKeyType
Definition: Constants.h:44
llvm::GetElementPtrConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:298
llvm::InsertValueConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
llvm::GetElementPtrConstantExpr::getSourceElementType
Type * getSourceElementType() const
Definition: Constants.cpp:2871
llvm::CompareConstantExpr::predicate
unsigned short predicate
Definition: ConstantsContext.h:311
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:2242
llvm::InlineAsmKeyType::operator==
bool operator==(const InlineAsm *Asm) const
Definition: ConstantsContext.h:481
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:215
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:632
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:720
llvm::CompareConstantExpr
Definition: ConstantsContext.h:309
llvm::ConstantAggrKeyType::ConstantAggrKeyType
ConstantAggrKeyType(const ConstantClass *C, SmallVectorImpl< Constant * > &Storage)
Definition: ConstantsContext.h:420
llvm::ConstantVector
Constant Vector Declarations.
Definition: Constants.h:493
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::InlineAsmKeyType::HasSideEffects
bool HasSideEffects
Definition: ConstantsContext.h:456
llvm::InlineAsmKeyType::Constraints
StringRef Constraints
Definition: ConstantsContext.h:454
llvm::InlineAsmKeyType::operator==
bool operator==(const InlineAsmKeyType &X) const
Definition: ConstantsContext.h:474
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:645
llvm::InsertValueConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:265
llvm::ConstantStruct
Definition: Constants.h:441
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:1532
llvm::SelectConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:113
llvm::InsertElementConstantExpr::classof
static bool classof(const Value *V)
Definition: ConstantsContext.h:171
llvm::ShuffleVectorConstantExpr::ShuffleVectorConstantExpr
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, ArrayRef< int > Mask)
Definition: ConstantsContext.h:181
llvm::ArrayRef< int >
None.h
llvm::StructType
Class to represent struct types.
Definition: DerivedTypes.h:213
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
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:649
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
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::CompareConstantExpr::classof
static bool classof(const ConstantExpr *CE)
Definition: ConstantsContext.h:326
llvm::ConstantExprKeyType
Definition: ConstantsContext.h:504
llvm::InlineAsmKeyType::create
InlineAsm * create(TypeClass *Ty) const
Definition: ConstantsContext.h:497
llvm::ConstantAggrKeyType::ConstantAggrKeyType
ConstantAggrKeyType(ArrayRef< Constant * > Operands)
Definition: ConstantsContext.h:415
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:936
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:455
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:153
Casting.h
llvm::ConstantUniqueMap::remove
void remove(ConstantClass *CP)
Remove this constant from the map.
Definition: ConstantsContext.h:738
llvm::InlineAsmKeyType::getHash
unsigned getHash() const
Definition: ConstantsContext.h:490
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:116
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:2875
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:151
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:70
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
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:646
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:99
DerivedTypes.h
llvm::InlineAsmKeyType::AsmString
StringRef AsmString
Definition: ConstantsContext.h:453
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:195
llvm::ConstantAggrKeyType::getHash
unsigned getHash() const
Definition: ConstantsContext.h:441
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
Debug.h
llvm::ConstantExprKeyType::ConstantExprKeyType
ConstantExprKeyType(ArrayRef< Constant * > Operands, const ConstantExpr *CE)
Definition: ConstantsContext.h:543
llvm::ConstantExprKeyType::ConstantExprKeyType
ConstantExprKeyType(const ConstantExpr *CE, SmallVectorImpl< Constant * > &Storage)
Definition: ConstantsContext.h:550
llvm::ShuffleVectorInst::convertShuffleMaskForBitcode
static Constant * convertShuffleMaskForBitcode(ArrayRef< int > Mask, Type *ResultTy)
Definition: Instructions.cpp:2136
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:154
llvm::InsertElementConstantExpr::InsertElementConstantExpr
InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3)
Definition: ConstantsContext.h:153
llvm::ConstantUniqueMap::freeConstants
void freeConstants()
Definition: ConstantsContext.h:703
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:124
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::GetElementPtrConstantExpr::Create
static GetElementPtrConstantExpr * Create(Type *SrcElementTy, Constant *C, ArrayRef< Constant * > IdxList, Type *DestTy, unsigned Flags)
Definition: ConstantsContext.h:283
llvm::ConstantExprKeyType::operator==
bool operator==(const ConstantExprKeyType &X) const
Definition: ConstantsContext.h:563