mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Use a more direct check for finding out the file type.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6bd88a58bb
commit
470041bd61
@ -19,6 +19,7 @@
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/Target/Mangler.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include <string>
|
||||
@ -49,6 +50,7 @@ private:
|
||||
|
||||
llvm::OwningPtr<llvm::Module> _module;
|
||||
llvm::OwningPtr<llvm::TargetMachine> _target;
|
||||
llvm::MCObjectFileInfo ObjFileInfo;
|
||||
std::vector<NameAndAttributes> _symbols;
|
||||
|
||||
// _defines and _undefines only needed to disambiguate tentative definitions
|
||||
|
@ -353,8 +353,12 @@ public:
|
||||
return EHFrameSection;
|
||||
}
|
||||
|
||||
private:
|
||||
enum Environment { IsMachO, IsELF, IsCOFF };
|
||||
Environment getObjectFileType() const {
|
||||
return Env;
|
||||
}
|
||||
|
||||
private:
|
||||
Environment Env;
|
||||
Reloc::Model RelocM;
|
||||
CodeModel::Model CMModel;
|
||||
|
@ -43,8 +43,12 @@ using namespace llvm;
|
||||
|
||||
LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t)
|
||||
: _module(m), _target(t),
|
||||
_context(_target->getMCAsmInfo(), _target->getRegisterInfo(), NULL),
|
||||
_mangler(t) {}
|
||||
_context(_target->getMCAsmInfo(), _target->getRegisterInfo(), &ObjFileInfo),
|
||||
_mangler(t) {
|
||||
ObjFileInfo.InitMCObjectFileInfo(t->getTargetTriple(),
|
||||
t->getRelocationModel(), t->getCodeModel(),
|
||||
_context);
|
||||
}
|
||||
|
||||
/// isBitcodeFile - Returns 'true' if the file (or memory contents) is LLVM
|
||||
/// bitcode.
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInstPrinter.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCParser/AsmCond.h"
|
||||
#include "llvm/MC/MCParser/AsmLexer.h"
|
||||
#include "llvm/MC/MCParser/MCAsmParser.h"
|
||||
@ -491,19 +492,20 @@ AsmParser::AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out,
|
||||
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer));
|
||||
|
||||
// Initialize the platform / file format parser.
|
||||
//
|
||||
// FIXME: This is a hack, we need to (majorly) cleanup how these objects are
|
||||
// created.
|
||||
if (_MAI.hasMicrosoftFastStdCallMangling()) {
|
||||
switch (_Ctx.getObjectFileInfo()->getObjectFileType()) {
|
||||
case MCObjectFileInfo::IsCOFF:
|
||||
PlatformParser = createCOFFAsmParser();
|
||||
PlatformParser->Initialize(*this);
|
||||
} else if (_MAI.hasSubsectionsViaSymbols()) {
|
||||
break;
|
||||
case MCObjectFileInfo::IsMachO:
|
||||
PlatformParser = createDarwinAsmParser();
|
||||
PlatformParser->Initialize(*this);
|
||||
IsDarwin = true;
|
||||
} else {
|
||||
break;
|
||||
case MCObjectFileInfo::IsELF:
|
||||
PlatformParser = createELFAsmParser();
|
||||
PlatformParser->Initialize(*this);
|
||||
break;
|
||||
}
|
||||
|
||||
initializeDirectiveKindMap();
|
||||
|
Loading…
Reference in New Issue
Block a user