1 //===- llvm/IR/UseListOrder.h - LLVM Use List Order -------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file has structures and command-line options for preserving use-list
11 // order.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_USELISTORDER_H
16 #define LLVM_IR_USELISTORDER_H
17 
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include <vector>
21 
22 namespace llvm {
23 
24 class Module;
25 class Function;
26 class Value;
27 
28 /// \brief Structure to hold a use-list order.
29 struct UseListOrder {
30   const Value *V;
31   const Function *F;
32   std::vector<unsigned> Shuffle;
33 
UseListOrderUseListOrder34   UseListOrder(const Value *V, const Function *F, size_t ShuffleSize)
35       : V(V), F(F), Shuffle(ShuffleSize) {}
36 
UseListOrderUseListOrder37   UseListOrder() : V(nullptr), F(nullptr) {}
UseListOrderUseListOrder38   UseListOrder(UseListOrder &&X)
39       : V(X.V), F(X.F), Shuffle(std::move(X.Shuffle)) {}
40   UseListOrder &operator=(UseListOrder &&X) {
41     V = X.V;
42     F = X.F;
43     Shuffle = std::move(X.Shuffle);
44     return *this;
45   }
46 
47 private:
48   UseListOrder(const UseListOrder &X) = delete;
49   UseListOrder &operator=(const UseListOrder &X) = delete;
50 };
51 
52 typedef std::vector<UseListOrder> UseListOrderStack;
53 
54 } // end namespace llvm
55 
56 #endif // LLVM_IR_USELISTORDER_H
57