aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-03 00:13:48 +0000
committerDan Gohman <gohman@apple.com>2009-06-03 00:13:48 +0000
commitb3ae97cffe089ff84ea336e2bc062955eda1ff07 (patch)
treeca9e524ccd36fb05407f913b6fec198cdf686cda /include/llvm
parent7714285efd2a7f4e503f0f600667193e63ee6d08 (diff)
Change TargetFolder's TD member from a reference to a
pointer, now that ConstantFoldConstantExpression can accept a null TargetData pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Support/TargetFolder.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h
index 14f2c9b244..172e4fe123 100644
--- a/include/llvm/Support/TargetFolder.h
+++ b/include/llvm/Support/TargetFolder.h
@@ -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 @@ class TargetData;
/// 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