blob: 6b0a0d029a83b87f8757485c3a66b9663c538446 [file] [log] [blame]
Sanjiv Gupta0e687712008-05-13 09:02:57 +00001//===-- 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 Gohman8f092252008-11-03 18:22:42 +000015#include "PIC16TargetMachine.h"
Sanjiv Gupta1b046942009-01-13 19:18:47 +000016#include "llvm/GlobalValue.h"
Sanjiv Gupta0e687712008-05-13 09:02:57 +000017
18using namespace llvm;
19
20PIC16TargetAsmInfo::
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000021PIC16TargetAsmInfo(const PIC16TargetMachine &TM)
Dan Gohman8f092252008-11-03 18:22:42 +000022 : TargetAsmInfo(TM) {
Sanjiv Gupta0e687712008-05-13 09:02:57 +000023 CommentString = ";";
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000024 Data8bitsDirective = " db ";
Sanjiv Guptac8d7bc82009-01-30 04:25:10 +000025 Data16bitsDirective = " dw ";
26 Data32bitsDirective = " dl ";
27 RomData8bitsDirective = " dw ";
28 RomData16bitsDirective = " rom_di ";
Sanjiv Gupta3b020fe2009-02-02 16:53:06 +000029 RomData32bitsDirective = " rom_dl ";
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000030 ZeroDirective = NULL;
Sanjiv Gupta1b046942009-01-13 19:18:47 +000031 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 Guptac1fa70c2009-04-08 06:24:04 +000038 // Need because otherwise a .text symbol is emitted by DwarfWriter
39 // in BeginModule, and gpasm cribbs for that .text symbol.
40 TextSection = getUnnamedSection("", SectionFlags::Code);
Sanjiv Gupta0e687712008-05-13 09:02:57 +000041}
Sanjiv Guptac8d7bc82009-01-30 04:25:10 +000042
Sanjiv Gupta3b020fe2009-02-02 16:53:06 +000043const char *PIC16TargetAsmInfo::getRomDirective(unsigned size) const
44{
45 if (size == 8)
46 return RomData8bitsDirective;
47 else if (size == 16)
48 return RomData16bitsDirective;
49 else if (size == 32)
50 return RomData32bitsDirective;
51 else
52 return NULL;
53}
Sanjiv Guptac8d7bc82009-01-30 04:25:10 +000054
Sanjiv Guptac8d7bc82009-01-30 04:25:10 +000055
Sanjiv Gupta3b020fe2009-02-02 16:53:06 +000056const char *PIC16TargetAsmInfo::getASDirective(unsigned size,
57 unsigned AS) const {
58 if (AS == PIC16ISD::ROM_SPACE)
59 return getRomDirective(size);
60 else
61 return NULL;
62}
Sanjiv Guptac8d7bc82009-01-30 04:25:10 +000063