2006-09-06 19:21:41 +00:00
|
|
|
//===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
|
2006-09-06 18:35:33 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-09-06 18:35:33 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines target asm properties related what form asm statements
|
|
|
|
// should take.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
2008-02-27 23:33:50 +00:00
|
|
|
#include "llvm/Support/Dwarf.h"
|
2007-04-23 20:00:17 +00:00
|
|
|
#include <cctype>
|
|
|
|
#include <cstring>
|
2006-09-06 18:35:33 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
TargetAsmInfo::TargetAsmInfo() :
|
2007-05-03 18:46:30 +00:00
|
|
|
TextSection("\t.text"),
|
|
|
|
DataSection("\t.data"),
|
|
|
|
BSSSection("\t.bss"),
|
2007-04-20 21:38:10 +00:00
|
|
|
TLSDataSection("\t.section .tdata,\"awT\",@progbits"),
|
|
|
|
TLSBSSSection("\t.section .tbss,\"awT\",@nobits"),
|
2007-01-17 17:42:42 +00:00
|
|
|
ZeroFillDirective(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
NeedsSet(false),
|
2006-10-13 17:50:07 +00:00
|
|
|
MaxInstLength(4),
|
2007-02-01 16:31:34 +00:00
|
|
|
PCSymbol("$"),
|
2006-10-13 17:50:07 +00:00
|
|
|
SeparatorChar(';'),
|
2006-09-06 18:35:33 +00:00
|
|
|
CommentString("#"),
|
|
|
|
GlobalPrefix(""),
|
|
|
|
PrivateGlobalPrefix("."),
|
2007-01-18 01:12:56 +00:00
|
|
|
JumpTableSpecialLabelPrefix(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
GlobalVarAddrPrefix(""),
|
|
|
|
GlobalVarAddrSuffix(""),
|
|
|
|
FunctionAddrPrefix(""),
|
|
|
|
FunctionAddrSuffix(""),
|
2007-09-11 08:27:17 +00:00
|
|
|
PersonalityPrefix(""),
|
|
|
|
PersonalitySuffix(""),
|
2007-09-11 17:20:55 +00:00
|
|
|
NeedsIndirectEncoding(false),
|
2006-09-06 18:35:33 +00:00
|
|
|
InlineAsmStart("#APP"),
|
|
|
|
InlineAsmEnd("#NO_APP"),
|
2007-01-16 03:42:04 +00:00
|
|
|
AssemblerDialect(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
ZeroDirective("\t.zero\t"),
|
|
|
|
ZeroDirectiveSuffix(0),
|
|
|
|
AsciiDirective("\t.ascii\t"),
|
|
|
|
AscizDirective("\t.asciz\t"),
|
|
|
|
Data8bitsDirective("\t.byte\t"),
|
|
|
|
Data16bitsDirective("\t.short\t"),
|
|
|
|
Data32bitsDirective("\t.long\t"),
|
|
|
|
Data64bitsDirective("\t.quad\t"),
|
|
|
|
AlignDirective("\t.align\t"),
|
|
|
|
AlignmentIsInBytes(true),
|
2008-02-28 22:14:09 +00:00
|
|
|
TextAlignFillValue(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
SwitchToSectionDirective("\t.section\t"),
|
|
|
|
TextSectionStartSuffix(""),
|
|
|
|
DataSectionStartSuffix(""),
|
|
|
|
SectionEndDirectiveSuffix(0),
|
2007-06-14 15:00:27 +00:00
|
|
|
ConstantPoolSection("\t.section .rodata"),
|
|
|
|
JumpTableDataSection("\t.section .rodata"),
|
2006-09-24 19:45:58 +00:00
|
|
|
JumpTableDirective(0),
|
2006-10-27 16:14:06 +00:00
|
|
|
CStringSection(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
|
|
|
|
StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
|
|
|
|
FourByteConstantSection(0),
|
|
|
|
EightByteConstantSection(0),
|
|
|
|
SixteenByteConstantSection(0),
|
2007-03-08 01:00:38 +00:00
|
|
|
ReadOnlySection(0),
|
2007-12-23 20:58:16 +00:00
|
|
|
GlobalDirective("\t.globl\t"),
|
2006-09-06 18:35:33 +00:00
|
|
|
SetDirective(0),
|
|
|
|
LCOMMDirective(0),
|
|
|
|
COMMDirective("\t.comm\t"),
|
|
|
|
COMMDirectiveTakesAlignment(true),
|
|
|
|
HasDotTypeDotSizeDirective(true),
|
2006-09-26 03:38:18 +00:00
|
|
|
UsedDirective(0),
|
2006-12-01 20:47:11 +00:00
|
|
|
WeakRefDirective(0),
|
2007-11-20 23:24:42 +00:00
|
|
|
WeakDefDirective(0),
|
2007-01-14 06:27:21 +00:00
|
|
|
HiddenDirective("\t.hidden\t"),
|
2007-04-29 18:35:00 +00:00
|
|
|
ProtectedDirective("\t.protected\t"),
|
2007-05-01 22:23:12 +00:00
|
|
|
AbsoluteDebugSectionOffsets(false),
|
|
|
|
AbsoluteEHSectionOffsets(false),
|
2006-09-06 18:35:33 +00:00
|
|
|
HasLEB128(false),
|
2007-09-24 21:09:53 +00:00
|
|
|
HasDotLocAndDotFile(false),
|
2007-05-05 09:04:50 +00:00
|
|
|
SupportsDebugInformation(false),
|
2007-01-29 18:51:14 +00:00
|
|
|
SupportsExceptionHandling(false),
|
2006-10-30 22:32:30 +00:00
|
|
|
DwarfRequiresFrameSection(true),
|
2007-11-21 00:45:00 +00:00
|
|
|
GlobalEHDirective(0),
|
2008-01-10 02:03:30 +00:00
|
|
|
SupportsWeakOmittedEHFrame(true),
|
2008-01-15 23:25:27 +00:00
|
|
|
ShortenEHDataOn64Bit(false),
|
2007-03-07 02:47:57 +00:00
|
|
|
DwarfSectionOffsetDirective(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
DwarfAbbrevSection(".debug_abbrev"),
|
|
|
|
DwarfInfoSection(".debug_info"),
|
|
|
|
DwarfLineSection(".debug_line"),
|
|
|
|
DwarfFrameSection(".debug_frame"),
|
|
|
|
DwarfPubNamesSection(".debug_pubnames"),
|
|
|
|
DwarfPubTypesSection(".debug_pubtypes"),
|
|
|
|
DwarfStrSection(".debug_str"),
|
|
|
|
DwarfLocSection(".debug_loc"),
|
|
|
|
DwarfARangesSection(".debug_aranges"),
|
|
|
|
DwarfRangesSection(".debug_ranges"),
|
2006-11-28 19:52:20 +00:00
|
|
|
DwarfMacInfoSection(".debug_macinfo"),
|
2007-02-01 16:31:34 +00:00
|
|
|
DwarfEHFrameSection(".eh_frame"),
|
2007-02-21 22:43:40 +00:00
|
|
|
DwarfExceptionSection(".gcc_except_table"),
|
2006-11-28 19:52:20 +00:00
|
|
|
AsmTransCBE(0) {
|
2006-10-13 17:50:07 +00:00
|
|
|
}
|
2006-10-05 00:35:16 +00:00
|
|
|
|
|
|
|
TargetAsmInfo::~TargetAsmInfo() {
|
|
|
|
}
|
2006-10-13 17:50:07 +00:00
|
|
|
|
|
|
|
/// Measure the specified inline asm to determine an approximation of its
|
|
|
|
/// length.
|
2007-04-23 20:00:17 +00:00
|
|
|
/// Comments (which run till the next SeparatorChar or newline) do not
|
|
|
|
/// count as an instruction.
|
|
|
|
/// Any other non-whitespace text is considered an instruction, with
|
|
|
|
/// multiple instructions separated by SeparatorChar or newlines.
|
|
|
|
/// Variable-length instructions are not handled here; this function
|
|
|
|
/// may be overloaded in the target code to do that.
|
2006-10-13 17:50:07 +00:00
|
|
|
unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const {
|
|
|
|
// Count the number of instructions in the asm.
|
2007-04-23 20:00:17 +00:00
|
|
|
bool atInsnStart = true;
|
|
|
|
unsigned Length = 0;
|
2006-10-13 17:50:07 +00:00
|
|
|
for (; *Str; ++Str) {
|
|
|
|
if (*Str == '\n' || *Str == SeparatorChar)
|
2007-04-23 20:00:17 +00:00
|
|
|
atInsnStart = true;
|
|
|
|
if (atInsnStart && !isspace(*Str)) {
|
|
|
|
Length += MaxInstLength;
|
|
|
|
atInsnStart = false;
|
|
|
|
}
|
|
|
|
if (atInsnStart && strncmp(Str, CommentString, strlen(CommentString))==0)
|
|
|
|
atInsnStart = false;
|
2006-10-13 17:50:07 +00:00
|
|
|
}
|
|
|
|
|
2007-04-23 20:00:17 +00:00
|
|
|
return Length;
|
2006-10-13 17:50:07 +00:00
|
|
|
}
|
2007-03-07 02:47:57 +00:00
|
|
|
|
2008-02-27 23:33:50 +00:00
|
|
|
unsigned TargetAsmInfo::PreferredEHDataFormat(unsigned Reason,
|
|
|
|
bool Global) const {
|
|
|
|
return dwarf::DW_EH_PE_absptr;
|
|
|
|
}
|
|
|
|
|