//
//===----------------------------------------------------------------------===//
+#include "X86AsmPrinter.h"
#include "X86ATTAsmPrinter.h"
#include "X86IntelAsmPrinter.h"
#include "X86Subtarget.h"
-#include "X86.h"
#include "llvm/Constants.h"
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
-using namespace x86;
-Statistic<> llvm::x86::EmittedInsts("asm-printer",
- "Number of machine instrs printed");
+Statistic<> llvm::EmittedInsts("asm-printer",
+ "Number of machine instrs printed");
enum AsmWriterFlavorTy { att, intel };
cl::opt<AsmWriterFlavorTy>
default: break;
}
- // Emit initial debug information.
- DW.BeginModule(M);
+ if (forDarwin) {
+ // Emit initial debug information.
+ DW.BeginModule(&M);
+ }
return AsmPrinter::doInitialization(M);
}
if (!I->hasInitializer()) continue; // External global require no code
// Check to see if this is a special global used by LLVM, if so, emit it.
- if (I->hasAppendingLinkage() && EmitSpecialLLVMGlobal(I))
+ if (EmitSpecialLLVMGlobal(I))
continue;
std::string name = Mang->getValueName(I);
O << "\t.indirect_symbol " << *i << "\n";
O << "\t.long\t0\n";
}
- }
- // Emit initial debug information.
- DW.EndModule(M);
+ // Emit initial debug information.
+ DW.EndModule();
+
+ // Funny Darwin hack: This flag tells the linker that no global symbols
+ // contain code that falls through to other global symbols (e.g. the obvious
+ // implementation of multiple entry points). If this doesn't occur, the
+ // linker can safely perform dead code stripping. Since LLVM never
+ // generates code that does this, it is always safe to set.
+ O << "\t.subsections_via_symbols\n";
+ }
AsmPrinter::doFinalization(M);
return false; // success
/// for a MachineFunction to the given output stream, using the given target
/// machine description.
///
-FunctionPass *llvm::createX86CodePrinterPass(std::ostream &o,TargetMachine &tm){
+FunctionPass *llvm::createX86CodePrinterPass(std::ostream &o,
+ X86TargetMachine &tm){
switch (AsmWriterFlavor) {
default:
assert(0 && "Unknown asm flavor!");