2006-09-06 19:21:41 +00:00
|
|
|
//===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
|
2006-09-06 18:35:33 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by James M. Laskey and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines target asm properties related what form asm statements
|
|
|
|
// should take.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
TargetAsmInfo::TargetAsmInfo() :
|
|
|
|
TextSection(".text"),
|
|
|
|
DataSection(".data"),
|
2007-01-17 10:33:08 +00:00
|
|
|
BSSSection(".bss"),
|
2007-01-17 17:42:42 +00:00
|
|
|
ZeroFillDirective(0),
|
2006-09-06 18:35:33 +00:00
|
|
|
AddressSize(4),
|
|
|
|
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(""),
|
|
|
|
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),
|
|
|
|
SwitchToSectionDirective("\t.section\t"),
|
|
|
|
TextSectionStartSuffix(""),
|
|
|
|
DataSectionStartSuffix(""),
|
|
|
|
SectionEndDirectiveSuffix(0),
|
|
|
|
ConstantPoolSection("\t.section .rodata\n"),
|
|
|
|
JumpTableDataSection("\t.section .rodata\n"),
|
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-01-29 18:51:14 +00:00
|
|
|
GlobalDirective(0),
|
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-01-14 06:27:21 +00:00
|
|
|
HiddenDirective("\t.hidden\t"),
|
2006-09-06 18:35:33 +00:00
|
|
|
HasLEB128(false),
|
|
|
|
HasDotLoc(false),
|
|
|
|
HasDotFile(false),
|
2007-01-29 18:51:14 +00:00
|
|
|
SupportsExceptionHandling(false),
|
2006-10-30 22:32:30 +00:00
|
|
|
DwarfRequiresFrameSection(true),
|
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.
|
|
|
|
unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const {
|
|
|
|
// Count the number of instructions in the asm.
|
|
|
|
unsigned NumInsts = 0;
|
|
|
|
for (; *Str; ++Str) {
|
|
|
|
if (*Str == '\n' || *Str == SeparatorChar)
|
|
|
|
++NumInsts;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Multiply by the worst-case length for each instruction.
|
|
|
|
return NumInsts * MaxInstLength;
|
|
|
|
}
|