mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-17 15:38:40 +00:00
Add some more load types in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
adc581f5cb
commit
4e68c7cca4
@ -110,6 +110,7 @@ class ARMFastISel : public FastISel {
|
|||||||
// Utility routines.
|
// Utility routines.
|
||||||
private:
|
private:
|
||||||
bool isTypeLegal(const Type *Ty, EVT &VT);
|
bool isTypeLegal(const Type *Ty, EVT &VT);
|
||||||
|
bool isLoadTypeLegal(const Type *Ty, EVT &VT);
|
||||||
bool ARMEmitLoad(EVT VT, unsigned &ResultReg, unsigned Reg, int Offset);
|
bool ARMEmitLoad(EVT VT, unsigned &ResultReg, unsigned Reg, int Offset);
|
||||||
bool ARMLoadAlloca(const Instruction *I);
|
bool ARMLoadAlloca(const Instruction *I);
|
||||||
bool ARMComputeRegOffset(const Value *Obj, unsigned &Reg, int &Offset);
|
bool ARMComputeRegOffset(const Value *Obj, unsigned &Reg, int &Offset);
|
||||||
@ -317,12 +318,23 @@ bool ARMFastISel::isTypeLegal(const Type *Ty, EVT &VT) {
|
|||||||
|
|
||||||
// Only handle simple types.
|
// Only handle simple types.
|
||||||
if (VT == MVT::Other || !VT.isSimple()) return false;
|
if (VT == MVT::Other || !VT.isSimple()) return false;
|
||||||
|
|
||||||
// Handle all legal types, i.e. a register that will directly hold this
|
// Handle all legal types, i.e. a register that will directly hold this
|
||||||
// value.
|
// value.
|
||||||
return TLI.isTypeLegal(VT);
|
return TLI.isTypeLegal(VT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ARMFastISel::isLoadTypeLegal(const Type *Ty, EVT &VT) {
|
||||||
|
if (isTypeLegal(Ty, VT)) return true;
|
||||||
|
|
||||||
|
// If this is a type than can be sign or zero-extended to a basic operation
|
||||||
|
// go ahead and accept it now.
|
||||||
|
if (VT == MVT::i8 || VT == MVT::i16)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Computes the Reg+Offset to get to an object.
|
// Computes the Reg+Offset to get to an object.
|
||||||
bool ARMFastISel::ARMComputeRegOffset(const Value *Obj, unsigned &Reg,
|
bool ARMFastISel::ARMComputeRegOffset(const Value *Obj, unsigned &Reg,
|
||||||
int &Offset) {
|
int &Offset) {
|
||||||
@ -403,6 +415,14 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
|
|||||||
default:
|
default:
|
||||||
assert(false && "Trying to emit for an unhandled type!");
|
assert(false && "Trying to emit for an unhandled type!");
|
||||||
return false;
|
return false;
|
||||||
|
case MVT::i16:
|
||||||
|
Opc = isThumb ? ARM::tLDRH : ARM::LDRH;
|
||||||
|
VT = MVT::i32;
|
||||||
|
break;
|
||||||
|
case MVT::i8:
|
||||||
|
Opc = isThumb ? ARM::tLDRB : ARM::LDRB;
|
||||||
|
VT = MVT::i32;
|
||||||
|
break;
|
||||||
case MVT::i32:
|
case MVT::i32:
|
||||||
Opc = isThumb ? ARM::tLDR : ARM::LDR;
|
Opc = isThumb ? ARM::tLDR : ARM::LDR;
|
||||||
break;
|
break;
|
||||||
@ -432,7 +452,7 @@ bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
|
|||||||
|
|
||||||
// Verify we have a legal type before going any further.
|
// Verify we have a legal type before going any further.
|
||||||
EVT VT;
|
EVT VT;
|
||||||
if (!isTypeLegal(I->getType(), VT))
|
if (!isLoadTypeLegal(I->getType(), VT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Our register and offset with innocuous defaults.
|
// Our register and offset with innocuous defaults.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user