blob: 62c8b90e7bf7659ed102b151c09bb1f9bd32e59b [file] [log] [blame]
Jim Laskey7c95ad42006-09-06 19:21:41 +00001//===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
Jim Laskeyec0d9fe2006-09-06 18:35:33 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by James M. Laskey and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines target asm properties related what form asm statements
11// should take.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/Target/TargetAsmInfo.h"
16
17using namespace llvm;
18
19TargetAsmInfo::TargetAsmInfo() :
20 TextSection(".text"),
21 DataSection(".data"),
Anton Korobeynikov5032e5a2007-01-17 10:33:08 +000022 BSSSection(".bss"),
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +000023 TLSDataSection("\t.section .tdata,\"awT\",@progbits"),
24 TLSBSSSection("\t.section .tbss,\"awT\",@nobits"),
Chris Lattner6f198df2007-01-17 17:42:42 +000025 ZeroFillDirective(0),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000026 AddressSize(4),
27 NeedsSet(false),
Chris Lattner4c7b07a2006-10-13 17:50:07 +000028 MaxInstLength(4),
Jim Laskeyb82313f2007-02-01 16:31:34 +000029 PCSymbol("$"),
Chris Lattner4c7b07a2006-10-13 17:50:07 +000030 SeparatorChar(';'),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000031 CommentString("#"),
32 GlobalPrefix(""),
33 PrivateGlobalPrefix("."),
Chris Lattner393a8ee2007-01-18 01:12:56 +000034 JumpTableSpecialLabelPrefix(0),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000035 GlobalVarAddrPrefix(""),
36 GlobalVarAddrSuffix(""),
37 FunctionAddrPrefix(""),
38 FunctionAddrSuffix(""),
39 InlineAsmStart("#APP"),
40 InlineAsmEnd("#NO_APP"),
Bill Wendlingeb9a42c2007-01-16 03:42:04 +000041 AssemblerDialect(0),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000042 ZeroDirective("\t.zero\t"),
43 ZeroDirectiveSuffix(0),
44 AsciiDirective("\t.ascii\t"),
45 AscizDirective("\t.asciz\t"),
46 Data8bitsDirective("\t.byte\t"),
47 Data16bitsDirective("\t.short\t"),
48 Data32bitsDirective("\t.long\t"),
49 Data64bitsDirective("\t.quad\t"),
50 AlignDirective("\t.align\t"),
51 AlignmentIsInBytes(true),
52 SwitchToSectionDirective("\t.section\t"),
53 TextSectionStartSuffix(""),
54 DataSectionStartSuffix(""),
55 SectionEndDirectiveSuffix(0),
56 ConstantPoolSection("\t.section .rodata\n"),
57 JumpTableDataSection("\t.section .rodata\n"),
Andrew Lenharthbeec30e2006-09-24 19:45:58 +000058 JumpTableDirective(0),
Reid Spencerc50209b2006-10-27 16:14:06 +000059 CStringSection(0),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000060 StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
61 StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
62 FourByteConstantSection(0),
63 EightByteConstantSection(0),
64 SixteenByteConstantSection(0),
Evan Chengbe346c92007-03-08 01:00:38 +000065 ReadOnlySection(0),
Jim Laskey072200c2007-01-29 18:51:14 +000066 GlobalDirective(0),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000067 SetDirective(0),
68 LCOMMDirective(0),
69 COMMDirective("\t.comm\t"),
70 COMMDirectiveTakesAlignment(true),
71 HasDotTypeDotSizeDirective(true),
Chris Lattnercb05af82006-09-26 03:38:18 +000072 UsedDirective(0),
Evan Cheng8752ce62006-12-01 20:47:11 +000073 WeakRefDirective(0),
Chris Lattner9784bc72007-01-14 06:27:21 +000074 HiddenDirective("\t.hidden\t"),
Anton Korobeynikova6199c82007-03-07 02:47:57 +000075 AbsoluteSectionOffsets(false),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000076 HasLEB128(false),
77 HasDotLoc(false),
78 HasDotFile(false),
Jim Laskey072200c2007-01-29 18:51:14 +000079 SupportsExceptionHandling(false),
Reid Spencer02b85112006-10-30 22:32:30 +000080 DwarfRequiresFrameSection(true),
Anton Korobeynikova6199c82007-03-07 02:47:57 +000081 DwarfSectionOffsetDirective(0),
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000082 DwarfAbbrevSection(".debug_abbrev"),
83 DwarfInfoSection(".debug_info"),
84 DwarfLineSection(".debug_line"),
85 DwarfFrameSection(".debug_frame"),
86 DwarfPubNamesSection(".debug_pubnames"),
87 DwarfPubTypesSection(".debug_pubtypes"),
88 DwarfStrSection(".debug_str"),
89 DwarfLocSection(".debug_loc"),
90 DwarfARangesSection(".debug_aranges"),
91 DwarfRangesSection(".debug_ranges"),
Andrew Lenharth3655de62006-11-28 19:52:20 +000092 DwarfMacInfoSection(".debug_macinfo"),
Jim Laskeyb82313f2007-02-01 16:31:34 +000093 DwarfEHFrameSection(".eh_frame"),
Jim Laskeya15be8c2007-02-21 22:43:40 +000094 DwarfExceptionSection(".gcc_except_table"),
Andrew Lenharth3655de62006-11-28 19:52:20 +000095 AsmTransCBE(0) {
Chris Lattner4c7b07a2006-10-13 17:50:07 +000096}
Chris Lattnerf5b10ec2006-10-05 00:35:16 +000097
98TargetAsmInfo::~TargetAsmInfo() {
99}
Chris Lattner4c7b07a2006-10-13 17:50:07 +0000100
101/// Measure the specified inline asm to determine an approximation of its
102/// length.
103unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const {
104 // Count the number of instructions in the asm.
105 unsigned NumInsts = 0;
106 for (; *Str; ++Str) {
107 if (*Str == '\n' || *Str == SeparatorChar)
108 ++NumInsts;
109 }
110
111 // Multiply by the worst-case length for each instruction.
112 return NumInsts * MaxInstLength;
113}
Anton Korobeynikova6199c82007-03-07 02:47:57 +0000114