[llvm-commits] [llvm] r72744 - /llvm/trunk/include/llvm/Support/TargetFolder.h
Dan Gohman
gohman at apple.com
Tue Jun 2 17:13:49 PDT 2009
Author: djg
Date: Tue Jun 2 19:13:48 2009
New Revision: 72744
URL: http://llvm.org/viewvc/llvm-project?rev=72744&view=rev
Log:
Change TargetFolder's TD member from a reference to a
pointer, now that ConstantFoldConstantExpression can
accept a null TargetData pointer.
Modified:
llvm/trunk/include/llvm/Support/TargetFolder.h
Modified: llvm/trunk/include/llvm/Support/TargetFolder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetFolder.h?rev=72744&r1=72743&r2=72744&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TargetFolder.h (original)
+++ llvm/trunk/include/llvm/Support/TargetFolder.h Tue Jun 2 19:13:48 2009
@@ -9,8 +9,10 @@
//
// This file defines the TargetFolder class, a helper for IRBuilder.
// It provides IRBuilder with a set of methods for creating constants with
-// target dependent folding. For general constant creation and folding,
-// use ConstantExpr and the routines in llvm/Analysis/ConstantFolding.h.
+// target dependent folding, in addition to the same target-independent
+// folding that the ConstantFolder class provides. For general constant
+// creation and folding, use ConstantExpr and the routines in
+// llvm/Analysis/ConstantFolding.h.
//
//===----------------------------------------------------------------------===//
@@ -26,18 +28,18 @@
/// TargetFolder - Create constants with target dependent folding.
class TargetFolder {
- const TargetData &TD;
+ const TargetData *TD;
/// Fold - Fold the constant using target specific information.
Constant *Fold(Constant *C) const {
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
- if (Constant *CF = ConstantFoldConstantExpression(CE, &TD))
+ if (Constant *CF = ConstantFoldConstantExpression(CE, TD))
return CF;
return C;
}
public:
- TargetFolder(const TargetData &TheTD) : TD(TheTD) {}
+ explicit TargetFolder(const TargetData *TheTD) : TD(TheTD) {}
//===--------------------------------------------------------------------===//
// Binary Operators
More information about the llvm-commits
mailing list