X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FPowerPC%2FPPCTargetMachine.cpp;h=dd40e1333c7b1f5c2641ffdfb2f0d0c0646efb0c;hb=eb39492deba56cfb4e1772b1826e8be77cfac7f8;hp=6eef33d775010d0c06dbb8a5a11d2c1d37f974f1;hpb=e4fce6f19c2f7f4982d9b0a022ddda541e5135fb;p=oota-llvm.git diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 6eef33d7750..dd40e1333c7 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -33,6 +33,10 @@ namespace llvm { cl::opt AIX("aix", cl::desc("Generate AIX/xcoff instead of Darwin/MachO"), cl::Hidden); + + cl::opt EnablePPCLSR("enable-lsr-for-ppc", + cl::desc("Enable LSR for PPC (beta option!)"), + cl::Hidden); } namespace { @@ -57,7 +61,6 @@ PowerPCTargetMachine::PowerPCTargetMachine(const std::string &name, {} unsigned PPC32TargetMachine::getJITMatchQuality() { - return 0; #if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) return 10; #else @@ -71,6 +74,11 @@ unsigned PPC32TargetMachine::getJITMatchQuality() { bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) { bool LP64 = (0 != dynamic_cast(this)); + + if (EnablePPCLSR) { + PM.add(createLoopStrengthReducePass()); + PM.add(createCFGSimplificationPass()); + } // FIXME: Implement efficient support for garbage collection intrinsics. PM.add(createLowerGCPass()); @@ -114,6 +122,11 @@ bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM, } void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { + if (EnablePPCLSR) { + PM.add(createLoopStrengthReducePass()); + PM.add(createCFGSimplificationPass()); + } + // FIXME: Implement efficient support for garbage collection intrinsics. PM.add(createLowerGCPass()); @@ -139,28 +152,29 @@ void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { PM.add(createMachineFunctionPrinterPass(&std::cerr)); } -void PowerPCJITInfo::replaceMachineCodeForFunction(void *Old, void *New) { - assert(0 && "Cannot execute PowerPCJITInfo::replaceMachineCodeForFunction()"); -} - /// PowerPCTargetMachine ctor - Create an ILP32 architecture model /// PPC32TargetMachine::PPC32TargetMachine(const Module &M, IntrinsicLowering *IL) : PowerPCTargetMachine(PPC32ID, IL, - TargetData(PPC32ID,false,4,4,4,4,4,4,2,1,4), + TargetData(PPC32ID,false,4,4,4,4,4,4,2,1,1), PowerPCFrameInfo(*this, false)), JITInfo(*this) {} /// PPC64TargetMachine ctor - Create a LP64 architecture model /// PPC64TargetMachine::PPC64TargetMachine(const Module &M, IntrinsicLowering *IL) : PowerPCTargetMachine(PPC64ID, IL, - TargetData(PPC64ID,false,8,4,4,4,4,4,2,1,4), + TargetData(PPC64ID,false,8,4,4,4,4,4,2,1,1), PowerPCFrameInfo(*this, true)) {} unsigned PPC32TargetMachine::getModuleMatchQuality(const Module &M) { + // We strongly match "powerpc-*". + std::string TT = M.getTargetTriple(); + if (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "powerpc-") + return 20; + if (M.getEndianness() == Module::BigEndian && M.getPointerSize() == Module::Pointer32) - return 10; // Direct match + return 10; // Weak match else if (M.getEndianness() != Module::AnyEndianness || M.getPointerSize() != Module::AnyPointerSize) return 0; // Match for some other target