[llvm-commits] [llvm] r78871 - in /llvm/trunk/lib/Target/PIC16: PIC16Section.h PIC16TargetObjectFile.cpp PIC16TargetObjectFile.h
Chris Lattner
sabre at nondot.org
Wed Aug 12 17:26:54 PDT 2009
Author: lattner
Date: Wed Aug 12 19:26:52 2009
New Revision: 78871
URL: http://llvm.org/viewvc/llvm-project?rev=78871&view=rev
Log:
make PIC16 unique its own sections instead of having mcontext do it.
Modified:
llvm/trunk/lib/Target/PIC16/PIC16Section.h
llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp
llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h
Modified: llvm/trunk/lib/Target/PIC16/PIC16Section.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16Section.h?rev=78871&r1=78870&r2=78871&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16Section.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16Section.h Wed Aug 12 19:26:52 2009
@@ -21,8 +21,10 @@
class MCSectionPIC16 : public MCSection {
std::string Name;
- MCSectionPIC16(const StringRef &name, SectionKind K,
- MCContext &Ctx);
+ MCSectionPIC16(const StringRef &name, SectionKind K)
+ : MCSection(K), Name(name) {
+ }
+
public:
const std::string &getName() const { return Name; }
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp?rev=78871&r1=78870&r2=78871&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp Wed Aug 12 19:26:52 2009
@@ -18,14 +18,10 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-MCSectionPIC16::MCSectionPIC16(const StringRef &name, SectionKind K,
- MCContext &Ctx) : MCSection(K), Name(name) {
- Ctx.SetSection(Name, this);
-}
MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name,
SectionKind K, MCContext &Ctx) {
- return new (Ctx) MCSectionPIC16(Name, K, Ctx);
+ return new (Ctx) MCSectionPIC16(Name, K);
}
@@ -43,9 +39,11 @@
const MCSectionPIC16 *PIC16TargetObjectFile::
getPIC16Section(const char *Name, SectionKind Kind) const {
- if (MCSection *S = getContext().GetSection(Name))
- return (MCSectionPIC16*)S;
- return MCSectionPIC16::Create(Name, Kind, getContext());
+ MCSectionPIC16 *&Entry = SectionsByName[Name];
+ if (Entry)
+ return Entry;
+
+ return Entry = MCSectionPIC16::Create(Name, Kind, getContext());
}
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h?rev=78871&r1=78870&r2=78871&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h Wed Aug 12 19:26:52 2009
@@ -11,6 +11,7 @@
#define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
#include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/ADT/StringMap.h"
#include <vector>
#include <string>
@@ -46,6 +47,9 @@
};
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
+ /// SectionsByName - Bindings of names to allocated sections.
+ mutable StringMap<MCSectionPIC16*> SectionsByName;
+
const TargetMachine *TM;
const MCSectionPIC16 *getPIC16Section(const char *Name,
More information about the llvm-commits
mailing list