Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / CodeGen / InstrSelection.h
index 91bc8f2a8cf616f50b3f1df07d67963700062dd4..89e827d106b3d22669ac7d9d0afbbe44d3675c7a 100644 (file)
@@ -1,44 +1,38 @@
-// $Id$ -*-c++-*-
-//***************************************************************************
-// File:
-//     InstrSelection.h
+//===-- llvm/CodeGen/InstrSelection.h ---------------------------*- C++ -*-===//
 // 
-// Purpose:
-//     External interface to instruction selection.
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
 // 
-// History:
-//     7/02/01  -  Vikram Adve  -  Created
-//**************************************************************************/
+//===----------------------------------------------------------------------===//
+//
+// External interface to instruction selection.
+//
+//===----------------------------------------------------------------------===//
 
 #ifndef LLVM_CODEGEN_INSTR_SELECTION_H
 #define LLVM_CODEGEN_INSTR_SELECTION_H
 
 #include "llvm/Instruction.h"
+
 class Function;
 class InstrForest;
 class MachineInstr;
 class InstructionNode;
 class TargetMachine;
+class MachineCodeForInstruction;
+class FunctionPass;
 
-/************************* Required Functions *******************************
- * Target-dependent functions that MUST be implemented for each target.
- ***************************************************************************/
-
-const unsigned MAX_INSTR_PER_VMINSTR = 8;
+//===--------------------- Required Functions ---------------------------------
+// Target-dependent functions that MUST be implemented for each target.
+//
 
 extern void    GetInstructionsByRule   (InstructionNode* subtreeRoot,
                                         int ruleForNode,
                                         short* nts,
                                         TargetMachine &Target,
-                                         vector<MachineInstr*>& mvec);
-
-extern unsigned        GetInstructionsForProlog(BasicBlock* entryBB,
-                                        TargetMachine &Target,
-                                        MachineInstr** minstrVec);
-
-extern unsigned        GetInstructionsForEpilog(BasicBlock* anExitBB,
-                                        TargetMachine &Target,
-                                        MachineInstr** minstrVec);
+                                         std::vector<MachineInstr*>& mvec);
 
 extern bool    ThisIsAChainRule        (int eruleno);
 
@@ -47,16 +41,14 @@ extern bool ThisIsAChainRule        (int eruleno);
 
 
 //---------------------------------------------------------------------------
-// Function: SelectInstructionsForMethod
+// Function: createInstructionSelectionPass
 // 
 // Purpose:
 //   Entry point for instruction selection using BURG.
-//   Returns true if instruction selection failed, false otherwise.
-//   Implemented in machine-specific instruction selection file.
+//   Return a pass that performs machine dependent instruction selection.
 //---------------------------------------------------------------------------
 
-bool           SelectInstructionsForMethod     (Function* function,
-                                                TargetMachine &Target);
+FunctionPass *createInstructionSelectionPass(TargetMachine &Target);
 
 
 //************************ Exported Data Types *****************************/
@@ -83,24 +75,19 @@ class TmpInstruction : public Instruction {
 public:
   // Constructor that uses the type of S1 as the type of the temporary.
   // s1 must be a valid value.  s2 may be NULL.
-  TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = "")
-    : Instruction(s1->getType(), Instruction::UserOp1, name) {
-    Operands.push_back(Use(s1, this));  // s1 must be nonnull
-    if (s2) {
-      Operands.push_back(Use(s2, this));
-    }
-  }
+  TmpInstruction(MachineCodeForInstruction& mcfi,
+                 Value *s1, Value *s2 = 0, const std::string &name = "");
   
   // Constructor that requires the type of the temporary to be specified.
   // Both S1 and S2 may be NULL.
-  TmpInstruction(const Type *Ty, Value *s1 = 0, Value* s2 = 0,
-                 const std::string &name = "")
-    : Instruction(Ty, Instruction::UserOp1, name) {
-    if (s1) { Operands.push_back(Use(s1, this)); }
-    if (s2) { Operands.push_back(Use(s2, this)); }
-  }
+  TmpInstruction(MachineCodeForInstruction& mcfi,
+                 const Type *Ty, Value *s1 = 0, Value* s2 = 0,
+                 const std::string &name = "");
   
-  virtual Instruction *clone() const { return new TmpInstruction(*this); }
+  virtual Instruction *clone() const {
+    assert(0 && "Cannot clone TmpInstructions!");
+    return 0;
+  }
   virtual const char *getOpcodeName() const {
     return "TempValueForMachineInstr";
   }