mirror of
https://github.com/jeremysrand/llvm-65816.git
synced 2024-06-25 19:29:40 +00:00
Get rid of the .text directive in the assembly output by creating a target object file class specific for the 65816.
This commit is contained in:
parent
30e52d00c8
commit
acc21bea81
|
@ -16,6 +16,7 @@
|
||||||
#include "WDC65816MachineFunctionInfo.h"
|
#include "WDC65816MachineFunctionInfo.h"
|
||||||
#include "WDC65816RegisterInfo.h"
|
#include "WDC65816RegisterInfo.h"
|
||||||
#include "WDC65816TargetMachine.h"
|
#include "WDC65816TargetMachine.h"
|
||||||
|
#include "WDC65816TargetObjectFile.h"
|
||||||
#include "MCTargetDesc/WDC65816BaseInfo.h"
|
#include "MCTargetDesc/WDC65816BaseInfo.h"
|
||||||
#include "llvm/CodeGen/CallingConvLower.h"
|
#include "llvm/CodeGen/CallingConvLower.h"
|
||||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
|
@ -808,7 +809,7 @@ static SPCC::CondCodes FPCondCCodeToFCC(ISD::CondCode CC) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WDC65816TargetLowering::WDC65816TargetLowering(TargetMachine &TM)
|
WDC65816TargetLowering::WDC65816TargetLowering(TargetMachine &TM)
|
||||||
: TargetLowering(TM, new TargetLoweringObjectFileELF()) {
|
: TargetLowering(TM, new WDC65816TargetObjectFile()) {
|
||||||
|
|
||||||
addRegisterClass(MVT::i16, &WDC::AccRegsRegClass);
|
addRegisterClass(MVT::i16, &WDC::AccRegsRegClass);
|
||||||
addRegisterClass(MVT::i16, &WDC::IndexXRegsRegClass);
|
addRegisterClass(MVT::i16, &WDC::IndexXRegsRegClass);
|
||||||
|
@ -2339,3 +2340,31 @@ void WDC65816TargetLowering::ReplaceNodeResults(SDNode *N,
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Pin WDC65816Section's and WDC65816TargetObjectFile's vtables to this file.
|
||||||
|
void WDC65816Section::anchor() {}
|
||||||
|
|
||||||
|
WDC65816TargetObjectFile::~WDC65816TargetObjectFile() {
|
||||||
|
delete TextSection;
|
||||||
|
delete DataSection;
|
||||||
|
delete BSSSection;
|
||||||
|
delete ReadOnlySection;
|
||||||
|
|
||||||
|
delete StaticCtorSection;
|
||||||
|
delete StaticDtorSection;
|
||||||
|
delete LSDASection;
|
||||||
|
delete EHFrameSection;
|
||||||
|
delete DwarfAbbrevSection;
|
||||||
|
delete DwarfInfoSection;
|
||||||
|
delete DwarfLineSection;
|
||||||
|
delete DwarfFrameSection;
|
||||||
|
delete DwarfPubTypesSection;
|
||||||
|
delete DwarfDebugInlineSection;
|
||||||
|
delete DwarfStrSection;
|
||||||
|
delete DwarfLocSection;
|
||||||
|
delete DwarfARangesSection;
|
||||||
|
delete DwarfRangesSection;
|
||||||
|
delete DwarfMacroInfoSection;
|
||||||
|
}
|
||||||
|
|
46
lib/Target/WDC65816/WDC65816Section.h
Normal file
46
lib/Target/WDC65816/WDC65816Section.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
//===- WDC65816Section.h - WDC65816-specific section representation -*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// This file declares the NVPTXSection class.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_WDC65816SECTION_H
|
||||||
|
#define LLVM_WDC65816SECTION_H
|
||||||
|
|
||||||
|
#include "llvm/IR/GlobalVariable.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace llvm {
|
||||||
|
/// WDC65816Section - Represents a section in OMF
|
||||||
|
///
|
||||||
|
class WDC65816Section : public MCSection {
|
||||||
|
virtual void anchor();
|
||||||
|
public:
|
||||||
|
WDC65816Section(SectionVariant V, SectionKind K) : MCSection(V, K) {}
|
||||||
|
virtual ~WDC65816Section() {}
|
||||||
|
|
||||||
|
/// Override this as NVPTX has its own way of printing switching
|
||||||
|
/// to a section.
|
||||||
|
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
|
||||||
|
raw_ostream &OS,
|
||||||
|
const MCExpr *Subsection) const {}
|
||||||
|
|
||||||
|
/// Base address of PTX sections is zero.
|
||||||
|
virtual bool isBaseAddressKnownZero() const { return true; }
|
||||||
|
virtual bool UseCodeAlign() const { return false; }
|
||||||
|
virtual bool isVirtualSection() const { return false; }
|
||||||
|
virtual std::string getLabelBeginName() const { return ""; }
|
||||||
|
virtual std::string getLabelEndName() const { return ""; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace llvm
|
||||||
|
|
||||||
|
#endif
|
87
lib/Target/WDC65816/WDC65816TargetObjectFile.h
Normal file
87
lib/Target/WDC65816/WDC65816TargetObjectFile.h
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
//===-- WDC65816TargetObjectFile.h - WDC65816 Object Info -------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_TARGET_WDC65816_TARGETOBJECTFILE_H
|
||||||
|
#define LLVM_TARGET_WDC65816_TARGETOBJECTFILE_H
|
||||||
|
|
||||||
|
#include "WDC65816Section.h"
|
||||||
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace llvm {
|
||||||
|
class GlobalVariable;
|
||||||
|
class Module;
|
||||||
|
|
||||||
|
class WDC65816TargetObjectFile : public TargetLoweringObjectFile {
|
||||||
|
|
||||||
|
public:
|
||||||
|
WDC65816TargetObjectFile() {
|
||||||
|
TextSection = 0;
|
||||||
|
DataSection = 0;
|
||||||
|
BSSSection = 0;
|
||||||
|
ReadOnlySection = 0;
|
||||||
|
|
||||||
|
StaticCtorSection = 0;
|
||||||
|
StaticDtorSection = 0;
|
||||||
|
LSDASection = 0;
|
||||||
|
EHFrameSection = 0;
|
||||||
|
DwarfAbbrevSection = 0;
|
||||||
|
DwarfInfoSection = 0;
|
||||||
|
DwarfLineSection = 0;
|
||||||
|
DwarfFrameSection = 0;
|
||||||
|
DwarfPubTypesSection = 0;
|
||||||
|
DwarfDebugInlineSection = 0;
|
||||||
|
DwarfStrSection = 0;
|
||||||
|
DwarfLocSection = 0;
|
||||||
|
DwarfARangesSection = 0;
|
||||||
|
DwarfRangesSection = 0;
|
||||||
|
DwarfMacroInfoSection = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~WDC65816TargetObjectFile();
|
||||||
|
|
||||||
|
virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
|
||||||
|
TargetLoweringObjectFile::Initialize(ctx, TM);
|
||||||
|
TextSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getText());
|
||||||
|
DataSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getDataRel());
|
||||||
|
BSSSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getBSS());
|
||||||
|
ReadOnlySection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getReadOnly());
|
||||||
|
|
||||||
|
StaticCtorSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
StaticDtorSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
LSDASection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
EHFrameSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfAbbrevSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfInfoSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfLineSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfFrameSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfPubTypesSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfDebugInlineSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfStrSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfLocSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfARangesSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfRangesSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
DwarfMacroInfoSection = new WDC65816Section(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const MCSection *getSectionForConstant(SectionKind Kind) const {
|
||||||
|
return ReadOnlySection;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const MCSection *
|
||||||
|
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
|
return DataSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace llvm
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user