summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-17 21:54:26 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-17 21:54:26 +0000
commitce5e1bb326802750986bb3b99a1fa3ba6d971a46 (patch)
tree18b87cc73b25326eab1fb650434f734dc856797e /llvm/lib
parentb7b796cc1124dfb1d6e1427e15d66468f15f5960 (diff)
downloadbcm5719-llvm-ce5e1bb326802750986bb3b99a1fa3ba6d971a46.tar.gz
bcm5719-llvm-ce5e1bb326802750986bb3b99a1fa3ba6d971a46.zip
MC: Add dyn_cast support to MCSection.
- Of questionable utility, since in general anything which wants to do this should probably be within a target specific hook, which can rely on the sections being of the appropriate type. However, it can be useful for short term hacks. llvm-svn: 103980
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCSectionMachO.cpp2
-rw-r--r--llvm/lib/Target/PIC16/PIC16Section.h8
2 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCSectionMachO.cpp b/llvm/lib/MC/MCSectionMachO.cpp
index 7a519e8daf0..4ad3a2fbc87 100644
--- a/llvm/lib/MC/MCSectionMachO.cpp
+++ b/llvm/lib/MC/MCSectionMachO.cpp
@@ -73,7 +73,7 @@ ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K)
- : MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
+ : MCSection(SV_MachO, K), TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
"Segment or section string too long");
for (unsigned i = 0; i != 16; ++i) {
diff --git a/llvm/lib/Target/PIC16/PIC16Section.h b/llvm/lib/Target/PIC16/PIC16Section.h
index 9039ca781a3..5b33b51a386 100644
--- a/llvm/lib/Target/PIC16/PIC16Section.h
+++ b/llvm/lib/Target/PIC16/PIC16Section.h
@@ -44,7 +44,8 @@ namespace llvm {
unsigned Size;
PIC16Section(StringRef name, SectionKind K, StringRef addr, int color)
- : MCSection(K), Name(name), Address(addr), Color(color), Size(0) {
+ : MCSection(SV_PIC16, K), Name(name), Address(addr),
+ Color(color), Size(0) {
}
public:
@@ -86,6 +87,11 @@ namespace llvm {
/// to a section.
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
+
+ static bool classof(const MCSection *S) {
+ return S->getVariant() == SV_PIC16;
+ }
+ static bool classof(const PIC16Section *) { return true; }
};
} // end namespace llvm
OpenPOWER on IntegriCloud