[llvm-commits] [llvm] r63521 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/PIC16/PIC16TargetAsmInfo.cpp lib/Target/PIC16/PIC16TargetAsmInfo.h
Sanjiv Gupta
sanjiv.gupta at microchip.com
Mon Feb 2 08:53:06 PST 2009
Author: sgupta
Date: Mon Feb 2 10:53:06 2009
New Revision: 63521
URL: http://llvm.org/viewvc/llvm-project?rev=63521&view=rev
Log:
Made the common case of default address space directive as non-virtual for performance reasons. Provide a single virtual interface for directives of all sizes in non-default address spaces.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=63521&r1=63520&r2=63521&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Feb 2 10:53:06 2009
@@ -298,6 +298,15 @@
const char *Data32bitsDirective; // Defaults to "\t.long\t"
const char *Data64bitsDirective; // Defaults to "\t.quad\t"
+ /// getASDirective - Targets can override it to provide different data
+ /// directives for various sizes and non-default address spaces.
+ virtual const char *getASDirective(unsigned size,
+ unsigned AS) const {
+ assert (AS > 0
+ && "Dont know the directives for default addr space");
+ return NULL;
+ }
+
//===--- Alignment Information ----------------------------------------===//
/// AlignDirective - The directive used to emit round up to an alignment
@@ -600,19 +609,20 @@
// Data directive accessors
//
- virtual const char *getData8bitsDirective(unsigned AddrSpace = 0) const {
- return Data8bitsDirective;
+ const char *getData8bitsDirective(unsigned AS = 0) const {
+ return AS == 0 ? Data8bitsDirective : getASDirective(8, AS);
}
- virtual const char *getData16bitsDirective(unsigned AddrSpace = 0) const {
- return Data16bitsDirective;
+ const char *getData16bitsDirective(unsigned AS = 0) const {
+ return AS == 0 ? Data16bitsDirective : getASDirective(16, AS);
}
- virtual const char *getData32bitsDirective(unsigned AddrSpace = 0) const {
- return Data32bitsDirective;
+ const char *getData32bitsDirective(unsigned AS = 0) const {
+ return AS == 0 ? Data32bitsDirective : getASDirective(32, AS);
}
- virtual const char *getData64bitsDirective(unsigned AddrSpace = 0) const {
- return Data64bitsDirective;
+ const char *getData64bitsDirective(unsigned AS = 0) const {
+ return AS == 0 ? Data64bitsDirective : getASDirective(64, AS);
}
+
// Accessors.
//
const Section *getTextSection() const {
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=63521&r1=63520&r2=63521&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Mon Feb 2 10:53:06 2009
@@ -26,7 +26,7 @@
Data32bitsDirective = " dl ";
RomData8bitsDirective = " dw ";
RomData16bitsDirective = " rom_di ";
- RomData8bitsDirective = " rom_dl ";
+ RomData32bitsDirective = " rom_dl ";
ZeroDirective = NULL;
AsciiDirective = " dt ";
AscizDirective = NULL;
@@ -37,27 +37,24 @@
SwitchToSectionDirective = "";
}
-const char *PIC16TargetAsmInfo::getData8bitsDirective(unsigned AddrSpace)
- const {
- if (AddrSpace == PIC16ISD::ROM_SPACE)
- return RomData8bitsDirective;
- else
- return Data8bitsDirective;
- }
+const char *PIC16TargetAsmInfo::getRomDirective(unsigned size) const
+{
+ if (size == 8)
+ return RomData8bitsDirective;
+ else if (size == 16)
+ return RomData16bitsDirective;
+ else if (size == 32)
+ return RomData32bitsDirective;
+ else
+ return NULL;
+}
-const char *PIC16TargetAsmInfo::getData16bitsDirective(unsigned AddrSpace)
- const {
- if (AddrSpace == PIC16ISD::ROM_SPACE)
- return RomData16bitsDirective;
- else
- return Data16bitsDirective;
- }
-const char *PIC16TargetAsmInfo::getData32bitsDirective(unsigned AddrSpace)
- const {
- if (AddrSpace == PIC16ISD::ROM_SPACE)
- return RomData32bitsDirective;
- else
- return Data32bitsDirective;
- }
+const char *PIC16TargetAsmInfo::getASDirective(unsigned size,
+ unsigned AS) const {
+ if (AS == PIC16ISD::ROM_SPACE)
+ return getRomDirective(size);
+ else
+ return NULL;
+}
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h?rev=63521&r1=63520&r2=63521&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h Mon Feb 2 10:53:06 2009
@@ -23,13 +23,12 @@
struct PIC16TargetAsmInfo : public TargetAsmInfo {
PIC16TargetAsmInfo(const PIC16TargetMachine &TM);
+ private:
const char *RomData8bitsDirective;
const char *RomData16bitsDirective;
const char *RomData32bitsDirective;
- public :
- virtual const char *getData8bitsDirective(unsigned AddrSpace = 0) const;
- virtual const char *getData16bitsDirective(unsigned AddrSpace = 0) const;
- virtual const char *getData32bitsDirective(unsigned AddrSpace = 0) const;
+ const char *getRomDirective(unsigned size) const;
+ virtual const char *getASDirective(unsigned size, unsigned AS) const;
};
} // namespace llvm
More information about the llvm-commits
mailing list