llvm.org GIT mirror llvm / 3b020fe
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 Sanjiv Gupta 10 years ago
3 changed file(s) with 44 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
297297 const char *Data32bitsDirective; // Defaults to "\t.long\t"
298298 const char *Data64bitsDirective; // Defaults to "\t.quad\t"
299299
300 /// getASDirective - Targets can override it to provide different data
301 /// directives for various sizes and non-default address spaces.
302 virtual const char *getASDirective(unsigned size,
303 unsigned AS) const {
304 assert (AS > 0
305 && "Dont know the directives for default addr space");
306 return NULL;
307 }
308
300309 //===--- Alignment Information ----------------------------------------===//
301310
302311 /// AlignDirective - The directive used to emit round up to an alignment
599608
600609 // Data directive accessors
601610 //
602 virtual const char *getData8bitsDirective(unsigned AddrSpace = 0) const {
603 return Data8bitsDirective;
604 }
605 virtual const char *getData16bitsDirective(unsigned AddrSpace = 0) const {
606 return Data16bitsDirective;
607 }
608 virtual const char *getData32bitsDirective(unsigned AddrSpace = 0) const {
609 return Data32bitsDirective;
610 }
611 virtual const char *getData64bitsDirective(unsigned AddrSpace = 0) const {
612 return Data64bitsDirective;
613 }
611 const char *getData8bitsDirective(unsigned AS = 0) const {
612 return AS == 0 ? Data8bitsDirective : getASDirective(8, AS);
613 }
614 const char *getData16bitsDirective(unsigned AS = 0) const {
615 return AS == 0 ? Data16bitsDirective : getASDirective(16, AS);
616 }
617 const char *getData32bitsDirective(unsigned AS = 0) const {
618 return AS == 0 ? Data32bitsDirective : getASDirective(32, AS);
619 }
620 const char *getData64bitsDirective(unsigned AS = 0) const {
621 return AS == 0 ? Data64bitsDirective : getASDirective(64, AS);
622 }
623
614624
615625 // Accessors.
616626 //
2525 Data32bitsDirective = " dl ";
2626 RomData8bitsDirective = " dw ";
2727 RomData16bitsDirective = " rom_di ";
28 RomData8bitsDirective = " rom_dl ";
28 RomData32bitsDirective = " rom_dl ";
2929 ZeroDirective = NULL;
3030 AsciiDirective = " dt ";
3131 AscizDirective = NULL;
3636 SwitchToSectionDirective = "";
3737 }
3838
39 const char *PIC16TargetAsmInfo::getData8bitsDirective(unsigned AddrSpace)
40 const {
41 if (AddrSpace == PIC16ISD::ROM_SPACE)
42 return RomData8bitsDirective;
43 else
44 return Data8bitsDirective;
45 }
39 const char *PIC16TargetAsmInfo::getRomDirective(unsigned size) const
40 {
41 if (size == 8)
42 return RomData8bitsDirective;
43 else if (size == 16)
44 return RomData16bitsDirective;
45 else if (size == 32)
46 return RomData32bitsDirective;
47 else
48 return NULL;
49 }
4650
47 const char *PIC16TargetAsmInfo::getData16bitsDirective(unsigned AddrSpace)
48 const {
49 if (AddrSpace == PIC16ISD::ROM_SPACE)
50 return RomData16bitsDirective;
51 else
52 return Data16bitsDirective;
53 }
5451
55 const char *PIC16TargetAsmInfo::getData32bitsDirective(unsigned AddrSpace)
56 const {
57 if (AddrSpace == PIC16ISD::ROM_SPACE)
58 return RomData32bitsDirective;
59 else
60 return Data32bitsDirective;
61 }
52 const char *PIC16TargetAsmInfo::getASDirective(unsigned size,
53 unsigned AS) const {
54 if (AS == PIC16ISD::ROM_SPACE)
55 return getRomDirective(size);
56 else
57 return NULL;
58 }
6259
2222
2323 struct PIC16TargetAsmInfo : public TargetAsmInfo {
2424 PIC16TargetAsmInfo(const PIC16TargetMachine &TM);
25 private:
2526 const char *RomData8bitsDirective;
2627 const char *RomData16bitsDirective;
2728 const char *RomData32bitsDirective;
28 public :
29 virtual const char *getData8bitsDirective(unsigned AddrSpace = 0) const;
30 virtual const char *getData16bitsDirective(unsigned AddrSpace = 0) const;
31 virtual const char *getData32bitsDirective(unsigned AddrSpace = 0) const;
29 const char *getRomDirective(unsigned size) const;
30 virtual const char *getASDirective(unsigned size, unsigned AS) const;
3231 };
3332
3433 } // namespace llvm