[llvm-commits] CVS: llvm/include/llvm/Instructions.h

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 18 09:47:04 PST 2004



Changes in directory llvm/include/llvm:

Instructions.h updated: 1.8 -> 1.9
---
Log message:

Update comments, now that CPR's are gone, inline the methods


---
Diffs of the changes:  (+10 -9)

Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.8 llvm/include/llvm/Instructions.h:1.9
--- llvm/include/llvm/Instructions.h:1.8	Wed Nov 17 15:02:25 2004
+++ llvm/include/llvm/Instructions.h	Thu Nov 18 11:46:49 2004
@@ -481,10 +481,12 @@
   virtual CallInst *clone() const;
   bool mayWriteToMemory() const { return true; }
 
-  // FIXME: These methods should be inline once we eliminate
-  // ConstantPointerRefs!
-  const Function *getCalledFunction() const;
-  Function *getCalledFunction();
+  /// getCalledFunction - Return the function being called by this instruction
+  /// if it is a direct call.  If it is a call through a function pointer,
+  /// return null.
+  Function *getCalledFunction() const {
+    return dyn_cast<Function>(Operands[0]);
+  }
 
   // getCalledValue - Get a pointer to a method that is invoked by this inst.
   inline const Value *getCalledValue() const { return Operands[0]; }
@@ -1088,12 +1090,11 @@
   bool mayWriteToMemory() const { return true; }
 
   /// getCalledFunction - Return the function called, or null if this is an
-  /// indirect function invocation... 
-  ///
-  /// FIXME: These should be inlined once we get rid of ConstantPointerRefs!
+  /// indirect function invocation.
   ///
-  const Function *getCalledFunction() const;
-  Function *getCalledFunction();
+  Function *getCalledFunction() const {
+    return dyn_cast<Function>(Operands[0]);
+  }
 
   // getCalledValue - Get a pointer to a function that is invoked by this inst.
   inline const Value *getCalledValue() const { return Operands[0]; }






More information about the llvm-commits mailing list