summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-31 04:42:22 +0000
committerChris Lattner <sabre@nondot.org>2012-01-31 04:42:22 +0000
commit3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99 (patch)
tree871a22cfc34d8f8a494233a478d34e10f4f7293f /include
parent4a6facbc574c37ec81380d31d8f1372ea10ebf29 (diff)
downloadllvm-3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99.tar.gz
llvm-3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99.tar.bz2
llvm-3ef9cfef13d7c7208b98b2d9995c3df6dcfe0d99.tar.xz
Change ConstantArray::get to form a ConstantDataArray when possible,
kicking in the big win of ConstantDataArray. As part of this, change the implementation of GetConstantStringInfo in ValueTracking to work with ConstantDataArray (and not ConstantArray) making it dramatically, amazingly, more efficient in the process and renaming it to getConstantStringInfo. This keeps around a GetConstantStringInfo entrypoint that (grossly) forwards to getConstantStringInfo and constructs the std::string required, but existing clients should move over to getConstantStringInfo instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/ValueTracking.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index 300f51df37..65c4e77b46 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -17,14 +17,13 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/DataTypes.h"
-#include <string>
namespace llvm {
- template <typename T> class SmallVectorImpl;
class Value;
class Instruction;
class APInt;
class TargetData;
+ class StringRef;
/// ComputeMaskedBits - Determine which of the bits specified in Mask are
/// known to be either zero or one and return them in the KnownZero/KnownOne
@@ -125,16 +124,17 @@ namespace llvm {
return GetPointerBaseWithConstantOffset(const_cast<Value*>(Ptr), Offset,TD);
}
- /// GetConstantStringInfo - This function computes the length of a
+ /// getConstantStringInfo - This function computes the length of a
/// null-terminated C string pointed to by V. If successful, it returns true
- /// and returns the string in Str. If unsuccessful, it returns false. If
- /// StopAtNul is set to true (the default), the returned string is truncated
- /// by a nul character in the global. If StopAtNul is false, the nul
- /// character is included in the result string.
+ /// and returns the string in Str. If unsuccessful, it returns false. This
+ /// does not include the trailing nul character.
+ bool getConstantStringInfo(const Value *V, StringRef &Str,
+ uint64_t Offset = 0);
+
+ // FIXME: Remove this.
bool GetConstantStringInfo(const Value *V, std::string &Str,
- uint64_t Offset = 0,
- bool StopAtNul = true);
-
+ uint64_t Offset = 0);
+
/// GetStringLength - If we can compute the length of the string pointed to by
/// the specified pointer, return 'len+1'. If we can't, return 0.
uint64_t GetStringLength(Value *V);