summaryrefslogtreecommitdiff
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-24 09:31:43 +0000
committerChris Lattner <sabre@nondot.org>2012-01-24 09:31:43 +0000
commit9e631da253bff90d9da5ace21bd73f1c838e72eb (patch)
treeee0015a94cee5cd31296621542ba8eaf3ff82481 /include/llvm/Constants.h
parent62339073127df4579905f551f61c132cf21d2aad (diff)
downloadllvm-9e631da253bff90d9da5ace21bd73f1c838e72eb.tar.gz
llvm-9e631da253bff90d9da5ace21bd73f1c838e72eb.tar.bz2
llvm-9e631da253bff90d9da5ace21bd73f1c838e72eb.tar.xz
Add AsmPrinter (aka MCLowering) support for ConstantDataSequential,
and clean up some other misc stuff. Unlike ConstantArray, we will prefer to emit .fill directives for "String" arrays that all have the same value, since they are denser than emitting a .ascii git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 21400e774d..510847ff23 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -640,7 +640,10 @@ public:
/// getAsString - If this array is isString(), then this method returns the
/// array as a StringRef. Otherwise, it asserts out.
///
- StringRef getAsString() const;
+ StringRef getAsString() const {
+ assert(isString() && "Not a string");
+ return getRawDataValues();
+ }
/// getAsCString - If this array is isCString(), then this method returns the
/// array (without the trailing null byte) as a StringRef. Otherwise, it
@@ -652,6 +655,10 @@ public:
return Str.substr(0, Str.size()-1);
}
+ /// getRawDataValues - Return the raw, underlying, bytes of this data. Note
+ /// that this is an extremely tricky thing to work with, as it exposes the
+ /// host endianness of the data elements.
+ StringRef getRawDataValues() const;
virtual void destroyConstant();