initial implementation of addressing mode 2
[oota-llvm.git] / lib / Target / TargetAsmInfo.cpp
index 6efcf4be2455242740ba020baf6c0b6d9fc1b005..d68affd96b18124da5b370598a58fe0f68c1506c 100644 (file)
@@ -21,6 +21,8 @@ TargetAsmInfo::TargetAsmInfo() :
   DataSection(".data"),
   AddressSize(4),
   NeedsSet(false),
+  MaxInstLength(4),
+  SeparatorChar(';'),
   CommentString("#"),
   GlobalPrefix(""),
   PrivateGlobalPrefix("."),
@@ -46,8 +48,8 @@ TargetAsmInfo::TargetAsmInfo() :
   SectionEndDirectiveSuffix(0),
   ConstantPoolSection("\t.section .rodata\n"),
   JumpTableDataSection("\t.section .rodata\n"),
-  JumpTableTextSection("\t.text\n"),
   JumpTableDirective(0),
+  CStringSection(0),
   StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
   StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
   FourByteConstantSection(0),
@@ -58,9 +60,11 @@ TargetAsmInfo::TargetAsmInfo() :
   COMMDirective("\t.comm\t"),
   COMMDirectiveTakesAlignment(true),
   HasDotTypeDotSizeDirective(true),
+  UsedDirective(0),
   HasLEB128(false),
   HasDotLoc(false),
   HasDotFile(false),
+  DwarfRequiresFrameSection(true),
   DwarfAbbrevSection(".debug_abbrev"),
   DwarfInfoSection(".debug_info"),
   DwarfLineSection(".debug_line"),
@@ -71,5 +75,22 @@ TargetAsmInfo::TargetAsmInfo() :
   DwarfLocSection(".debug_loc"),
   DwarfARangesSection(".debug_aranges"),
   DwarfRangesSection(".debug_ranges"),
-  DwarfMacInfoSection(".debug_macinfo")
-{}
+  DwarfMacInfoSection(".debug_macinfo") {
+}
+
+TargetAsmInfo::~TargetAsmInfo() {
+}
+
+/// 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;
+}