| Jim Laskey | 7c95ad4 | 2006-09-06 19:21:41 +0000 | [diff] [blame] | 1 | //===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==// | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 2 | // | 
|  | 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 |  | 
|  | 17 | using namespace llvm; | 
|  | 18 |  | 
|  | 19 | TargetAsmInfo::TargetAsmInfo() : | 
|  | 20 | TextSection(".text"), | 
|  | 21 | DataSection(".data"), | 
| Anton Korobeynikov | 5032e5a | 2007-01-17 10:33:08 +0000 | [diff] [blame] | 22 | BSSSection(".bss"), | 
| Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame^] | 23 | TLSDataSection("\t.section .tdata,\"awT\",@progbits"), | 
|  | 24 | TLSBSSSection("\t.section .tbss,\"awT\",@nobits"), | 
| Chris Lattner | 6f198df | 2007-01-17 17:42:42 +0000 | [diff] [blame] | 25 | ZeroFillDirective(0), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 26 | AddressSize(4), | 
|  | 27 | NeedsSet(false), | 
| Chris Lattner | 4c7b07a | 2006-10-13 17:50:07 +0000 | [diff] [blame] | 28 | MaxInstLength(4), | 
| Jim Laskey | b82313f | 2007-02-01 16:31:34 +0000 | [diff] [blame] | 29 | PCSymbol("$"), | 
| Chris Lattner | 4c7b07a | 2006-10-13 17:50:07 +0000 | [diff] [blame] | 30 | SeparatorChar(';'), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 31 | CommentString("#"), | 
|  | 32 | GlobalPrefix(""), | 
|  | 33 | PrivateGlobalPrefix("."), | 
| Chris Lattner | 393a8ee | 2007-01-18 01:12:56 +0000 | [diff] [blame] | 34 | JumpTableSpecialLabelPrefix(0), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 35 | GlobalVarAddrPrefix(""), | 
|  | 36 | GlobalVarAddrSuffix(""), | 
|  | 37 | FunctionAddrPrefix(""), | 
|  | 38 | FunctionAddrSuffix(""), | 
|  | 39 | InlineAsmStart("#APP"), | 
|  | 40 | InlineAsmEnd("#NO_APP"), | 
| Bill Wendling | eb9a42c | 2007-01-16 03:42:04 +0000 | [diff] [blame] | 41 | AssemblerDialect(0), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 42 | 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 Lenharth | beec30e | 2006-09-24 19:45:58 +0000 | [diff] [blame] | 58 | JumpTableDirective(0), | 
| Reid Spencer | c50209b | 2006-10-27 16:14:06 +0000 | [diff] [blame] | 59 | CStringSection(0), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 60 | StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"), | 
|  | 61 | StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"), | 
|  | 62 | FourByteConstantSection(0), | 
|  | 63 | EightByteConstantSection(0), | 
|  | 64 | SixteenByteConstantSection(0), | 
| Evan Cheng | be346c9 | 2007-03-08 01:00:38 +0000 | [diff] [blame] | 65 | ReadOnlySection(0), | 
| Jim Laskey | 072200c | 2007-01-29 18:51:14 +0000 | [diff] [blame] | 66 | GlobalDirective(0), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 67 | SetDirective(0), | 
|  | 68 | LCOMMDirective(0), | 
|  | 69 | COMMDirective("\t.comm\t"), | 
|  | 70 | COMMDirectiveTakesAlignment(true), | 
|  | 71 | HasDotTypeDotSizeDirective(true), | 
| Chris Lattner | cb05af8 | 2006-09-26 03:38:18 +0000 | [diff] [blame] | 72 | UsedDirective(0), | 
| Evan Cheng | 8752ce6 | 2006-12-01 20:47:11 +0000 | [diff] [blame] | 73 | WeakRefDirective(0), | 
| Chris Lattner | 9784bc7 | 2007-01-14 06:27:21 +0000 | [diff] [blame] | 74 | HiddenDirective("\t.hidden\t"), | 
| Anton Korobeynikov | a6199c8 | 2007-03-07 02:47:57 +0000 | [diff] [blame] | 75 | AbsoluteSectionOffsets(false), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 76 | HasLEB128(false), | 
|  | 77 | HasDotLoc(false), | 
|  | 78 | HasDotFile(false), | 
| Jim Laskey | 072200c | 2007-01-29 18:51:14 +0000 | [diff] [blame] | 79 | SupportsExceptionHandling(false), | 
| Reid Spencer | 02b8511 | 2006-10-30 22:32:30 +0000 | [diff] [blame] | 80 | DwarfRequiresFrameSection(true), | 
| Anton Korobeynikov | a6199c8 | 2007-03-07 02:47:57 +0000 | [diff] [blame] | 81 | DwarfSectionOffsetDirective(0), | 
| Jim Laskey | ec0d9fe | 2006-09-06 18:35:33 +0000 | [diff] [blame] | 82 | 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 Lenharth | 3655de6 | 2006-11-28 19:52:20 +0000 | [diff] [blame] | 92 | DwarfMacInfoSection(".debug_macinfo"), | 
| Jim Laskey | b82313f | 2007-02-01 16:31:34 +0000 | [diff] [blame] | 93 | DwarfEHFrameSection(".eh_frame"), | 
| Jim Laskey | a15be8c | 2007-02-21 22:43:40 +0000 | [diff] [blame] | 94 | DwarfExceptionSection(".gcc_except_table"), | 
| Andrew Lenharth | 3655de6 | 2006-11-28 19:52:20 +0000 | [diff] [blame] | 95 | AsmTransCBE(0) { | 
| Chris Lattner | 4c7b07a | 2006-10-13 17:50:07 +0000 | [diff] [blame] | 96 | } | 
| Chris Lattner | f5b10ec | 2006-10-05 00:35:16 +0000 | [diff] [blame] | 97 |  | 
|  | 98 | TargetAsmInfo::~TargetAsmInfo() { | 
|  | 99 | } | 
| Chris Lattner | 4c7b07a | 2006-10-13 17:50:07 +0000 | [diff] [blame] | 100 |  | 
|  | 101 | /// Measure the specified inline asm to determine an approximation of its | 
|  | 102 | /// length. | 
|  | 103 | unsigned 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 Korobeynikov | a6199c8 | 2007-03-07 02:47:57 +0000 | [diff] [blame] | 114 |  |