Detemplatize LOHDirective.
[oota-llvm.git] / lib / Target / ARM64 / ARM64MachineFunctionInfo.h
index 59538ea40e9b80eaf3d92dd191d64d8d591e0138..02bf7cf6fd005986a1e4bf3ee24b9fd3e9c20883 100644 (file)
@@ -100,20 +100,33 @@ public:
   const SetOfInstructions &getLOHRelated() const { return LOHRelated; }
 
   // Shortcuts for LOH related types.
-  typedef LOHDirective<const MachineInstr> MILOHDirective;
-  typedef MILOHDirective::LOHArgs MILOHArgs;
+  class MILOHDirective {
+    MCLOHType Kind;
+
+    /// Arguments of this directive. Order matters.
+    SmallVector<const MachineInstr *, 3> Args;
+
+  public:
+    typedef SmallVectorImpl<const MachineInstr *> LOHArgs;
 
-  typedef LOHContainer<const MachineInstr> MILOHContainer;
-  typedef MILOHContainer::LOHDirectives MILOHDirectives;
+    MILOHDirective(MCLOHType Kind, const LOHArgs &Args)
+        : Kind(Kind), Args(Args.begin(), Args.end()) {
+      assert(isValidMCLOHType(Kind) && "Invalid LOH directive type!");
+    }
+
+    MCLOHType getKind() const { return Kind; }
+    const LOHArgs &getArgs() const { return Args; }
+  };
+
+  typedef MILOHDirective::LOHArgs MILOHArgs;
+  typedef SmallVector<MILOHDirective, 32> MILOHContainer;
 
   const MILOHContainer &getLOHContainer() const { return LOHContainerSet; }
 
   /// Add a LOH directive of this @p Kind and this @p Args.
   void addLOHDirective(MCLOHType Kind, const MILOHArgs &Args) {
-    LOHContainerSet.addDirective(Kind, Args);
-    for (MILOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
-         It != EndIt; ++It)
-      LOHRelated.insert(*It);
+    LOHContainerSet.push_back(MILOHDirective(Kind, Args));
+    LOHRelated.insert(Args.begin(), Args.end());
   }
 
 private: