make doxygen comment much better. Patch by B. Scott Michel!
[oota-llvm.git] / include / llvm / Target / TargetLowering.h
index 6880cddf23732e693b6d45c471a94f562cdedad2..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
@@ -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::Int1TyID:    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
@@ -857,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
@@ -989,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