[llvm-commits] [llvm] r53301 - in /llvm/trunk/lib/Target/X86: X86TargetAsmInfo.cpp X86TargetAsmInfo.h
Anton Korobeynikov
asl at math.spbu.ru
Wed Jul 9 06:21:29 PDT 2008
Author: asl
Date: Wed Jul 9 08:21:29 2008
New Revision: 53301
URL: http://llvm.org/viewvc/llvm-project?rev=53301&view=rev
Log:
Split UniqueSectionForGlobal()
Modified:
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=53301&r1=53300&r2=53301&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Wed Jul 9 08:21:29 2008
@@ -221,6 +221,15 @@
return DW_EH_PE_absptr;
}
+std::string
+X86DarwinTargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
+ SectionKind::Kind kind) const {
+ if (kind == SectionKind::Text)
+ return "__TEXT,__textcoal_nt,coalesced,pure_instructions";
+ else
+ return "__DATA,__datacoal_nt,coalesced";
+}
+
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
X86TargetAsmInfo(TM) {
bool is64Bit = X86TM->getSubtarget<X86Subtarget>().is64Bit();
@@ -401,41 +410,26 @@
}
}
-std::string X86TargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
- SectionKind::Kind kind) const {
- const X86Subtarget *Subtarget = &X86TM->getSubtarget<X86Subtarget>();
-
- switch (Subtarget->TargetType) {
- case X86Subtarget::isDarwin:
- if (kind == SectionKind::Text)
- return "__TEXT,__textcoal_nt,coalesced,pure_instructions";
- else
- return "__DATA,__datacoal_nt,coalesced";
- case X86Subtarget::isCygwin:
- case X86Subtarget::isMingw:
- switch (kind) {
- case SectionKind::Text:
- return ".text$linkonce" + GV->getName();
- case SectionKind::Data:
- case SectionKind::BSS:
- case SectionKind::ThreadData:
- case SectionKind::ThreadBSS:
- return ".data$linkonce" + GV->getName();
- case SectionKind::ROData:
- case SectionKind::RODataMergeConst:
- case SectionKind::RODataMergeStr:
- return ".rdata$linkonce" + GV->getName();
- default:
- assert(0 && "Unknown section kind");
- }
- case X86Subtarget::isELF:
- return TargetAsmInfo::UniqueSectionForGlobal(GV, kind);
+std::string
+X86COFFTargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
+ SectionKind::Kind kind) const {
+ switch (kind) {
+ case SectionKind::Text:
+ return ".text$linkonce" + GV->getName();
+ case SectionKind::Data:
+ case SectionKind::BSS:
+ case SectionKind::ThreadData:
+ case SectionKind::ThreadBSS:
+ return ".data$linkonce" + GV->getName();
+ case SectionKind::ROData:
+ case SectionKind::RODataMergeConst:
+ case SectionKind::RODataMergeStr:
+ return ".rdata$linkonce" + GV->getName();
default:
- return "";
+ assert(0 && "Unknown section kind");
}
}
-
std::string X86TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind kind = SectionKindForGlobal(GV);
unsigned flags = SectionFlagsForGlobal(GV, GV->getSection().c_str());
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=53301&r1=53300&r2=53301&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Wed Jul 9 08:21:29 2008
@@ -26,8 +26,6 @@
virtual bool ExpandInlineAsm(CallInst *CI) const;
virtual std::string SectionForGlobal(const GlobalValue *GV) const;
- virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
- SectionKind::Kind kind) const;
virtual std::string PrintSectionFlags(unsigned flags) const;
private:
@@ -40,6 +38,8 @@
explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const;
+ virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
+ SectionKind::Kind kind) const;
};
struct X86ELFTargetAsmInfo : public X86TargetAsmInfo {
@@ -52,6 +52,8 @@
explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const;
+ virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
+ SectionKind::Kind kind) const;
};
struct X86WinTargetAsmInfo : public X86TargetAsmInfo {
More information about the llvm-commits
mailing list