mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
change MCContext to always have an MCAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98293 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
42263e2e40
commit
c18409aed8
@ -15,6 +15,7 @@
|
|||||||
#include "llvm/Support/Allocator.h"
|
#include "llvm/Support/Allocator.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class MCAsmInfo;
|
||||||
class MCExpr;
|
class MCExpr;
|
||||||
class MCSection;
|
class MCSection;
|
||||||
class MCSymbol;
|
class MCSymbol;
|
||||||
@ -28,21 +29,30 @@ namespace llvm {
|
|||||||
MCContext(const MCContext&); // DO NOT IMPLEMENT
|
MCContext(const MCContext&); // DO NOT IMPLEMENT
|
||||||
MCContext &operator=(const MCContext&); // DO NOT IMPLEMENT
|
MCContext &operator=(const MCContext&); // DO NOT IMPLEMENT
|
||||||
|
|
||||||
|
/// The MCAsmInfo for this target.
|
||||||
|
const MCAsmInfo &MAI;
|
||||||
|
|
||||||
/// Sections - Bindings of names to allocated sections.
|
/// Sections - Bindings of names to allocated sections.
|
||||||
StringMap<MCSection*> Sections;
|
StringMap<MCSection*> Sections;
|
||||||
|
|
||||||
/// Symbols - Bindings of names to symbols.
|
/// Symbols - Bindings of names to symbols.
|
||||||
StringMap<MCSymbol*> Symbols;
|
StringMap<MCSymbol*> Symbols;
|
||||||
|
|
||||||
|
/// NextUniqueID - The next ID to dole out to an unnamed assembler temporary
|
||||||
|
/// symbol.
|
||||||
|
unsigned NextUniqueID;
|
||||||
|
|
||||||
/// Allocator - Allocator object used for creating machine code objects.
|
/// Allocator - Allocator object used for creating machine code objects.
|
||||||
///
|
///
|
||||||
/// We use a bump pointer allocator to avoid the need to track all allocated
|
/// We use a bump pointer allocator to avoid the need to track all allocated
|
||||||
/// objects.
|
/// objects.
|
||||||
BumpPtrAllocator Allocator;
|
BumpPtrAllocator Allocator;
|
||||||
public:
|
public:
|
||||||
MCContext();
|
MCContext(const MCAsmInfo &MAI);
|
||||||
~MCContext();
|
~MCContext();
|
||||||
|
|
||||||
|
const MCAsmInfo &getAsmInfo() const { return MAI; }
|
||||||
|
|
||||||
/// @name Symbol Managment
|
/// @name Symbol Managment
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ char ELFWriter::ID = 0;
|
|||||||
|
|
||||||
ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm)
|
ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm)
|
||||||
: MachineFunctionPass(&ID), O(o), TM(tm),
|
: MachineFunctionPass(&ID), O(o), TM(tm),
|
||||||
OutContext(*new MCContext()),
|
OutContext(*new MCContext(*TM.getMCAsmInfo())),
|
||||||
TLOF(TM.getTargetLowering()->getObjFileLowering()),
|
TLOF(TM.getTargetLowering()->getObjFileLowering()),
|
||||||
is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64),
|
is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64),
|
||||||
isLittleEndian(TM.getTargetData()->isLittleEndian()),
|
isLittleEndian(TM.getTargetData()->isLittleEndian()),
|
||||||
|
@ -121,14 +121,14 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
|||||||
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
|
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
OwningPtr<MCContext> Context(new MCContext());
|
const MCAsmInfo &MAI = *getMCAsmInfo();
|
||||||
|
OwningPtr<MCContext> Context(new MCContext(MAI));
|
||||||
OwningPtr<MCStreamer> AsmStreamer;
|
OwningPtr<MCStreamer> AsmStreamer;
|
||||||
|
|
||||||
formatted_raw_ostream *LegacyOutput;
|
formatted_raw_ostream *LegacyOutput;
|
||||||
switch (FileType) {
|
switch (FileType) {
|
||||||
default: return true;
|
default: return true;
|
||||||
case CGFT_AssemblyFile: {
|
case CGFT_AssemblyFile: {
|
||||||
const MCAsmInfo &MAI = *getMCAsmInfo();
|
|
||||||
MCInstPrinter *InstPrinter =
|
MCInstPrinter *InstPrinter =
|
||||||
getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI, Out);
|
getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI, Out);
|
||||||
AsmStreamer.reset(createAsmStreamer(*Context, Out, MAI,
|
AsmStreamer.reset(createAsmStreamer(*Context, Out, MAI,
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MCContext::MCContext() {
|
MCContext::MCContext(const MCAsmInfo &mai) : MAI(mai), NextUniqueID(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MCContext::~MCContext() {
|
MCContext::~MCContext() {
|
||||||
|
@ -341,19 +341,17 @@ int EDDisassembler::parseInst(SmallVectorImpl<MCParsedAsmOperand*> &operands,
|
|||||||
|
|
||||||
SourceMgr sourceMgr;
|
SourceMgr sourceMgr;
|
||||||
sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
|
sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
|
||||||
MCContext context;
|
MCContext context(*AsmInfo);
|
||||||
OwningPtr<MCStreamer> streamer
|
OwningPtr<MCStreamer> streamer(createNullStreamer(context));
|
||||||
(createNullStreamer(context));
|
|
||||||
AsmParser genericParser(sourceMgr, context, *streamer, *AsmInfo);
|
AsmParser genericParser(sourceMgr, context, *streamer, *AsmInfo);
|
||||||
OwningPtr<TargetAsmParser> specificParser
|
OwningPtr<TargetAsmParser> TargetParser(Tgt->createAsmParser(genericParser));
|
||||||
(Tgt->createAsmParser(genericParser));
|
|
||||||
|
|
||||||
AsmToken OpcodeToken = genericParser.Lex();
|
AsmToken OpcodeToken = genericParser.Lex();
|
||||||
|
|
||||||
if(OpcodeToken.is(AsmToken::Identifier)) {
|
if(OpcodeToken.is(AsmToken::Identifier)) {
|
||||||
instName = OpcodeToken.getString();
|
instName = OpcodeToken.getString();
|
||||||
instLoc = OpcodeToken.getLoc();
|
instLoc = OpcodeToken.getLoc();
|
||||||
if (specificParser->ParseInstruction(instName, instLoc, operands))
|
if (TargetParser->ParseInstruction(instName, instLoc, operands))
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -242,7 +242,11 @@ static int AssembleInput(const char *ProgName) {
|
|||||||
// it later.
|
// it later.
|
||||||
SrcMgr.setIncludeDirs(IncludeDirs);
|
SrcMgr.setIncludeDirs(IncludeDirs);
|
||||||
|
|
||||||
MCContext Ctx;
|
|
||||||
|
const MCAsmInfo *MAI = TheTarget->createAsmInfo(TripleName);
|
||||||
|
assert(MAI && "Unable to create target asm info!");
|
||||||
|
|
||||||
|
MCContext Ctx(*MAI);
|
||||||
formatted_raw_ostream *Out = GetOutputStream();
|
formatted_raw_ostream *Out = GetOutputStream();
|
||||||
if (!Out)
|
if (!Out)
|
||||||
return 1;
|
return 1;
|
||||||
@ -262,9 +266,6 @@ static int AssembleInput(const char *ProgName) {
|
|||||||
OwningPtr<MCStreamer> Str;
|
OwningPtr<MCStreamer> Str;
|
||||||
OwningPtr<TargetAsmBackend> TAB;
|
OwningPtr<TargetAsmBackend> TAB;
|
||||||
|
|
||||||
const MCAsmInfo *MAI = TheTarget->createAsmInfo(TripleName);
|
|
||||||
assert(MAI && "Unable to create target asm info!");
|
|
||||||
|
|
||||||
if (FileType == OFT_AssemblyFile) {
|
if (FileType == OFT_AssemblyFile) {
|
||||||
IP.reset(TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out));
|
IP.reset(TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out));
|
||||||
if (ShowEncoding)
|
if (ShowEncoding)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user