mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Added a way for TargetLowering to specify what values can be used as the
scale component of the target addressing mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8aa777d5ea
commit
714554d707
@ -559,15 +559,6 @@ public:
|
|||||||
/// valid for the specified target constraint letter.
|
/// valid for the specified target constraint letter.
|
||||||
virtual bool isOperandValidForConstraint(SDOperand Op, char ConstraintLetter);
|
virtual bool isOperandValidForConstraint(SDOperand Op, char ConstraintLetter);
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
|
||||||
// Loop Strength Reduction hooks
|
|
||||||
//
|
|
||||||
|
|
||||||
/// isLegalAddressImmediate - Return true if the integer value or GlobalValue
|
|
||||||
/// can be used as the offset of the target addressing mode.
|
|
||||||
virtual bool isLegalAddressImmediate(int64_t V) const;
|
|
||||||
virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
|
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Scheduler hooks
|
// Scheduler hooks
|
||||||
//
|
//
|
||||||
@ -580,6 +571,34 @@ public:
|
|||||||
virtual MachineBasicBlock *InsertAtEndOfBasicBlock(MachineInstr *MI,
|
virtual MachineBasicBlock *InsertAtEndOfBasicBlock(MachineInstr *MI,
|
||||||
MachineBasicBlock *MBB);
|
MachineBasicBlock *MBB);
|
||||||
|
|
||||||
|
//===--------------------------------------------------------------------===//
|
||||||
|
// Loop Strength Reduction hooks
|
||||||
|
//
|
||||||
|
|
||||||
|
/// isLegalAddressImmediate - Return true if the integer value or GlobalValue
|
||||||
|
/// can be used as the offset of the target addressing mode.
|
||||||
|
virtual bool isLegalAddressImmediate(int64_t V) const;
|
||||||
|
virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
|
||||||
|
|
||||||
|
typedef std::vector<unsigned>::const_iterator legal_am_scale_iterator;
|
||||||
|
legal_am_scale_iterator legal_am_scale_begin() const {
|
||||||
|
return LegalAddressScales.begin();
|
||||||
|
}
|
||||||
|
legal_am_scale_iterator legal_am_scale_end() const {
|
||||||
|
return LegalAddressScales.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// addLegalAddressScale - Add a integer (> 1) value which can be used as
|
||||||
|
/// scale in the target addressing mode. Note: the ordering matters so the
|
||||||
|
/// least efficient ones should be entered first.
|
||||||
|
void addLegalAddressScale(unsigned Scale) {
|
||||||
|
LegalAddressScales.push_back(Scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<unsigned> LegalAddressScales;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TargetMachine &TM;
|
TargetMachine &TM;
|
||||||
const TargetData &TD;
|
const TargetData &TD;
|
||||||
|
@ -84,7 +84,7 @@ bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
|
|||||||
if (FileType != TargetMachine::AssemblyFile) return true;
|
if (FileType != TargetMachine::AssemblyFile) return true;
|
||||||
|
|
||||||
// Run loop strength reduction before anything else.
|
// Run loop strength reduction before anything else.
|
||||||
if (!Fast) PM.add(createLoopStrengthReducePass(1, &TLInfo));
|
if (!Fast) PM.add(createLoopStrengthReducePass(&TLInfo));
|
||||||
|
|
||||||
// FIXME: Implement efficient support for garbage collection intrinsics.
|
// FIXME: Implement efficient support for garbage collection intrinsics.
|
||||||
PM.add(createLowerGCPass());
|
PM.add(createLowerGCPass());
|
||||||
@ -138,7 +138,7 @@ void PPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
|
|||||||
TM.setRelocationModel(Reloc::DynamicNoPIC);
|
TM.setRelocationModel(Reloc::DynamicNoPIC);
|
||||||
|
|
||||||
// Run loop strength reduction before anything else.
|
// Run loop strength reduction before anything else.
|
||||||
PM.add(createLoopStrengthReducePass(1, TM.getTargetLowering()));
|
PM.add(createLoopStrengthReducePass(TM.getTargetLowering()));
|
||||||
|
|
||||||
// FIXME: Implement efficient support for garbage collection intrinsics.
|
// FIXME: Implement efficient support for garbage collection intrinsics.
|
||||||
PM.add(createLowerGCPass());
|
PM.add(createLowerGCPass());
|
||||||
|
@ -49,6 +49,16 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM)
|
|||||||
setSchedulingPreference(SchedulingForRegPressure);
|
setSchedulingPreference(SchedulingForRegPressure);
|
||||||
setShiftAmountFlavor(Mask); // shl X, 32 == shl X, 0
|
setShiftAmountFlavor(Mask); // shl X, 32 == shl X, 0
|
||||||
setStackPointerRegisterToSaveRestore(X86::ESP);
|
setStackPointerRegisterToSaveRestore(X86::ESP);
|
||||||
|
|
||||||
|
// Add legal addressing mode scale values.
|
||||||
|
addLegalAddressScale(8);
|
||||||
|
addLegalAddressScale(4);
|
||||||
|
addLegalAddressScale(2);
|
||||||
|
// Enter the ones which require both scale + index last. These are more
|
||||||
|
// expensive.
|
||||||
|
addLegalAddressScale(9);
|
||||||
|
addLegalAddressScale(5);
|
||||||
|
addLegalAddressScale(3);
|
||||||
|
|
||||||
// Set up the register classes.
|
// Set up the register classes.
|
||||||
addRegisterClass(MVT::i8, X86::R8RegisterClass);
|
addRegisterClass(MVT::i8, X86::R8RegisterClass);
|
||||||
|
@ -97,7 +97,7 @@ bool X86TargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out,
|
|||||||
FileType != TargetMachine::ObjectFile) return true;
|
FileType != TargetMachine::ObjectFile) return true;
|
||||||
|
|
||||||
// Run loop strength reduction before anything else.
|
// Run loop strength reduction before anything else.
|
||||||
if (EnableX86LSR) PM.add(createLoopStrengthReducePass(1, &TLInfo));
|
if (EnableX86LSR) PM.add(createLoopStrengthReducePass(&TLInfo));
|
||||||
|
|
||||||
// FIXME: Implement efficient support for garbage collection intrinsics.
|
// FIXME: Implement efficient support for garbage collection intrinsics.
|
||||||
PM.add(createLowerGCPass());
|
PM.add(createLowerGCPass());
|
||||||
@ -166,7 +166,7 @@ void X86JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
|
|||||||
|
|
||||||
// Run loop strength reduction before anything else.
|
// Run loop strength reduction before anything else.
|
||||||
if (EnableX86LSR)
|
if (EnableX86LSR)
|
||||||
PM.add(createLoopStrengthReducePass(1, TM.getTargetLowering()));
|
PM.add(createLoopStrengthReducePass(TM.getTargetLowering()));
|
||||||
|
|
||||||
// FIXME: Implement efficient support for garbage collection intrinsics.
|
// FIXME: Implement efficient support for garbage collection intrinsics.
|
||||||
PM.add(createLowerGCPass());
|
PM.add(createLowerGCPass());
|
||||||
|
Loading…
Reference in New Issue
Block a user