diff options
author | Jan Wen Voung <jvoung@google.com> | 2010-09-30 05:59:22 +0000 |
---|---|---|
committer | Jan Wen Voung <jvoung@google.com> | 2010-09-30 05:59:22 +0000 |
commit | efbdbe5565edd457cc39b9317e9ba677bf6b2f6c (patch) | |
tree | 8b83a3eefc642393ced04e55af765d096e8b4672 /llvm/lib/MC/MCSectionELF.cpp | |
parent | 9d98ac645e32a304f429a8aa39f0e5db8417b95a (diff) | |
download | bcm5719-llvm-efbdbe5565edd457cc39b9317e9ba677bf6b2f6c.tar.gz bcm5719-llvm-efbdbe5565edd457cc39b9317e9ba677bf6b2f6c.zip |
Move logic of determining ELF entsize from the .s printer to initialization
time. That way, the EntrySize field is initialized for other code paths,
namely, the .ll -> .o code path.
llvm-svn: 115141
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r-- | llvm/lib/MC/MCSectionELF.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp index a7599de1b7b..ef935d0c64b 100644 --- a/llvm/lib/MC/MCSectionELF.cpp +++ b/llvm/lib/MC/MCSectionELF.cpp @@ -104,17 +104,8 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, else if (Type == MCSectionELF::SHT_PROGBITS) OS << "progbits"; - if (getKind().isMergeable1ByteCString()) { - OS << ",1"; - } else if (getKind().isMergeable2ByteCString()) { - OS << ",2"; - } else if (getKind().isMergeable4ByteCString() || - getKind().isMergeableConst4()) { - OS << ",4"; - } else if (getKind().isMergeableConst8()) { - OS << ",8"; - } else if (getKind().isMergeableConst16()) { - OS << ",16"; + if (EntrySize) { + OS << "," << EntrySize; } } @@ -132,4 +123,12 @@ bool MCSectionELF::HasCommonSymbols() const { return false; } - +unsigned MCSectionELF::DetermineEntrySize(SectionKind Kind) { + if (Kind.isMergeable1ByteCString()) return 1; + if (Kind.isMergeable2ByteCString()) return 2; + if (Kind.isMergeable4ByteCString()) return 4; + if (Kind.isMergeableConst4()) return 4; + if (Kind.isMergeableConst8()) return 8; + if (Kind.isMergeableConst16()) return 16; + return 0; +} |