aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/SectionKind.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-04 05:35:56 +0000
committerChris Lattner <sabre@nondot.org>2009-08-04 05:35:56 +0000
commit3b24c0172069a2546cd095e4b91f8b88c1ea0722 (patch)
tree3604ba3eb4d0677a31f20d5e7dda389e009916b8 /include/llvm/MC/SectionKind.h
parent37442b77d83e7a35a8cb704c2dc704834090fb4b (diff)
downloadexternal_llvm-3b24c0172069a2546cd095e4b91f8b88c1ea0722.zip
external_llvm-3b24c0172069a2546cd095e4b91f8b88c1ea0722.tar.gz
external_llvm-3b24c0172069a2546cd095e4b91f8b88c1ea0722.tar.bz2
make MergeableCString be a SectionKind "abstract class", and
add new concrete versions for 1/2/4-byte mergable strings. These are not actually created yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78055 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/SectionKind.h')
-rw-r--r--include/llvm/MC/SectionKind.h42
1 files changed, 32 insertions, 10 deletions
diff --git a/include/llvm/MC/SectionKind.h b/include/llvm/MC/SectionKind.h
index 7d4e40d..945cff7 100644
--- a/include/llvm/MC/SectionKind.h
+++ b/include/llvm/MC/SectionKind.h
@@ -38,13 +38,20 @@ class SectionKind {
/// SectionKind are not mergeable.
ReadOnly,
- /// MergeableCString - This is a special section for nul-terminated
- /// strings. The linker can unique the C strings, knowing their
- /// semantics. Because it uniques based on the nul terminators, the
- /// compiler can't put strings in this section that have embeded nuls
- /// in them.
- MergeableCString,
+ /// MergableCString - Any null-terminated string which allows merging.
+ /// These values are known to end in a nul value of the specified size,
+ /// not otherwise contain a nul value, and be mergable. This allows the
+ /// linker to unique the strings if it so desires.
+
+ /// Mergeable1ByteCString - 1 byte mergable, null terminated, string.
+ Mergeable1ByteCString,
+ /// Mergeable2ByteCString - 2 byte mergable, null terminated, string.
+ Mergeable2ByteCString,
+
+ /// Mergeable4ByteCString - 4 byte mergable, null terminated, string.
+ Mergeable4ByteCString,
+
/// MergeableConst - These are sections for merging fixed-length
/// constants together. For example, this can be used to unique
/// constant pool entries etc.
@@ -119,15 +126,22 @@ public:
bool isText() const { return K == Text; }
bool isReadOnly() const {
- return K == ReadOnly || K == MergeableCString || isMergeableConst();
+ return K == ReadOnly || isMergeableCString() ||
+ isMergeableConst();
}
- bool isMergeableCString() const { return K == MergeableCString; }
+ bool isMergeableCString() const {
+ return K == Mergeable1ByteCString || K == Mergeable2ByteCString ||
+ K == Mergeable4ByteCString;
+ }
+ bool isMergeable1ByteCString() const { return K == Mergeable1ByteCString; }
+ bool isMergeable2ByteCString() const { return K == Mergeable2ByteCString; }
+ bool isMergeable4ByteCString() const { return K == Mergeable4ByteCString; }
+
bool isMergeableConst() const {
return K == MergeableConst || K == MergeableConst4 ||
K == MergeableConst8 || K == MergeableConst16;
}
-
bool isMergeableConst4() const { return K == MergeableConst4; }
bool isMergeableConst8() const { return K == MergeableConst8; }
bool isMergeableConst16() const { return K == MergeableConst16; }
@@ -177,7 +191,15 @@ public:
static SectionKind getMetadata() { return get(Metadata); }
static SectionKind getText() { return get(Text); }
static SectionKind getReadOnly() { return get(ReadOnly); }
- static SectionKind getMergeableCString() { return get(MergeableCString); }
+ static SectionKind getMergeable1ByteCString() {
+ return get(Mergeable1ByteCString);
+ }
+ static SectionKind getMergeable2ByteCString() {
+ return get(Mergeable2ByteCString);
+ }
+ static SectionKind getMergeable4ByteCString() {
+ return get(Mergeable4ByteCString);
+ }
static SectionKind getMergeableConst() { return get(MergeableConst); }
static SectionKind getMergeableConst4() { return get(MergeableConst4); }
static SectionKind getMergeableConst8() { return get(MergeableConst8); }