Move CallbackVHs dtor inline, it can be devirtualized in many cases. Move the other...
[oota-llvm.git] / include / llvm / Support / MDBuilder.h
index 20f5d70c554f0c8a1b1bbecc7e8655ea0adb7f33..40f028a432749a970d328a62e43836cc43441141 100644 (file)
@@ -29,17 +29,33 @@ namespace llvm {
   public:
     MDBuilder(LLVMContext &context) : Context(context) {}
 
-    /// CreateString - Return the given string as metadata.
-    MDString *CreateString(StringRef Str) const {
+    /// \brief Return the given string as metadata.
+    MDString *createString(StringRef Str) {
       return MDString::get(Context, Str);
     }
 
+    //===------------------------------------------------------------------===//
+    // FPMath metadata.
+    //===------------------------------------------------------------------===//
+
+    /// \brief Return metadata with the given settings.  The special value 0.0
+    /// for the Accuracy parameter indicates the default (maximal precision)
+    /// setting.
+    MDNode *createFPMath(float Accuracy) {
+      if (Accuracy == 0.0)
+        return 0;
+      assert(Accuracy > 0.0 && "Invalid fpmath accuracy!");
+      Value *Op = ConstantFP::get(Type::getFloatTy(Context), Accuracy);
+      return MDNode::get(Context, Op);
+    }
+
+
     //===------------------------------------------------------------------===//
     // Range metadata.
     //===------------------------------------------------------------------===//
 
-    /// CreateRange - Return metadata describing the range [Lo, Hi).
-    MDNode *CreateRange(const APInt &Lo, const APInt &Hi) const {
+    /// \brief Return metadata describing the range [Lo, Hi).
+    MDNode *createRange(const APInt &Lo, const APInt &Hi) {
       assert(Lo.getBitWidth() == Hi.getBitWidth() && "Mismatched bitwidths!");
       // If the range is everything then it is useless.
       if (Hi == Lo)
@@ -56,10 +72,10 @@ namespace llvm {
     // TBAA metadata.
     //===------------------------------------------------------------------===//
 
-    /// CreateAnonymousTBAARoot - Return metadata appropriate for a TBAA root
-    /// node.  Each returned node is distinct from all other metadata and will
-    /// never be identified (uniqued) with anything else.
-    MDNode *CreateAnonymousTBAARoot() const {
+    /// \brief Return metadata appropriate for a TBAA root node.  Each returned
+    /// node is distinct from all other metadata and will never be identified
+    /// (uniqued) with anything else.
+    MDNode *createAnonymousTBAARoot() {
       // To ensure uniqueness the root node is self-referential.
       MDNode *Dummy = MDNode::getTemporary(Context, ArrayRef<Value*>());
       MDNode *Root = MDNode::get(Context, Dummy);
@@ -74,26 +90,27 @@ namespace llvm {
       return Root;
     }
 
-    /// CreateTBAARoot - Return metadata appropriate for a TBAA root node with
-    /// the given name.  This may be identified (uniqued) with other roots with
-    /// the same name.
-    MDNode *CreateTBAARoot(StringRef Name) const {
-      return MDNode::get(Context, CreateString(Name));
+    /// \brief Return metadata appropriate for a TBAA root node with the given
+    /// name.  This may be identified (uniqued) with other roots with the same
+    /// name.
+    MDNode *createTBAARoot(StringRef Name) {
+      return MDNode::get(Context, createString(Name));
     }
 
-    /// CreateTBAANode - Return metadata for a non-root TBAA node with the given
-    /// name, parent in the TBAA tree, and value for 'pointsToConstantMemory'.
-    MDNode *CreateTBAANode(StringRef Name, MDNode *Parent,
-                           bool isConstant = false) const {
+    /// \brief Return metadata for a non-root TBAA node with the given name,
+    /// parent in the TBAA tree, and value for 'pointsToConstantMemory'.
+    MDNode *createTBAANode(StringRef Name, MDNode *Parent,
+                           bool isConstant = false) {
       if (isConstant) {
         Constant *Flags = ConstantInt::get(Type::getInt64Ty(Context), 1);
-        Value *Ops[3] = { CreateString(Name), Parent, Flags };
+        Value *Ops[3] = { createString(Name), Parent, Flags };
         return MDNode::get(Context, Ops);
       } else {
-        Value *Ops[2] = { CreateString(Name), Parent };
+        Value *Ops[2] = { createString(Name), Parent };
         return MDNode::get(Context, Ops);
       }
     }
+
   };
 
 } // end namespace llvm