mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
PPCMaterializeInt should only take a ConstantInt so represent this in the prototype
and fix up all uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243191 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -164,7 +164,8 @@ class PPCFastISel final : public FastISel {
|
|||||||
unsigned DestReg, bool IsZExt);
|
unsigned DestReg, bool IsZExt);
|
||||||
unsigned PPCMaterializeFP(const ConstantFP *CFP, MVT VT);
|
unsigned PPCMaterializeFP(const ConstantFP *CFP, MVT VT);
|
||||||
unsigned PPCMaterializeGV(const GlobalValue *GV, MVT VT);
|
unsigned PPCMaterializeGV(const GlobalValue *GV, MVT VT);
|
||||||
unsigned PPCMaterializeInt(const Constant *C, MVT VT, bool UseSExt = true);
|
unsigned PPCMaterializeInt(const ConstantInt *CI, MVT VT,
|
||||||
|
bool UseSExt = true);
|
||||||
unsigned PPCMaterialize32BitInt(int64_t Imm,
|
unsigned PPCMaterialize32BitInt(int64_t Imm,
|
||||||
const TargetRegisterClass *RC);
|
const TargetRegisterClass *RC);
|
||||||
unsigned PPCMaterialize64BitInt(int64_t Imm,
|
unsigned PPCMaterialize64BitInt(int64_t Imm,
|
||||||
@@ -1614,14 +1615,12 @@ bool PPCFastISel::SelectRet(const Instruction *I) {
|
|||||||
// we can't use PPCMaterializeInt because it extends the sign which will
|
// we can't use PPCMaterializeInt because it extends the sign which will
|
||||||
// cause negations of the returned value to be incorrect as they are
|
// cause negations of the returned value to be incorrect as they are
|
||||||
// implemented as the flip of the least significant bit.
|
// implemented as the flip of the least significant bit.
|
||||||
if (isa<ConstantInt>(*RV)) {
|
if (const ConstantInt *CI = dyn_cast<ConstantInt>(RV)) {
|
||||||
const Constant *C = cast<Constant>(RV);
|
|
||||||
|
|
||||||
CCValAssign &VA = ValLocs[0];
|
CCValAssign &VA = ValLocs[0];
|
||||||
|
|
||||||
unsigned RetReg = VA.getLocReg();
|
unsigned RetReg = VA.getLocReg();
|
||||||
unsigned SrcReg = PPCMaterializeInt(C, MVT::i64,
|
unsigned SrcReg =
|
||||||
VA.getLocInfo() == CCValAssign::SExt);
|
PPCMaterializeInt(CI, MVT::i64, VA.getLocInfo() == CCValAssign::SExt);
|
||||||
|
|
||||||
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||||
TII.get(TargetOpcode::COPY), RetReg).addReg(SrcReg);
|
TII.get(TargetOpcode::COPY), RetReg).addReg(SrcReg);
|
||||||
@@ -2085,12 +2084,11 @@ unsigned PPCFastISel::PPCMaterialize64BitInt(int64_t Imm,
|
|||||||
|
|
||||||
// Materialize an integer constant into a register, and return
|
// Materialize an integer constant into a register, and return
|
||||||
// the register number (or zero if we failed to handle it).
|
// the register number (or zero if we failed to handle it).
|
||||||
unsigned PPCFastISel::PPCMaterializeInt(const Constant *C, MVT VT,
|
unsigned PPCFastISel::PPCMaterializeInt(const ConstantInt *CI, MVT VT,
|
||||||
bool UseSExt) {
|
bool UseSExt) {
|
||||||
// If we're using CR bit registers for i1 values, handle that as a special
|
// If we're using CR bit registers for i1 values, handle that as a special
|
||||||
// case first.
|
// case first.
|
||||||
if (VT == MVT::i1 && PPCSubTarget->useCRBits()) {
|
if (VT == MVT::i1 && PPCSubTarget->useCRBits()) {
|
||||||
const ConstantInt *CI = cast<ConstantInt>(C);
|
|
||||||
unsigned ImmReg = createResultReg(&PPC::CRBITRCRegClass);
|
unsigned ImmReg = createResultReg(&PPC::CRBITRCRegClass);
|
||||||
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||||
TII.get(CI->isZero() ? PPC::CRUNSET : PPC::CRSET), ImmReg);
|
TII.get(CI->isZero() ? PPC::CRUNSET : PPC::CRSET), ImmReg);
|
||||||
@@ -2105,7 +2103,6 @@ unsigned PPCFastISel::PPCMaterializeInt(const Constant *C, MVT VT,
|
|||||||
&PPC::GPRCRegClass);
|
&PPC::GPRCRegClass);
|
||||||
|
|
||||||
// If the constant is in range, use a load-immediate.
|
// If the constant is in range, use a load-immediate.
|
||||||
const ConstantInt *CI = cast<ConstantInt>(C);
|
|
||||||
if (isInt<16>(CI->getSExtValue())) {
|
if (isInt<16>(CI->getSExtValue())) {
|
||||||
unsigned Opc = (VT == MVT::i64) ? PPC::LI8 : PPC::LI;
|
unsigned Opc = (VT == MVT::i64) ? PPC::LI8 : PPC::LI;
|
||||||
unsigned ImmReg = createResultReg(RC);
|
unsigned ImmReg = createResultReg(RC);
|
||||||
@@ -2138,8 +2135,8 @@ unsigned PPCFastISel::fastMaterializeConstant(const Constant *C) {
|
|||||||
return PPCMaterializeFP(CFP, VT);
|
return PPCMaterializeFP(CFP, VT);
|
||||||
else if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
|
else if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
|
||||||
return PPCMaterializeGV(GV, VT);
|
return PPCMaterializeGV(GV, VT);
|
||||||
else if (isa<ConstantInt>(C))
|
else if (const ConstantInt *CI = dyn_cast<ConstantInt>(C))
|
||||||
return PPCMaterializeInt(C, VT, VT != MVT::i1);
|
return PPCMaterializeInt(CI, VT, VT != MVT::i1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user