make doxygen comment much better. Patch by B. Scott Michel!
[oota-llvm.git] / include / llvm / Target / TargetLowering.h
index 2a353ba7e9640dbff1e30138bcaec90a3fa6baa2..34bc3ad7ee86b78a265045922412b1e00dfad579 100644 (file)
 #ifndef LLVM_TARGET_TARGETLOWERING_H
 #define LLVM_TARGET_TARGETLOWERING_H
 
-#include "llvm/Type.h"
 #include "llvm/CodeGen/SelectionDAGNodes.h"
+#include "llvm/CodeGen/RuntimeLibcalls.h"
 #include <map>
+#include <vector>
 
 namespace llvm {
   class Value;
@@ -37,6 +38,7 @@ namespace llvm {
   class SelectionDAG;
   class MachineBasicBlock;
   class MachineInstr;
+  class PackedType;
 
 //===----------------------------------------------------------------------===//
 /// TargetLowering - This class defines information used to lower LLVM code to
@@ -89,9 +91,9 @@ public:
   /// codegen.
   bool usesGlobalOffsetTable() const { return UsesGlobalOffsetTable; }
   
-  /// isSetCCExpensive - Return true if the setcc operation is expensive for
+  /// isSelectExpensive - Return true if the select operation is expensive for
   /// this target.
-  bool isSetCCExpensive() const { return SetCCIsExpensive; }
+  bool isSelectExpensive() const { return SelectIsExpensive; }
   
   /// isIntDivCheap() - Return true if integer divide is usually cheaper than
   /// a sequence of several shifts, adds, and multiplies for this target.
@@ -338,21 +340,7 @@ public:
 
   /// getValueType - Return the MVT::ValueType corresponding to this LLVM type.
   /// This is fixed by the LLVM operations except for the pointer size.
-  MVT::ValueType getValueType(const Type *Ty) const {
-    switch (Ty->getTypeID()) {
-    default: assert(0 && "Unknown type!");
-    case Type::VoidTyID:    return MVT::isVoid;
-    case Type::BoolTyID:    return MVT::i1;
-    case Type::Int8TyID:    return MVT::i8;
-    case Type::Int16TyID:   return MVT::i16;
-    case Type::Int32TyID:   return MVT::i32;
-    case Type::Int64TyID:   return MVT::i64;
-    case Type::FloatTyID:   return MVT::f32;
-    case Type::DoubleTyID:  return MVT::f64;
-    case Type::PointerTyID: return PointerTy;
-    case Type::PackedTyID:  return MVT::Vector;
-    }
-  }
+  MVT::ValueType getValueType(const Type *Ty) const;
 
   /// getNumElements - Return the number of registers that this ValueType will
   /// eventually require.  This is one for any types promoted to live in larger
@@ -608,10 +596,9 @@ protected:
     StackPointerRegisterToSaveRestore = R;
   }
   
-  /// setSetCCIxExpensive - This is a short term hack for targets that codegen
-  /// setcc as a conditional branch.  This encourages the code generator to fold
-  /// setcc operations into other operations if possible.
-  void setSetCCIsExpensive() { SetCCIsExpensive = true; }
+  /// SelectIsExpensive - Tells the code generator not to expand operations
+  /// into sequences that use the select operations if possible.
+  void setSelectIsExpensive() { SelectIsExpensive = true; }
 
   /// setIntDivIsCheap - Tells the code generator that integer divide is
   /// expensive, and if possible, should be replaced by an alternate sequence
@@ -858,6 +845,22 @@ public:
                      std::vector<SDNode*>* Created) const;
 
 
+  //===--------------------------------------------------------------------===//
+  // Runtime Library hooks
+  //
+
+  /// setLibcallName - Rename the default libcall routine name for the specified
+  /// libcall.
+  void setLibcallName(RTLIB::Libcall Call, const char *Name) {
+    LibcallRoutineNames[Call] = Name;
+  }
+
+  /// getLibcallName - Get the libcall routine name for the specified libcall.
+  ///
+  const char *getLibcallName(RTLIB::Libcall Call) const {
+    return LibcallRoutineNames[Call];
+  }
+
 protected:
   /// addLegalAddressScale - Add a integer (> 1) value which can be used as
   /// scale in the target addressing mode. Note: the ordering matters so the
@@ -890,10 +893,9 @@ private:
 
   OutOfRangeShiftAmount ShiftAmtHandling;
 
-  /// SetCCIsExpensive - This is a short term hack for targets that codegen
-  /// setcc as a conditional branch.  This encourages the code generator to fold
-  /// setcc operations into other operations if possible.
-  bool SetCCIsExpensive;
+  /// SelectIsExpensive - Tells the code generator not to expand operations
+  /// into sequences that use the select operations if possible.
+  bool SelectIsExpensive;
 
   /// IntDivIsCheap - Tells the code generator not to expand integer divides by
   /// constants into a sequence of muls, adds, and shifts.  This is a hack until
@@ -991,7 +993,11 @@ private:
   /// Targets add entries to this map with AddPromotedToType(..), clients access
   /// this with getTypeToPromoteTo(..).
   std::map<std::pair<unsigned, MVT::ValueType>, MVT::ValueType> PromoteToType;
-  
+
+  /// LibcallRoutineNames - Stores the name each libcall.
+  ///
+  const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL];
+
 protected:
   /// When lowering %llvm.memset this field specifies the maximum number of
   /// store operations that may be substituted for the call to memset. Targets