From 1c952b9cc98e84b28f68f0f6cf11197263f89863 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 9 Dec 2010 23:48:29 +0000 Subject: Initial support for the cfi directives. This is just enough to get f: .cfi_startproc nop .cfi_endproc assembled (on ELF). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121434 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-mc/llvm-mc.cpp | 17 ++++++++++++----- tools/lto/LTOCodeGenerator.cpp | 2 +- tools/lto/LTOModule.cpp | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 46eb3727d6..1d42c4666a 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -24,6 +24,9 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/SubtargetFeature.h" // FIXME. +#include "llvm/Target/TargetAsmInfo.h" // FIXME. +#include "llvm/Target/TargetLowering.h" // FIXME. +#include "llvm/Target/TargetLoweringObjectFile.h" // FIXME. #include "llvm/Target/TargetMachine.h" // FIXME. #include "llvm/Target/TargetSelect.h" #include "llvm/ADT/OwningPtr.h" @@ -298,8 +301,6 @@ static int AssembleInput(const char *ProgName) { llvm::OwningPtr MAI(TheTarget->createAsmInfo(TripleName)); assert(MAI && "Unable to create target asm info!"); - MCContext Ctx(*MAI); - // Package up features to be passed to target/subtarget std::string FeaturesStr; if (MCPU.size()) { @@ -321,6 +322,9 @@ static int AssembleInput(const char *ProgName) { return 1; } + const TargetAsmInfo tai(*TM); + MCContext Ctx(*MAI, &tai); + OwningPtr Out(GetOutputStream()); if (!Out) return 1; @@ -328,15 +332,18 @@ static int AssembleInput(const char *ProgName) { formatted_raw_ostream FOS(Out->os()); OwningPtr Str; + const TargetLoweringObjectFile &TLOF = + TM->getTargetLowering()->getObjFileLowering(); + const_cast(TLOF).Initialize(Ctx, *TM); + if (FileType == OFT_AssemblyFile) { MCInstPrinter *IP = TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI); MCCodeEmitter *CE = 0; if (ShowEncoding) CE = TheTarget->createCodeEmitter(*TM, Ctx); - Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, - TM->getTargetData()->isLittleEndian(), - /*asmverbose*/true, IP, CE, ShowInst)); + Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true, + /*useLoc*/ true, IP, CE, ShowInst)); } else if (FileType == OFT_Null) { Str.reset(createNullStreamer(Ctx)); } else { diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index f1c5680add..d49e6a77b3 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -347,7 +347,7 @@ void LTOCodeGenerator::applyScopeRestrictions() { // mark which symbols can not be internalized if (!_mustPreserveSymbols.empty()) { - MCContext Context(*_target->getMCAsmInfo()); + MCContext Context(*_target->getMCAsmInfo(), NULL); Mangler mangler(Context, *_target->getTargetData()); std::vector mustPreserveList; for (Module::iterator f = mergedModule->begin(), diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index 2453e2b2c2..a33b8b473e 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -428,7 +428,7 @@ void LTOModule::lazyParseSymbols() { _symbolsParsed = true; // Use mangler to add GlobalPrefix to names to match linker names. - MCContext Context(*_target->getMCAsmInfo()); + MCContext Context(*_target->getMCAsmInfo(), NULL); Mangler mangler(Context, *_target->getTargetData()); // add functions -- cgit v1.2.3