[llvm-commits] [llvm] r135611 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/MC/ include/llvm/Target/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/MC/MCDisassembler/ lib/MC/MCParser/ lib/Target/ lib/Target/CBackend/ lib/Target/X86/ tools/llvm-mc/ tools/lto/
Jim Grosbach
grosbach at apple.com
Wed Jul 20 12:57:35 PDT 2011
Woot!! Very, very cool.
-Jim
On Jul 20, 2011, at 12:50 PM, Evan Cheng wrote:
> Author: evancheng
> Date: Wed Jul 20 14:50:42 2011
> New Revision: 135611
>
> URL: http://llvm.org/viewvc/llvm-project?rev=135611&view=rev
> Log:
> Goodbye TargetAsmInfo. This eliminate last bit of CodeGen and Target in llvm-mc.
>
> There is still a bit more refactoring left to do in Targets. But we are now very
> close to fixing all the layering issues in MC.
>
> Removed:
> llvm/trunk/include/llvm/Target/TargetAsmInfo.h
> llvm/trunk/lib/Target/TargetAsmInfo.cpp
> Modified:
> llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
> llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
> llvm/trunk/include/llvm/MC/MCContext.h
> llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
> llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> llvm/trunk/lib/CodeGen/ELFWriter.cpp
> llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
> llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
> llvm/trunk/lib/MC/MCAsmStreamer.cpp
> llvm/trunk/lib/MC/MCContext.cpp
> llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp
> llvm/trunk/lib/MC/MCDisassembler/Disassembler.h
> llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp
> llvm/trunk/lib/MC/MCDwarf.cpp
> llvm/trunk/lib/MC/MCObjectFileInfo.cpp
> llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> llvm/trunk/lib/Target/CBackend/CBackend.cpp
> llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
> llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
> llvm/trunk/tools/llvm-mc/llvm-mc.cpp
> llvm/trunk/tools/lto/LTOCodeGenerator.cpp
> llvm/trunk/tools/lto/LTOModule.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Wed Jul 20 14:50:42 2011
> @@ -175,8 +175,7 @@
> MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL.
> // Real constructor.
> MachineModuleInfo(const MCAsmInfo &MAI, const MCRegisterInfo &MRI,
> - const MCObjectFileInfo *MOFI,
> - const TargetAsmInfo *TAI);
> + const MCObjectFileInfo *MOFI);
> ~MachineModuleInfo();
>
> bool doInitialization();
>
> Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Wed Jul 20 14:50:42 2011
> @@ -100,11 +100,6 @@
> virtual MCSymbol *
> getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang,
> MachineModuleInfo *MMI) const;
> -
> - virtual unsigned getPersonalityEncoding() const;
> - virtual unsigned getLSDAEncoding() const;
> - virtual unsigned getFDEEncoding(bool CFI) const;
> - virtual unsigned getTTypeEncoding() const;
> };
>
>
>
> Modified: llvm/trunk/include/llvm/MC/MCContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCContext.h (original)
> +++ llvm/trunk/include/llvm/MC/MCContext.h Wed Jul 20 14:50:42 2011
> @@ -31,7 +31,6 @@
> class MCLineSection;
> class StringRef;
> class Twine;
> - class TargetAsmInfo;
> class MCSectionMachO;
> class MCSectionELF;
>
> @@ -54,8 +53,6 @@
> /// The MCObjectFileInfo for this target.
> const MCObjectFileInfo *MOFI;
>
> - const TargetAsmInfo *TAI;
> -
> /// Allocator - Allocator object used for creating machine code objects.
> ///
> /// We use a bump pointer allocator to avoid the need to track all allocated
> @@ -119,7 +116,7 @@
>
> public:
> explicit MCContext(const MCAsmInfo &MAI, const MCRegisterInfo &MRI,
> - const MCObjectFileInfo *MOFI, const TargetAsmInfo *TAI);
> + const MCObjectFileInfo *MOFI);
> ~MCContext();
>
> const MCAsmInfo &getAsmInfo() const { return MAI; }
> @@ -128,8 +125,6 @@
>
> const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; }
>
> - const TargetAsmInfo &getTargetAsmInfo() const { return *TAI; }
> -
> void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
>
> /// @name Symbol Management
>
> Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)
> +++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Wed Jul 20 14:50:42 2011
> @@ -40,6 +40,13 @@
> /// non-.globl label. This defaults to true.
> bool IsFunctionEHFrameSymbolPrivate;
>
> + /// PersonalityEncoding, LSDAEncoding, FDEEncoding, TTypeEncoding - Some
> + /// encoding values for EH.
> + unsigned PersonalityEncoding;
> + unsigned LSDAEncoding;
> + unsigned FDEEncoding;
> + unsigned FDECFIEncoding;
> + unsigned TTypeEncoding;
>
> /// TextSection - Section directive for standard text.
> ///
> @@ -151,7 +158,8 @@
> const MCSection *XDataSection;
>
> public:
> - void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, MCContext &ctx);
> + void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM,
> + MCContext &ctx);
>
> bool isFunctionEHFrameSymbolPrivate() const {
> return IsFunctionEHFrameSymbolPrivate;
> @@ -163,6 +171,13 @@
> return CommDirectiveSupportsAlignment;
> }
>
> + unsigned getPersonalityEncoding() const { return PersonalityEncoding; }
> + unsigned getLSDAEncoding() const { return LSDAEncoding; }
> + unsigned getFDEEncoding(bool CFI) const {
> + return CFI ? FDECFIEncoding : FDEEncoding;
> + }
> + unsigned getTTypeEncoding() const { return TTypeEncoding; }
> +
> const MCSection *getTextSection() const { return TextSection; }
> const MCSection *getDataSection() const { return DataSection; }
> const MCSection *getBSSSection() const { return BSSSection; }
> @@ -262,6 +277,7 @@
> enum Environment { IsMachO, IsELF, IsCOFF };
> Environment Env;
> Reloc::Model RelocM;
> + CodeModel::Model CMModel;
> MCContext *Ctx;
>
> void InitMachOMCObjectFileInfo(Triple T);
>
> Removed: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=135610&view=auto
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h (removed)
> @@ -1,35 +0,0 @@
> -//===-- llvm/Target/TargetAsmInfo.h -----------------------------*- C++ -*-===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// Interface to provide the information necessary for producing assembly files.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#ifndef LLVM_TARGET_TARGETASMINFO_H
> -#define LLVM_TARGET_TARGETASMINFO_H
> -
> -#include "llvm/Target/TargetLoweringObjectFile.h"
> -
> -namespace llvm {
> - class TargetMachine;
> - class TargetLoweringObjectFile;
> -
> -class TargetAsmInfo {
> - const TargetLoweringObjectFile *TLOF;
> -
> -public:
> - explicit TargetAsmInfo(const TargetMachine &TM);
> -
> - unsigned getFDEEncoding(bool CFI) const {
> - return TLOF->getFDEEncoding(CFI);
> - }
> -};
> -
> -}
> -#endif
>
> Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Wed Jul 20 14:50:42 2011
> @@ -122,11 +122,6 @@
> getExprForDwarfReference(const MCSymbol *Sym, unsigned Encoding,
> MCStreamer &Streamer) const;
>
> - virtual unsigned getPersonalityEncoding() const;
> - virtual unsigned getLSDAEncoding() const;
> - virtual unsigned getFDEEncoding(bool CFI) const;
> - virtual unsigned getTTypeEncoding() const;
> -
> protected:
> virtual const MCSection *
> SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Jul 20 14:50:42 2011
> @@ -33,7 +33,6 @@
> #include "llvm/MC/MCStreamer.h"
> #include "llvm/MC/MCSymbol.h"
> #include "llvm/Target/Mangler.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/Target/TargetData.h"
> #include "llvm/Target/TargetInstrInfo.h"
> #include "llvm/Target/TargetLowering.h"
>
> Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Wed Jul 20 14:50:42 2011
> @@ -45,7 +45,6 @@
> #include "llvm/MC/MCSectionELF.h"
> #include "llvm/MC/MCAsmInfo.h"
> #include "llvm/Target/Mangler.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/Target/TargetData.h"
> #include "llvm/Target/TargetELFWriterInfo.h"
> #include "llvm/Target/TargetLowering.h"
> @@ -67,8 +66,7 @@
> ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm)
> : MachineFunctionPass(ID), O(o), TM(tm),
> OutContext(*new MCContext(*TM.getMCAsmInfo(), *TM.getRegisterInfo(),
> - &TM.getTargetLowering()->getObjFileLowering(),
> - new TargetAsmInfo(tm))),
> + &TM.getTargetLowering()->getObjFileLowering())),
> TLOF(TM.getTargetLowering()->getObjFileLowering()),
> is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64),
> isLittleEndian(TM.getTargetData()->isLittleEndian()),
>
> Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Jul 20 14:50:42 2011
> @@ -27,9 +27,10 @@
> #include "llvm/MC/MCInstrInfo.h"
> #include "llvm/MC/MCStreamer.h"
> #include "llvm/MC/MCSubtargetInfo.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/Target/TargetData.h"
> #include "llvm/Target/TargetInstrInfo.h"
> +#include "llvm/Target/TargetLowering.h"
> +#include "llvm/Target/TargetLoweringObjectFile.h"
> #include "llvm/Target/TargetRegisterInfo.h"
> #include "llvm/Target/TargetRegistry.h"
> #include "llvm/Target/TargetSubtargetInfo.h"
> @@ -353,11 +354,9 @@
>
> // Install a MachineModuleInfo class, which is an immutable pass that holds
> // all the per-module stuff we're generating, including MCContext.
> - TargetAsmInfo *TAI = new TargetAsmInfo(*this);
> MachineModuleInfo *MMI = new MachineModuleInfo(*getMCAsmInfo(),
> *getRegisterInfo(),
> - &getTargetLowering()->getObjFileLowering(),
> - TAI);
> + &getTargetLowering()->getObjFileLowering());
> PM.add(MMI);
> OutContext = &MMI->getContext(); // Return the MCContext specifically by-ref.
>
>
> Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Wed Jul 20 14:50:42 2011
> @@ -17,7 +17,6 @@
> #include "llvm/CodeGen/MachineFunctionPass.h"
> #include "llvm/CodeGen/MachineFunction.h"
> #include "llvm/CodeGen/Passes.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/MC/MCObjectFileInfo.h"
> #include "llvm/MC/MCSymbol.h"
> #include "llvm/ADT/PointerUnion.h"
> @@ -254,9 +253,8 @@
>
> MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI,
> const MCRegisterInfo &MRI,
> - const MCObjectFileInfo *MOFI,
> - const TargetAsmInfo *TAI)
> - : ImmutablePass(ID), Context(MAI, MRI, MOFI, TAI),
> + const MCObjectFileInfo *MOFI)
> + : ImmutablePass(ID), Context(MAI, MRI, MOFI),
> ObjFileMMI(0), CompactUnwindEncoding(0), CurCallSite(0), CallsEHReturn(0),
> CallsUnwindInit(0), DbgInfoAvailable(false),
> CallsExternalVAFunctionWithFloatingPointArguments(false) {
> @@ -269,7 +267,7 @@
>
> MachineModuleInfo::MachineModuleInfo()
> : ImmutablePass(ID),
> - Context(*(MCAsmInfo*)0, *(MCRegisterInfo*)0, (MCObjectFileInfo*)0, NULL) {
> + Context(*(MCAsmInfo*)0, *(MCRegisterInfo*)0, (MCObjectFileInfo*)0) {
> assert(0 && "This MachineModuleInfo constructor should never be called, MMI "
> "should always be explicitly constructed by LLVMTargetMachine");
> abort();
>
> Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
> +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Wed Jul 20 14:50:42 2011
> @@ -543,22 +543,6 @@
> return SSym;
> }
>
> -unsigned TargetLoweringObjectFileMachO::getPersonalityEncoding() const {
> - return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> -}
> -
> -unsigned TargetLoweringObjectFileMachO::getLSDAEncoding() const {
> - return DW_EH_PE_pcrel;
> -}
> -
> -unsigned TargetLoweringObjectFileMachO::getFDEEncoding(bool CFI) const {
> - return DW_EH_PE_pcrel;
> -}
> -
> -unsigned TargetLoweringObjectFileMachO::getTTypeEncoding() const {
> - return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> -}
> -
> //===----------------------------------------------------------------------===//
> // COFF
> //===----------------------------------------------------------------------===//
>
> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Jul 20 14:50:42 2011
> @@ -28,7 +28,6 @@
> #include "llvm/Support/Format.h"
> #include "llvm/Support/FormattedStream.h"
> #include "llvm/Target/TargetAsmBackend.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/Target/TargetLoweringObjectFile.h"
> #include <cctype>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/MC/MCContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCContext.cpp (original)
> +++ llvm/trunk/lib/MC/MCContext.cpp Wed Jul 20 14:50:42 2011
> @@ -17,7 +17,6 @@
> #include "llvm/MC/MCSymbol.h"
> #include "llvm/MC/MCLabel.h"
> #include "llvm/MC/MCDwarf.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/ADT/SmallString.h"
> #include "llvm/ADT/Twine.h"
> #include "llvm/Support/ELF.h"
> @@ -29,8 +28,8 @@
>
>
> MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri,
> - const MCObjectFileInfo *mofi, const TargetAsmInfo *tai) :
> - MAI(mai), MRI(mri), MOFI(mofi), TAI(tai),
> + const MCObjectFileInfo *mofi) :
> + MAI(mai), MRI(mri), MOFI(mofi),
> Allocator(), Symbols(Allocator), UsedNames(Allocator),
> NextUniqueID(0),
> CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0),
> @@ -57,8 +56,6 @@
>
> // If the stream for the .secure_log_unique directive was created free it.
> delete (raw_ostream*)SecureLog;
> -
> - delete TAI;
> }
>
> //===----------------------------------------------------------------------===//
>
> Modified: llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp (original)
> +++ llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp Wed Jul 20 14:50:42 2011
> @@ -17,8 +17,6 @@
> #include "llvm/MC/MCInstPrinter.h"
> #include "llvm/MC/MCRegisterInfo.h"
> #include "llvm/Target/TargetRegistry.h"
> -#include "llvm/Target/TargetAsmInfo.h" // FIXME.
> -#include "llvm/Target/TargetMachine.h" // FIXME.
> #include "llvm/Target/TargetSelect.h"
> #include "llvm/Support/MemoryObject.h"
>
> @@ -39,8 +37,6 @@
> LLVMSymbolLookupCallback SymbolLookUp) {
> // Initialize targets and assembly printers/parsers.
> llvm::InitializeAllTargetInfos();
> - // FIXME: We shouldn't need to initialize the Target(Machine)s.
> - llvm::InitializeAllTargets();
> llvm::InitializeAllMCAsmInfos();
> llvm::InitializeAllMCCodeGenInfos();
> llvm::InitializeAllMCRegisterInfos();
> @@ -64,19 +60,8 @@
> std::string FeaturesStr;
> std::string CPU;
>
> - // FIXME: We shouldn't need to do this (and link in codegen).
> - // When we split this out, we should do it in a way that makes
> - // it straightforward to switch subtargets on the fly.
> - TargetMachine *TM = TheTarget->createTargetMachine(TripleName, CPU,
> - FeaturesStr);
> - assert(TM && "Unable to create target machine!");
> -
> - // Get the target assembler info needed to setup the context.
> - const TargetAsmInfo *tai = new TargetAsmInfo(*TM);
> - assert(tai && "Unable to create target assembler!");
> -
> // Set up the MCContext for creating symbols and MCExpr's.
> - MCContext *Ctx = new MCContext(*MAI, *MRI, 0, tai);
> + MCContext *Ctx = new MCContext(*MAI, *MRI, 0);
> assert(Ctx && "Unable to create MCContext!");
>
> // Set up disassembler.
> @@ -92,7 +77,7 @@
>
> LLVMDisasmContext *DC = new LLVMDisasmContext(TripleName, DisInfo, TagType,
> GetOpInfo, SymbolLookUp,
> - TheTarget, MAI, MRI, TM, tai,
> + TheTarget, MAI, MRI,
> Ctx, DisAsm, IP);
> assert(DC && "Allocation failure!");
> return DC;
>
> Modified: llvm/trunk/lib/MC/MCDisassembler/Disassembler.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/Disassembler.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDisassembler/Disassembler.h (original)
> +++ llvm/trunk/lib/MC/MCDisassembler/Disassembler.h Wed Jul 20 14:50:42 2011
> @@ -22,14 +22,12 @@
> #include "llvm/ADT/OwningPtr.h"
>
> namespace llvm {
> -class TargetAsmInfo;
> class MCContext;
> class MCAsmInfo;
> class MCDisassembler;
> class MCInstPrinter;
> class MCRegisterInfo;
> class Target;
> -class TargetMachine;
>
> //
> // This is the disassembler context returned by LLVMCreateDisasm().
> @@ -61,12 +59,6 @@
> llvm::OwningPtr<const llvm::MCAsmInfo> MAI;
> // The register information for the target architecture.
> llvm::OwningPtr<const llvm::MCRegisterInfo> MRI;
> - // The target machine instance.
> - llvm::OwningPtr<llvm::TargetMachine> TM;
> - // The disassembler for the target architecture.
> - // FIXME: using llvm::OwningPtr<const llvm::TargetAsmInfo> causes a malloc
> - // error when this LLVMDisasmContext is deleted.
> - const TargetAsmInfo *Tai;
> // The assembly context for creating symbols and MCExprs.
> llvm::OwningPtr<const llvm::MCContext> Ctx;
> // The disassembler for the target architecture.
> @@ -80,12 +72,10 @@
> LLVMSymbolLookupCallback symbolLookUp,
> const Target *theTarget, const MCAsmInfo *mAI,
> const MCRegisterInfo *mRI,
> - llvm::TargetMachine *tM, const TargetAsmInfo *tai,
> llvm::MCContext *ctx, const MCDisassembler *disAsm,
> MCInstPrinter *iP) : TripleName(tripleName),
> DisInfo(disInfo), TagType(tagType), GetOpInfo(getOpInfo),
> - SymbolLookUp(symbolLookUp), TheTarget(theTarget), Tai(tai) {
> - TM.reset(tM);
> + SymbolLookUp(symbolLookUp), TheTarget(theTarget) {
> MAI.reset(mAI);
> MRI.reset(mRI);
> Ctx.reset(ctx);
>
> Modified: llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp (original)
> +++ llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp Wed Jul 20 14:50:42 2011
> @@ -377,7 +377,7 @@
> SourceMgr sourceMgr;
> sourceMgr.setDiagHandler(diag_handler, static_cast<void*>(this));
> sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
> - MCContext context(*AsmInfo, *MRI, NULL, NULL);
> + MCContext context(*AsmInfo, *MRI, NULL);
> OwningPtr<MCStreamer> streamer(createNullStreamer(context));
> OwningPtr<MCAsmParser> genericParser(createMCAsmParser(*Tgt, sourceMgr,
> context, *streamer,
>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Jul 20 14:50:42 2011
> @@ -19,7 +19,6 @@
> #include "llvm/Support/Debug.h"
> #include "llvm/Support/ErrorHandling.h"
> #include "llvm/Support/raw_ostream.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/ADT/FoldingSet.h"
> #include "llvm/ADT/SmallString.h"
> #include "llvm/ADT/StringExtras.h"
> @@ -691,7 +690,6 @@
> const MCDwarfFrameInfo &Frame) {
> MCContext &Context = Streamer.getContext();
> const MCObjectFileInfo *MOFI = Context.getObjectFileInfo();
> - const TargetAsmInfo &TAI = Context.getTargetAsmInfo();
> bool VerboseAsm = Streamer.isVerboseAsm();
>
> // range-start range-length compact-unwind-enc personality-func lsda
> @@ -726,7 +724,7 @@
> Streamer.SwitchSection(MOFI->getCompactUnwindSection());
>
> // Range Start
> - unsigned FDEEncoding = TAI.getFDEEncoding(UsingCFI);
> + unsigned FDEEncoding = MOFI->getFDEEncoding(UsingCFI);
> unsigned Size = getSizeForEncoding(Streamer, FDEEncoding);
> if (VerboseAsm) Streamer.AddComment("Range Start");
> Streamer.EmitSymbolValue(Frame.Function, Size);
> @@ -771,7 +769,6 @@
> MCContext &context = streamer.getContext();
> const MCRegisterInfo &MRI = context.getRegisterInfo();
> const MCObjectFileInfo *MOFI = context.getObjectFileInfo();
> - const TargetAsmInfo &TAI = context.getTargetAsmInfo();
> bool verboseAsm = streamer.isVerboseAsm();
>
> MCSymbol *sectionStart;
> @@ -858,7 +855,7 @@
> EmitEncodingByte(streamer, lsdaEncoding, "LSDA Encoding");
>
> // Encoding of the FDE pointers
> - EmitEncodingByte(streamer, TAI.getFDEEncoding(UsingCFI),
> + EmitEncodingByte(streamer, MOFI->getFDEEncoding(UsingCFI),
> "FDE Encoding");
> }
>
> @@ -895,7 +892,6 @@
> MCSymbol *fdeStart = context.CreateTempSymbol();
> MCSymbol *fdeEnd = context.CreateTempSymbol();
> const MCObjectFileInfo *MOFI = context.getObjectFileInfo();
> - const TargetAsmInfo &TAI = context.getTargetAsmInfo();
> bool verboseAsm = streamer.isVerboseAsm();
>
> if (!MOFI->isFunctionEHFrameSymbolPrivate() && IsEH) {
> @@ -927,7 +923,7 @@
> streamer.EmitSymbolValue(&cieStart, 4);
> }
>
> - unsigned fdeEncoding = TAI.getFDEEncoding(UsingCFI);
> + unsigned fdeEncoding = MOFI->getFDEEncoding(UsingCFI);
> unsigned size = getSizeForEncoding(streamer, fdeEncoding);
>
> // PC Begin
>
> Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Wed Jul 20 14:50:42 2011
> @@ -21,6 +21,12 @@
> IsFunctionEHFrameSymbolPrivate = false;
> SupportsWeakOmittedEHFrame = false;
>
> + PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel
> + | dwarf::DW_EH_PE_sdata4;
> + LSDAEncoding = FDEEncoding = FDECFIEncoding = dwarf::DW_EH_PE_pcrel;
> + TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
> + dwarf::DW_EH_PE_sdata4;
> +
> // .comm doesn't support alignment before Leopard.
> if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
> CommDirectiveSupportsAlignment = false;
> @@ -199,6 +205,45 @@
> }
>
> void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
> + if (T.getArch() == Triple::x86) {
> + PersonalityEncoding = (RelocM == Reloc::PIC_)
> + ? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
> + : dwarf::DW_EH_PE_absptr;
> + LSDAEncoding = (RelocM == Reloc::PIC_)
> + ? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
> + : dwarf::DW_EH_PE_absptr;
> + FDEEncoding = FDECFIEncoding = (RelocM == Reloc::PIC_)
> + ? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
> + : dwarf::DW_EH_PE_absptr;
> + TTypeEncoding = (RelocM == Reloc::PIC_)
> + ? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
> + : dwarf::DW_EH_PE_absptr;
> + } else if (T.getArch() == Triple::x86_64) {
> + FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
> +
> + if (RelocM == Reloc::PIC_) {
> + PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
> + ((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
> + ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
> + LSDAEncoding = dwarf::DW_EH_PE_pcrel |
> + (CMModel == CodeModel::Small
> + ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
> + FDEEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
> + TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
> + ((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
> + ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
> + } else {
> + PersonalityEncoding =
> + (CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
> + ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
> + LSDAEncoding = (CMModel == CodeModel::Small)
> + ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
> + FDEEncoding = dwarf::DW_EH_PE_udata4;
> + TTypeEncoding = (CMModel == CodeModel::Small)
> + ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
> + }
> + }
> +
> // ELF
> BSSSection =
> Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
> @@ -446,15 +491,21 @@
> }
>
> void MCObjectFileInfo::InitMCObjectFileInfo(StringRef TT, Reloc::Model relocm,
> + CodeModel::Model cm,
> MCContext &ctx) {
> RelocM = relocm;
> + CMModel = cm;
> Ctx = &ctx;
>
> // Common.
> CommDirectiveSupportsAlignment = true;
> SupportsWeakOmittedEHFrame = true;
> IsFunctionEHFrameSymbolPrivate = true;
> - EHFrameSection = 0;
> +
> + PersonalityEncoding = LSDAEncoding = FDEEncoding = FDECFIEncoding =
> + TTypeEncoding = dwarf::DW_EH_PE_absptr;
> +
> + EHFrameSection = 0; // Created on demand.
>
> Triple T(TT);
> Triple::ArchType Arch = T.getArch();
>
> Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
> +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed Jul 20 14:50:42 2011
> @@ -33,7 +33,6 @@
> #include "llvm/Support/MemoryBuffer.h"
> #include "llvm/Support/SourceMgr.h"
> #include "llvm/Support/raw_ostream.h"
> -#include "llvm/Target/TargetAsmInfo.h"
> #include "llvm/Target/TargetAsmParser.h"
> #include <cctype>
> #include <vector>
>
> Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
> +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Jul 20 14:50:42 2011
> @@ -1676,7 +1676,7 @@
> #endif
> TAsm = new CBEMCAsmInfo();
> MRI = new MCRegisterInfo();
> - TCtx = new MCContext(*TAsm, *MRI, NULL, NULL);
> + TCtx = new MCContext(*TAsm, *MRI, NULL);
> Mang = new Mangler(*TCtx, *TD);
>
> // Keep track of which functions are static ctors/dtors so they can have
>
> Removed: llvm/trunk/lib/Target/TargetAsmInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=135610&view=auto
> ==============================================================================
> --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
> +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp (removed)
> @@ -1,18 +0,0 @@
> -//===-- llvm/Target/TargetAsmInfo.cpp - Target Assembly Info --------------===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#include "llvm/Target/TargetAsmInfo.h"
> -#include "llvm/Target/TargetLowering.h"
> -#include "llvm/Target/TargetLoweringObjectFile.h"
> -#include "llvm/Target/TargetMachine.h"
> -using namespace llvm;
> -
> -TargetAsmInfo::TargetAsmInfo(const TargetMachine &TM) {
> - TLOF = &TM.getTargetLowering()->getObjFileLowering();
> -}
>
> Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
> +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Jul 20 14:50:42 2011
> @@ -41,7 +41,8 @@
> void TargetLoweringObjectFile::Initialize(MCContext &ctx,
> const TargetMachine &TM) {
> Ctx = &ctx;
> - InitMCObjectFileInfo(TM.getTargetTriple(), TM.getRelocationModel(), *Ctx);
> + InitMCObjectFileInfo(TM.getTargetTriple(),
> + TM.getRelocationModel(), TM.getCodeModel(), *Ctx);
> }
>
> TargetLoweringObjectFile::~TargetLoweringObjectFile() {
> @@ -322,20 +323,3 @@
> }
> }
> }
> -
> -unsigned TargetLoweringObjectFile::getPersonalityEncoding() const {
> - return dwarf::DW_EH_PE_absptr;
> -}
> -
> -unsigned TargetLoweringObjectFile::getLSDAEncoding() const {
> - return dwarf::DW_EH_PE_absptr;
> -}
> -
> -unsigned TargetLoweringObjectFile::getFDEEncoding(bool CFI) const {
> - return dwarf::DW_EH_PE_absptr;
> -}
> -
> -unsigned TargetLoweringObjectFile::getTTypeEncoding() const {
> - return dwarf::DW_EH_PE_absptr;
> -}
> -
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 20 14:50:42 2011
> @@ -197,11 +197,8 @@
> return new TargetLoweringObjectFileMachO();
> }
>
> - if (Subtarget->isTargetELF()) {
> - if (is64Bit)
> - return new X8664_ELFTargetObjectFile(TM);
> - return new X8632_ELFTargetObjectFile(TM);
> - }
> + if (Subtarget->isTargetELF())
> + return new TargetLoweringObjectFileELF();
> if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho())
> return new TargetLoweringObjectFileCOFF();
> llvm_unreachable("unknown subtarget type");
>
> Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Wed Jul 20 14:50:42 2011
> @@ -43,79 +43,3 @@
> MachineModuleInfo *MMI) const {
> return Mang->getSymbol(GV);
> }
> -
> -unsigned X8632_ELFTargetObjectFile::getPersonalityEncoding() const {
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> - else
> - return DW_EH_PE_absptr;
> -}
> -
> -unsigned X8632_ELFTargetObjectFile::getLSDAEncoding() const {
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> - else
> - return DW_EH_PE_absptr;
> -}
> -
> -unsigned X8632_ELFTargetObjectFile::getFDEEncoding(bool FDE) const {
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> - else
> - return DW_EH_PE_absptr;
> -}
> -
> -unsigned X8632_ELFTargetObjectFile::getTTypeEncoding() const {
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> - else
> - return DW_EH_PE_absptr;
> -}
> -
> -unsigned X8664_ELFTargetObjectFile::getPersonalityEncoding() const {
> - CodeModel::Model Model = TM.getCodeModel();
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_indirect | DW_EH_PE_pcrel | (Model == CodeModel::Small ||
> - Model == CodeModel::Medium ?
> - DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
> -
> - if (Model == CodeModel::Small || Model == CodeModel::Medium)
> - return DW_EH_PE_udata4;
> -
> - return DW_EH_PE_absptr;
> -}
> -
> -unsigned X8664_ELFTargetObjectFile::getLSDAEncoding() const {
> - CodeModel::Model Model = TM.getCodeModel();
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_pcrel | (Model == CodeModel::Small ?
> - DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
> -
> - if (Model == CodeModel::Small)
> - return DW_EH_PE_udata4;
> -
> - return DW_EH_PE_absptr;
> -}
> -
> -unsigned X8664_ELFTargetObjectFile::getFDEEncoding(bool CFI) const {
> - if (CFI)
> - return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> -
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
> -
> - return DW_EH_PE_udata4;
> -}
> -
> -unsigned X8664_ELFTargetObjectFile::getTTypeEncoding() const {
> - CodeModel::Model Model = TM.getCodeModel();
> - if (TM.getRelocationModel() == Reloc::PIC_)
> - return DW_EH_PE_indirect | DW_EH_PE_pcrel | (Model == CodeModel::Small ||
> - Model == CodeModel::Medium ?
> - DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
> -
> - if (Model == CodeModel::Small)
> - return DW_EH_PE_udata4;
> -
> - return DW_EH_PE_absptr;
> -}
>
> Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (original)
> +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Wed Jul 20 14:50:42 2011
> @@ -33,28 +33,6 @@
> MachineModuleInfo *MMI) const;
> };
>
> - class X8632_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
> - const X86TargetMachine &TM;
> - public:
> - X8632_ELFTargetObjectFile(const X86TargetMachine &tm)
> - :TM(tm) { }
> - virtual unsigned getPersonalityEncoding() const;
> - virtual unsigned getLSDAEncoding() const;
> - virtual unsigned getFDEEncoding(bool CFI) const;
> - virtual unsigned getTTypeEncoding() const;
> - };
> -
> - class X8664_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
> - const X86TargetMachine &TM;
> - public:
> - X8664_ELFTargetObjectFile(const X86TargetMachine &tm)
> - :TM(tm) { }
> - virtual unsigned getPersonalityEncoding() const;
> - virtual unsigned getLSDAEncoding() const;
> - virtual unsigned getFDEEncoding(bool CFI) const;
> - virtual unsigned getTTypeEncoding() const;
> - };
> -
> } // end namespace llvm
>
> #endif
>
> Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
> +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed Jul 20 14:50:42 2011
> @@ -28,10 +28,6 @@
> #include "llvm/Target/TargetAsmParser.h"
> #include "llvm/Target/TargetData.h"
> #include "llvm/Target/TargetRegistry.h"
> -#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"
> #include "llvm/Support/CommandLine.h"
> @@ -348,28 +344,11 @@
> // Package up features to be passed to target/subtarget
> std::string FeaturesStr;
>
> - // FIXME: We shouldn't need to do this (and link in codegen).
> - // When we split this out, we should do it in a way that makes
> - // it straightforward to switch subtargets on the fly (.e.g,
> - // the .cpu and .code16 directives).
> - OwningPtr<TargetMachine> TM(TheTarget->createTargetMachine(TripleName,
> - MCPU,
> - FeaturesStr,
> - RelocModel,
> - CMModel));
> -
> - if (!TM) {
> - errs() << ProgName << ": error: could not create target for triple '"
> - << TripleName << "'.\n";
> - return 1;
> - }
> -
> - const TargetAsmInfo *tai = new TargetAsmInfo(*TM);
> // FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
> // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
> OwningPtr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
> - MCContext Ctx(*MAI, *MRI, MOFI.get(), tai);
> - MOFI->InitMCObjectFileInfo(TripleName, RelocModel, Ctx);
> + MCContext Ctx(*MAI, *MRI, MOFI.get());
> + MOFI->InitMCObjectFileInfo(TripleName, RelocModel, CMModel, Ctx);
>
> if (SaveTempLabels)
> Ctx.setAllowTemporaryLabels(false);
> @@ -381,10 +360,6 @@
> formatted_raw_ostream FOS(Out->os());
> OwningPtr<MCStreamer> Str;
>
> - const TargetLoweringObjectFile &TLOF =
> - TM->getTargetLowering()->getObjFileLowering();
> - const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(Ctx, *TM);
> -
> OwningPtr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
> OwningPtr<MCSubtargetInfo>
> STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
>
> Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
> +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Jul 20 14:50:42 2011
> @@ -313,8 +313,7 @@
> passes.add(createVerifierPass());
>
> // mark which symbols can not be internalized
> - MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(),
> - NULL, NULL);
> + MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL);
> Mangler mangler(Context, *_target->getTargetData());
> std::vector<const char*> mustPreserveList;
> SmallPtrSet<GlobalValue*, 8> asmUsed;
>
> Modified: llvm/trunk/tools/lto/LTOModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=135611&r1=135610&r2=135611&view=diff
> ==============================================================================
> --- llvm/trunk/tools/lto/LTOModule.cpp (original)
> +++ llvm/trunk/tools/lto/LTOModule.cpp Wed Jul 20 14:50:42 2011
> @@ -664,8 +664,7 @@
>
> bool LTOModule::ParseSymbols() {
> // Use mangler to add GlobalPrefix to names to match linker names.
> - MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(),
> - NULL, NULL);
> + MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(),NULL);
> Mangler mangler(Context, *_target->getTargetData());
>
> // add functions
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list