simplify code now that it is inlined.

llvm-svn: 76689
This commit is contained in:
Chris Lattner 2009-07-21 23:49:55 +00:00
parent aa037759b2
commit aa17ab0669
2 changed files with 5 additions and 16 deletions

View File

@ -61,10 +61,8 @@ ELFTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
// By default - all relocations in PIC mode would force symbol to be // By default - all relocations in PIC mode would force symbol to be
// placed in r/w section. // placed in r/w section.
unsigned Reloc = (TM.getRelocationModel() != Reloc::Static ? if (TM.getRelocationModel() != Reloc::Static &&
Reloc::LocalOrGlobal : Reloc::None); C->ContainsRelocations(Reloc::LocalOrGlobal))
if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
return (C->ContainsRelocations(Reloc::Global) ? return (C->ContainsRelocations(Reloc::Global) ?
(isConstant ? (isConstant ?
SectionKind::DataRelRO : SectionKind::DataRel) : SectionKind::DataRelRO : SectionKind::DataRel) :

View File

@ -209,20 +209,11 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
// note, there is no thread-local r/o section. // note, there is no thread-local r/o section.
Constant *C = GVar->getInitializer(); Constant *C = GVar->getInitializer();
if (C->ContainsRelocations(Reloc::LocalOrGlobal)) { if (C->ContainsRelocations(Reloc::LocalOrGlobal)) {
// Decide, whether it is still possible to put symbol into r/o section. // Decide whether it is still possible to put symbol into r/o section.
unsigned Reloc = (TM.getRelocationModel() != Reloc::Static ? if (TM.getRelocationModel() != Reloc::Static)
Reloc::LocalOrGlobal : Reloc::None);
// We already did a query for 'all' relocs, thus - early exits.
if (Reloc == Reloc::LocalOrGlobal)
return SectionKind::Data; return SectionKind::Data;
else if (Reloc == Reloc::None) else
return SectionKind::ROData; return SectionKind::ROData;
else {
// Ok, target wants something funny. Honour it.
return (C->ContainsRelocations(Reloc) ?
SectionKind::Data : SectionKind::ROData);
}
} else { } else {
// Check, if initializer is a null-terminated string // Check, if initializer is a null-terminated string
if (isConstantString(C)) if (isConstantString(C))