Reflects ISD::LOAD / ISD::LOADX / LoadSDNode changes.
[oota-llvm.git] / lib / Target / X86 / X86IntelAsmPrinter.cpp
index ddbe2e0530ff02acf3f908872871eb22b0ba3497..a7d1351e7a06b171e6ec17e2cd4aa667377fefc3 100755 (executable)
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
 
+std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const {
+  // Intel asm always emits functions to _text.
+  return "_text";
+}
+
 /// runOnMachineFunction - This uses the printMachineInstruction()
 /// method to print assembly for each instruction.
 ///
@@ -36,21 +41,21 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   EmitConstantPool(MF.getConstantPool());
 
   // Print out labels for the function.
-  const FunctionF = MF.getFunction();
+  const Function *F = MF.getFunction();
   unsigned CC = F->getCallingConv();
 
   // Populate function information map.  Actually, We don't want to populate
   // non-stdcall or non-fastcall functions' information right now.
-  if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) {
-    FunctionInfoMap[F] = *(MF.getInfo<X86FunctionInfo>());
-  }
+  if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall)
+    FunctionInfoMap[F] = *MF.getInfo<X86FunctionInfo>();
 
   X86SharedAsmPrinter::decorateName(CurrentFnName, F);
 
+  SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
+
   switch (F->getLinkage()) {
   default: assert(0 && "Unsupported linkage type!");
   case Function::InternalLinkage:
-    SwitchToTextSection("_text", F);
     EmitAlignment(4);
     break;    
   case Function::DLLExportLinkage:
@@ -58,7 +63,6 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     //FALLS THROUGH
   case Function::ExternalLinkage:
     O << "\tpublic " << CurrentFnName << "\n";
-    SwitchToTextSection("_text", F);
     EmitAlignment(4);
     break;    
   }
@@ -81,6 +85,9 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     }
   }
 
+  // Print out jump tables referenced by the function.
+  EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
+
   O << CurrentFnName << "\tendp\n";
 
   // We didn't modify anything.