mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-01 01:30:36 +00:00
Honor the command line specification for machine type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32483 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2426775c81
commit
55a7ec33d7
@ -81,6 +81,9 @@ public:
|
|||||||
/// Set the CPU string. Replaces previous setting. Setting to "" clears CPU.
|
/// Set the CPU string. Replaces previous setting. Setting to "" clears CPU.
|
||||||
void setCPU(const std::string &String);
|
void setCPU(const std::string &String);
|
||||||
|
|
||||||
|
/// Get the CPU string.
|
||||||
|
const std::string &getCPU() const { return Features[0]; }
|
||||||
|
|
||||||
/// Setting CPU string only if no string is set.
|
/// Setting CPU string only if no string is set.
|
||||||
void setCPUIfNone(const std::string &String);
|
void setCPUIfNone(const std::string &String);
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#ifndef LLVM_TARGET_TARGETSUBTARGET_H
|
#ifndef LLVM_TARGET_TARGETSUBTARGET_H
|
||||||
#define LLVM_TARGET_TARGETSUBTARGET_H
|
#define LLVM_TARGET_TARGETSUBTARGET_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -25,10 +27,13 @@ namespace llvm {
|
|||||||
class TargetSubtarget {
|
class TargetSubtarget {
|
||||||
TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT
|
TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT
|
||||||
void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT
|
void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT
|
||||||
|
std::string CPU; // CPU name.
|
||||||
protected: // Can only create subclasses...
|
protected: // Can only create subclasses...
|
||||||
TargetSubtarget();
|
TargetSubtarget();
|
||||||
public:
|
public:
|
||||||
virtual ~TargetSubtarget();
|
virtual ~TargetSubtarget();
|
||||||
|
void setCPU(const std::string &C) { CPU = C; }
|
||||||
|
const std::string &getCPU() const { return CPU; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -542,8 +542,19 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
|
|
||||||
|
|
||||||
bool DarwinAsmPrinter::doInitialization(Module &M) {
|
bool DarwinAsmPrinter::doInitialization(Module &M) {
|
||||||
if (Subtarget.isGigaProcessor())
|
const std::string &CPU = Subtarget.getCPU();
|
||||||
|
|
||||||
|
if (CPU != "generic")
|
||||||
|
O << "\t.machine ppc" << CPU << "\n";
|
||||||
|
else if (Subtarget.isGigaProcessor())
|
||||||
O << "\t.machine ppc970\n";
|
O << "\t.machine ppc970\n";
|
||||||
|
else if (Subtarget.isPPC64())
|
||||||
|
O << "\t.machine ppc64\n";
|
||||||
|
else if (Subtarget.hasAltivec())
|
||||||
|
O << "\t.machine ppc7400\n";
|
||||||
|
else
|
||||||
|
O << "\t.machine ppc\n";
|
||||||
|
|
||||||
AsmPrinter::doInitialization(M);
|
AsmPrinter::doInitialization(M);
|
||||||
|
|
||||||
// Darwin wants symbols to be quoted if they have complex names.
|
// Darwin wants symbols to be quoted if they have complex names.
|
||||||
|
@ -460,6 +460,7 @@ void SubtargetEmitter::ParseFeaturesFunction(std::ostream &OS) {
|
|||||||
" const std::string &CPU) {\n"
|
" const std::string &CPU) {\n"
|
||||||
" SubtargetFeatures Features(FS);\n"
|
" SubtargetFeatures Features(FS);\n"
|
||||||
" Features.setCPUIfNone(CPU);\n"
|
" Features.setCPUIfNone(CPU);\n"
|
||||||
|
" setCPU(Features.getCPU());\n"
|
||||||
" uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n"
|
" uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n"
|
||||||
" FeatureKV, FeatureKVSize);\n";
|
" FeatureKV, FeatureKVSize);\n";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user