Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 1 | //===-- PIC16TargetAsmInfo.cpp - PIC16 asm properties ---------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the declarations of the PIC16TargetAsmInfo properties. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "PIC16TargetAsmInfo.h" |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 15 | #include "PIC16TargetMachine.h" |
Sanjiv Gupta | 1b04694 | 2009-01-13 19:18:47 +0000 | [diff] [blame] | 16 | #include "llvm/GlobalValue.h" |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 17 | |
| 18 | using namespace llvm; |
| 19 | |
| 20 | PIC16TargetAsmInfo:: |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 21 | PIC16TargetAsmInfo(const PIC16TargetMachine &TM) |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 22 | : TargetAsmInfo(TM) { |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 23 | CommentString = ";"; |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 24 | Data8bitsDirective = " db "; |
Sanjiv Gupta | c8d7bc8 | 2009-01-30 04:25:10 +0000 | [diff] [blame] | 25 | Data16bitsDirective = " dw "; |
| 26 | Data32bitsDirective = " dl "; |
| 27 | RomData8bitsDirective = " dw "; |
| 28 | RomData16bitsDirective = " rom_di "; |
Sanjiv Gupta | 3b020fe | 2009-02-02 16:53:06 +0000 | [diff] [blame^] | 29 | RomData32bitsDirective = " rom_dl "; |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 30 | ZeroDirective = NULL; |
Sanjiv Gupta | 1b04694 | 2009-01-13 19:18:47 +0000 | [diff] [blame] | 31 | AsciiDirective = " dt "; |
| 32 | AscizDirective = NULL; |
| 33 | BSSSection_ = getNamedSection("udata.# UDATA", |
| 34 | SectionFlags::Writeable | SectionFlags::BSS); |
| 35 | ReadOnlySection = getNamedSection("romdata.# ROMDATA", SectionFlags::None); |
| 36 | DataSection = getNamedSection("idata.# IDATA", SectionFlags::Writeable); |
| 37 | SwitchToSectionDirective = ""; |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 38 | } |
Sanjiv Gupta | c8d7bc8 | 2009-01-30 04:25:10 +0000 | [diff] [blame] | 39 | |
Sanjiv Gupta | 3b020fe | 2009-02-02 16:53:06 +0000 | [diff] [blame^] | 40 | const char *PIC16TargetAsmInfo::getRomDirective(unsigned size) const |
| 41 | { |
| 42 | if (size == 8) |
| 43 | return RomData8bitsDirective; |
| 44 | else if (size == 16) |
| 45 | return RomData16bitsDirective; |
| 46 | else if (size == 32) |
| 47 | return RomData32bitsDirective; |
| 48 | else |
| 49 | return NULL; |
| 50 | } |
Sanjiv Gupta | c8d7bc8 | 2009-01-30 04:25:10 +0000 | [diff] [blame] | 51 | |
Sanjiv Gupta | c8d7bc8 | 2009-01-30 04:25:10 +0000 | [diff] [blame] | 52 | |
Sanjiv Gupta | 3b020fe | 2009-02-02 16:53:06 +0000 | [diff] [blame^] | 53 | const char *PIC16TargetAsmInfo::getASDirective(unsigned size, |
| 54 | unsigned AS) const { |
| 55 | if (AS == PIC16ISD::ROM_SPACE) |
| 56 | return getRomDirective(size); |
| 57 | else |
| 58 | return NULL; |
| 59 | } |
Sanjiv Gupta | c8d7bc8 | 2009-01-30 04:25:10 +0000 | [diff] [blame] | 60 | |