Remove the -darwin and -aix llc options, inferring darwinism and aixism from

the target triple & subtarget info.  woo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-06-16 18:50:48 +00:00
parent fb9d0dce97
commit af89fa609b
4 changed files with 7 additions and 35 deletions

View File

@ -21,17 +21,10 @@ namespace llvm {
class FunctionPass; class FunctionPass;
class PPCTargetMachine; class PPCTargetMachine;
enum PPCTargetEnum {
TargetDefault, TargetAIX, TargetDarwin
};
FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCBranchSelectionPass();
FunctionPass *createPPCISelDag(PPCTargetMachine &TM); FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
FunctionPass *createDarwinAsmPrinter(std::ostream &OS, PPCTargetMachine &TM); FunctionPass *createDarwinAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
FunctionPass *createAIXAsmPrinter(std::ostream &OS, PPCTargetMachine &TM); FunctionPass *createAIXAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
extern PPCTargetEnum PPCTarget;
} // end namespace llvm; } // end namespace llvm;
// GCC #defines PPC on Linux but we use it as our namespace name // GCC #defines PPC on Linux but we use it as our namespace name

View File

@ -215,7 +215,7 @@ def GPRC : RegisterClass<"PPC", [i32], 32,
let MethodBodies = [{ let MethodBodies = [{
GPRCClass::iterator GPRCClass::iterator
GPRCClass::allocation_order_begin(MachineFunction &MF) const { GPRCClass::allocation_order_begin(MachineFunction &MF) const {
return begin() + ((TargetAIX == PPCTarget) ? 1 : 0); return begin();
} }
GPRCClass::iterator GPRCClass::iterator
GPRCClass::allocation_order_end(MachineFunction &MF) const { GPRCClass::allocation_order_end(MachineFunction &MF) const {
@ -238,7 +238,7 @@ def G8RC : RegisterClass<"PPC", [i64], 64,
let MethodBodies = [{ let MethodBodies = [{
G8RCClass::iterator G8RCClass::iterator
G8RCClass::allocation_order_begin(MachineFunction &MF) const { G8RCClass::allocation_order_begin(MachineFunction &MF) const {
return begin() + ((TargetAIX == PPCTarget) ? 1 : 0); return begin();
} }
G8RCClass::iterator G8RCClass::iterator
G8RCClass::allocation_order_end(MachineFunction &MF) const { G8RCClass::allocation_order_end(MachineFunction &MF) const {

View File

@ -14,23 +14,9 @@
#include "PPCSubtarget.h" #include "PPCSubtarget.h"
#include "PPC.h" #include "PPC.h"
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Support/CommandLine.h"
#include "PPCGenSubtarget.inc" #include "PPCGenSubtarget.inc"
#include <iostream> #include <iostream>
using namespace llvm; using namespace llvm;
PPCTargetEnum llvm::PPCTarget = TargetDefault;
namespace llvm {
cl::opt<PPCTargetEnum, true>
PPCTargetArg(cl::desc("Force generation of code for a specific PPC target:"),
cl::values(
clEnumValN(TargetAIX, "aix", " Enable AIX codegen"),
clEnumValN(TargetDarwin,"darwin",
" Enable Darwin codegen"),
clEnumValEnd),
cl::location(PPCTarget), cl::init(TargetDefault));
}
#if defined(__APPLE__) #if defined(__APPLE__)
#include <mach/mach.h> #include <mach/mach.h>
@ -115,7 +101,9 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit)
// if one cannot be determined, to true. // if one cannot be determined, to true.
const std::string& TT = M.getTargetTriple(); const std::string& TT = M.getTargetTriple();
if (TT.length() > 5) { if (TT.length() > 5) {
IsDarwin = TT.find("darwin") != std::string::npos; IsDarwin = TT.find("-darwin") != std::string::npos;
if (!IsDarwin)
IsAIX = TT.find("-aix") != std::string::npos;
} else if (TT.empty()) { } else if (TT.empty()) {
#if defined(_POWER) #if defined(_POWER)
IsAIX = true; IsAIX = true;

View File

@ -91,10 +91,6 @@ PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS,
FrameInfo(*this, false), JITInfo(*this), TLInfo(*this), FrameInfo(*this, false), JITInfo(*this), TLInfo(*this),
InstrItins(Subtarget.getInstrItineraryData()) { InstrItins(Subtarget.getInstrItineraryData()) {
if (TargetDefault == PPCTarget) {
if (Subtarget.isAIX()) PPCTarget = TargetAIX;
if (Subtarget.isDarwin()) PPCTarget = TargetDarwin;
}
if (getRelocationModel() == Reloc::Default) if (getRelocationModel() == Reloc::Default)
if (Subtarget.isDarwin()) if (Subtarget.isDarwin())
setRelocationModel(Reloc::DynamicNoPIC); setRelocationModel(Reloc::DynamicNoPIC);
@ -153,15 +149,10 @@ bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
// Decide which asm printer to use. If the user has not specified one on // Decide which asm printer to use. If the user has not specified one on
// the command line, choose whichever one matches the default (current host). // the command line, choose whichever one matches the default (current host).
switch (PPCTarget) { if (Subtarget.isAIX())
case TargetAIX:
PM.add(createAIXAsmPrinter(Out, *this)); PM.add(createAIXAsmPrinter(Out, *this));
break; else
case TargetDefault:
case TargetDarwin:
PM.add(createDarwinAsmPrinter(Out, *this)); PM.add(createDarwinAsmPrinter(Out, *this));
break;
}
PM.add(createMachineCodeDeleter()); PM.add(createMachineCodeDeleter());
return false; return false;