diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-02-02 16:53:06 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-02-02 16:53:06 +0000 |
commit | 46fc9fe2eb839f8fbff496e4015b1502f302e794 (patch) | |
tree | cf6d8fe1e2a19f0886f884d315a67731c4444ec4 /lib/Target/PIC16 | |
parent | 641f12c6c27942d1b336a623954b0d44b3328fcd (diff) | |
download | external_llvm-46fc9fe2eb839f8fbff496e4015b1502f302e794.zip external_llvm-46fc9fe2eb839f8fbff496e4015b1502f302e794.tar.gz external_llvm-46fc9fe2eb839f8fbff496e4015b1502f302e794.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16')
-rw-r--r-- | lib/Target/PIC16/PIC16TargetAsmInfo.cpp | 41 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16TargetAsmInfo.h | 7 |
2 files changed, 22 insertions, 26 deletions
diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp index b86576b..d40f206 100644 --- a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp +++ b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp @@ -26,7 +26,7 @@ PIC16TargetAsmInfo(const PIC16TargetMachine &TM) Data32bitsDirective = " dl "; RomData8bitsDirective = " dw "; RomData16bitsDirective = " rom_di "; - RomData8bitsDirective = " rom_dl "; + RomData32bitsDirective = " rom_dl "; ZeroDirective = NULL; AsciiDirective = " dt "; AscizDirective = NULL; @@ -37,27 +37,24 @@ PIC16TargetAsmInfo(const PIC16TargetMachine &TM) 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; +} diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.h b/lib/Target/PIC16/PIC16TargetAsmInfo.h index b75699b..305e74d 100644 --- a/lib/Target/PIC16/PIC16TargetAsmInfo.h +++ b/lib/Target/PIC16/PIC16TargetAsmInfo.h @@ -23,13 +23,12 @@ namespace llvm { 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 |