mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
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.
llvm-svn: 63521
This commit is contained in:
parent
b469789780
commit
c47a19b23e
@ -298,6 +298,15 @@ namespace llvm {
|
||||
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 @@ namespace llvm {
|
||||
|
||||
// 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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user