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
This commit is contained in:
Sanjiv Gupta
2009-02-02 16:53:06 +00:00
parent 4b3dfbd220
commit 3b020feb57
3 changed files with 40 additions and 34 deletions

View File

@@ -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 {