mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 04:33:40 +00:00
provide an explicit alignment for cp entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26069 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ef3640aded
commit
23c574a841
@ -101,11 +101,14 @@ namespace {
|
|||||||
/// Subtarget - Keep a pointer to the X86Subtarget around so that we can
|
/// Subtarget - Keep a pointer to the X86Subtarget around so that we can
|
||||||
/// make the right decision when generating code for different targets.
|
/// make the right decision when generating code for different targets.
|
||||||
const X86Subtarget *Subtarget;
|
const X86Subtarget *Subtarget;
|
||||||
|
|
||||||
|
const TargetData &TD;
|
||||||
|
|
||||||
/// X86ScalarSSE - Select between SSE2 or x87 floating point ops.
|
/// X86ScalarSSE - Select between SSE2 or x87 floating point ops.
|
||||||
bool X86ScalarSSE;
|
bool X86ScalarSSE;
|
||||||
public:
|
public:
|
||||||
ISel(TargetMachine &TM) : SelectionDAGISel(X86Lowering), X86Lowering(TM) {
|
ISel(TargetMachine &TM) : SelectionDAGISel(X86Lowering),
|
||||||
|
X86Lowering(TM), TD(TM.getTargetData()) {
|
||||||
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||||
X86ScalarSSE = Subtarget->hasSSE2();
|
X86ScalarSSE = Subtarget->hasSSE2();
|
||||||
}
|
}
|
||||||
@ -1312,11 +1315,17 @@ unsigned ISel::SelectExpr(SDOperand N) {
|
|||||||
Tmp1 = cast<FrameIndexSDNode>(N)->getIndex();
|
Tmp1 = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
addFrameReference(BuildMI(BB, X86::LEA32r, 4, Result), (int)Tmp1);
|
addFrameReference(BuildMI(BB, X86::LEA32r, 4, Result), (int)Tmp1);
|
||||||
return Result;
|
return Result;
|
||||||
case ISD::ConstantPool:
|
case ISD::ConstantPool: {
|
||||||
Tmp1 = BB->getParent()->getConstantPool()->
|
Constant *C = cast<ConstantPoolSDNode>(N)->get();
|
||||||
getConstantPoolIndex(cast<ConstantPoolSDNode>(N)->get());
|
unsigned Align = cast<ConstantPoolSDNode>(N)->getAlignment();
|
||||||
|
if (Align == 0) {
|
||||||
|
Align = C->getType() == Type::DoubleTy ? 3 :
|
||||||
|
TD.getTypeAlignmentShift(C->getType());
|
||||||
|
}
|
||||||
|
Tmp1 = BB->getParent()->getConstantPool()->getConstantPoolIndex(C, Align);
|
||||||
addConstantPoolReference(BuildMI(BB, X86::LEA32r, 4, Result), Tmp1);
|
addConstantPoolReference(BuildMI(BB, X86::LEA32r, 4, Result), Tmp1);
|
||||||
return Result;
|
return Result;
|
||||||
|
}
|
||||||
case ISD::ConstantFP:
|
case ISD::ConstantFP:
|
||||||
if (X86ScalarSSE) {
|
if (X86ScalarSSE) {
|
||||||
assert(cast<ConstantFPSDNode>(N)->isExactlyValue(+0.0) &&
|
assert(cast<ConstantFPSDNode>(N)->isExactlyValue(+0.0) &&
|
||||||
@ -2240,8 +2249,15 @@ unsigned ISel::SelectExpr(SDOperand N) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(N.getOperand(1))){
|
if (ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(N.getOperand(1))){
|
||||||
|
Constant *C = CP->get();
|
||||||
|
unsigned Align = CP->getAlignment();
|
||||||
|
if (Align == 0) {
|
||||||
|
Align = C->getType() == Type::DoubleTy ? 3 :
|
||||||
|
TD.getTypeAlignmentShift(C->getType());
|
||||||
|
}
|
||||||
|
|
||||||
unsigned CPIdx = BB->getParent()->getConstantPool()->
|
unsigned CPIdx = BB->getParent()->getConstantPool()->
|
||||||
getConstantPoolIndex(CP->get());
|
getConstantPoolIndex(C, Align);
|
||||||
Select(N.getOperand(0));
|
Select(N.getOperand(0));
|
||||||
addConstantPoolReference(BuildMI(BB, Opc, 4, Result), CPIdx);
|
addConstantPoolReference(BuildMI(BB, Opc, 4, Result), CPIdx);
|
||||||
} else {
|
} else {
|
||||||
@ -2296,7 +2312,7 @@ unsigned ISel::SelectExpr(SDOperand N) {
|
|||||||
assert(cast<VTSDNode>(Node->getOperand(3))->getVT() == MVT::f32 &&
|
assert(cast<VTSDNode>(Node->getOperand(3))->getVT() == MVT::f32 &&
|
||||||
"Bad EXTLOAD!");
|
"Bad EXTLOAD!");
|
||||||
unsigned CPIdx = BB->getParent()->getConstantPool()->
|
unsigned CPIdx = BB->getParent()->getConstantPool()->
|
||||||
getConstantPoolIndex(CP->get());
|
getConstantPoolIndex(CP->get(), 2);
|
||||||
|
|
||||||
addConstantPoolReference(BuildMI(BB, X86::FpLD32m, 4, Result), CPIdx);
|
addConstantPoolReference(BuildMI(BB, X86::FpLD32m, 4, Result), CPIdx);
|
||||||
return Result;
|
return Result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user