Add a helper method that will be used to support EXTRACT_SUBREG for selecting trunc's in fast-isel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55439 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-08-27 22:30:02 +00:00
parent 1dd0086b06
commit 8970f00def
2 changed files with 16 additions and 0 deletions

View File

@ -193,6 +193,11 @@ protected:
const TargetRegisterClass *RC,
uint64_t Imm);
/// FastEmitInst_extractsubreg - Emit a MachineInstr for an extract_subreg
/// from a specified index of a superregister.
unsigned FastEmitInst_extractsubreg(const TargetRegisterClass *RC,
unsigned Op0, uint32_t Idx);
private:
unsigned getRegForValue(Value *V,
DenseMap<const Value*, unsigned> &ValueMap);

View File

@ -586,3 +586,14 @@ unsigned FastISel::FastEmitInst_i(unsigned MachineInstOpcode,
BuildMI(MBB, II, ResultReg).addImm(Imm);
return ResultReg;
}
unsigned FastISel::FastEmitInst_extractsubreg(const TargetRegisterClass *RC,
unsigned Op0, uint32_t Idx) {
const TargetRegisterClass* SRC = *(RC->subregclasses_begin()+Idx-1);
unsigned ResultReg = createResultReg(SRC);
const TargetInstrDesc &II = TII.get(TargetInstrInfo::EXTRACT_SUBREG);
BuildMI(MBB, II, ResultReg).addReg(Op0);
return ResultReg;
}