mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
merge two loops over all nodes in the graph into one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
98d45790ae
commit
fb444af5c9
@ -207,9 +207,6 @@ namespace {
|
|||||||
SDValue &Index, SDValue &Disp,
|
SDValue &Index, SDValue &Disp,
|
||||||
SDValue &Segment);
|
SDValue &Segment);
|
||||||
|
|
||||||
void PreprocessForCallLoads();
|
|
||||||
void PreprocessForFPConvert();
|
|
||||||
|
|
||||||
/// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
|
/// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
|
||||||
/// inline asm expressions.
|
/// inline asm expressions.
|
||||||
virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op,
|
virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op,
|
||||||
@ -415,54 +412,50 @@ static bool isCalleeLoad(SDValue Callee, SDValue &Chain) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void X86DAGToDAGISel::PreprocessISelDAG() {
|
||||||
void X86DAGToDAGISel::PreprocessForCallLoads() {
|
OptForSize = MF->getFunction()->hasFnAttr(Attribute::OptimizeForSize);
|
||||||
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
|
||||||
E = CurDAG->allnodes_end(); I != E; ++I) {
|
|
||||||
if (I->getOpcode() != X86ISD::CALL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/// Also try moving call address load from outside callseq_start to just
|
|
||||||
/// before the call to allow it to be folded.
|
|
||||||
///
|
|
||||||
/// [Load chain]
|
|
||||||
/// ^
|
|
||||||
/// |
|
|
||||||
/// [Load]
|
|
||||||
/// ^ ^
|
|
||||||
/// | |
|
|
||||||
/// / \--
|
|
||||||
/// / |
|
|
||||||
///[CALLSEQ_START] |
|
|
||||||
/// ^ |
|
|
||||||
/// | |
|
|
||||||
/// [LOAD/C2Reg] |
|
|
||||||
/// | |
|
|
||||||
/// \ /
|
|
||||||
/// \ /
|
|
||||||
/// [CALL]
|
|
||||||
SDValue Chain = I->getOperand(0);
|
|
||||||
SDValue Load = I->getOperand(1);
|
|
||||||
if (!isCalleeLoad(Load, Chain))
|
|
||||||
continue;
|
|
||||||
MoveBelowCallSeqStart(CurDAG, Load, SDValue(I, 0), Chain);
|
|
||||||
++NumLoadMoved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// PreprocessForFPConvert - Walk over the dag lowering fpround and fpextend
|
|
||||||
/// nodes that target the FP stack to be store and load to the stack. This is a
|
|
||||||
/// gross hack. We would like to simply mark these as being illegal, but when
|
|
||||||
/// we do that, legalize produces these when it expands calls, then expands
|
|
||||||
/// these in the same legalize pass. We would like dag combine to be able to
|
|
||||||
/// hack on these between the call expansion and the node legalization. As such
|
|
||||||
/// this pass basically does "really late" legalization of these inline with the
|
|
||||||
/// X86 isel pass.
|
|
||||||
void X86DAGToDAGISel::PreprocessForFPConvert() {
|
|
||||||
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
||||||
E = CurDAG->allnodes_end(); I != E; ) {
|
E = CurDAG->allnodes_end(); I != E; ) {
|
||||||
SDNode *N = I++; // Preincrement iterator to avoid invalidation issues.
|
SDNode *N = I++; // Preincrement iterator to avoid invalidation issues.
|
||||||
|
|
||||||
|
if (OptLevel != CodeGenOpt::None && N->getOpcode() == X86ISD::CALL) {
|
||||||
|
/// Also try moving call address load from outside callseq_start to just
|
||||||
|
/// before the call to allow it to be folded.
|
||||||
|
///
|
||||||
|
/// [Load chain]
|
||||||
|
/// ^
|
||||||
|
/// |
|
||||||
|
/// [Load]
|
||||||
|
/// ^ ^
|
||||||
|
/// | |
|
||||||
|
/// / \--
|
||||||
|
/// / |
|
||||||
|
///[CALLSEQ_START] |
|
||||||
|
/// ^ |
|
||||||
|
/// | |
|
||||||
|
/// [LOAD/C2Reg] |
|
||||||
|
/// | |
|
||||||
|
/// \ /
|
||||||
|
/// \ /
|
||||||
|
/// [CALL]
|
||||||
|
SDValue Chain = N->getOperand(0);
|
||||||
|
SDValue Load = N->getOperand(1);
|
||||||
|
if (!isCalleeLoad(Load, Chain))
|
||||||
|
continue;
|
||||||
|
MoveBelowCallSeqStart(CurDAG, Load, SDValue(N, 0), Chain);
|
||||||
|
++NumLoadMoved;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lower fpround and fpextend nodes that target the FP stack to be store and
|
||||||
|
// load to the stack. This is a gross hack. We would like to simply mark
|
||||||
|
// these as being illegal, but when we do that, legalize produces these when
|
||||||
|
// it expands calls, then expands these in the same legalize pass. We would
|
||||||
|
// like dag combine to be able to hack on these between the call expansion
|
||||||
|
// and the node legalization. As such this pass basically does "really
|
||||||
|
// late" legalization of these inline with the X86 isel pass.
|
||||||
|
// FIXME: This should only happen when not compiled with -O0.
|
||||||
if (N->getOpcode() != ISD::FP_ROUND && N->getOpcode() != ISD::FP_EXTEND)
|
if (N->getOpcode() != ISD::FP_ROUND && N->getOpcode() != ISD::FP_EXTEND)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -518,15 +511,6 @@ void X86DAGToDAGISel::PreprocessForFPConvert() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86DAGToDAGISel::PreprocessISelDAG() {
|
|
||||||
OptForSize = MF->getFunction()->hasFnAttr(Attribute::OptimizeForSize);
|
|
||||||
|
|
||||||
if (OptLevel != CodeGenOpt::None)
|
|
||||||
PreprocessForCallLoads();
|
|
||||||
|
|
||||||
// FIXME: This should only happen when not compiled with -O0.
|
|
||||||
PreprocessForFPConvert();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EmitSpecialCodeForMain - Emit any code that needs to be executed only in
|
/// EmitSpecialCodeForMain - Emit any code that needs to be executed only in
|
||||||
/// the main function.
|
/// the main function.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user