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
This commit is contained in:
Chris Lattner
2012-01-24 09:31:43 +00:00
parent 6233907312
commit 9e631da253
3 changed files with 105 additions and 45 deletions

View File

@@ -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();