forked from OSchip/llvm-project
				
			A small refactoring + adding comments.
SelectionDAGIsel::LowerArguments needs a function, not a basic block. So it makes sense to pass it the function instead of extracting a basic-block from the function and then tossing it. This is also more self-documenting (functions have arguments, BBs don't). In addition, added comments to a couple of Select* methods. llvm-svn: 176305
This commit is contained in:
		
							parent
							
								
									706469b453
								
							
						
					
					
						commit
						33ebf836bc
					
				| 
						 | 
					@ -249,16 +249,26 @@ private:
 | 
				
			||||||
                    const SDValue *Ops, unsigned NumOps, unsigned EmitNodeInfo);
 | 
					                    const SDValue *Ops, unsigned NumOps, unsigned EmitNodeInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void PrepareEHLandingPad();
 | 
					  void PrepareEHLandingPad();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /// \brief Perform instruction selection on all basic blocks in the function.
 | 
				
			||||||
  void SelectAllBasicBlocks(const Function &Fn);
 | 
					  void SelectAllBasicBlocks(const Function &Fn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /// \brief Perform instruction selection on a single basic block, for
 | 
				
			||||||
 | 
					  /// instructions between \p Begin and \p End.  \p HadTailCall will be set
 | 
				
			||||||
 | 
					  /// to true if a call in the block was translated as a tail call.
 | 
				
			||||||
 | 
					  void SelectBasicBlock(BasicBlock::const_iterator Begin,
 | 
				
			||||||
 | 
					                        BasicBlock::const_iterator End,
 | 
				
			||||||
 | 
					                        bool &HadTailCall);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool TryToFoldFastISelLoad(const LoadInst *LI, const Instruction *FoldInst,
 | 
					  bool TryToFoldFastISelLoad(const LoadInst *LI, const Instruction *FoldInst,
 | 
				
			||||||
                             FastISel *FastIS);
 | 
					                             FastISel *FastIS);
 | 
				
			||||||
  void FinishBasicBlock();
 | 
					  void FinishBasicBlock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void SelectBasicBlock(BasicBlock::const_iterator Begin,
 | 
					 | 
				
			||||||
                        BasicBlock::const_iterator End,
 | 
					 | 
				
			||||||
                        bool &HadTailCall);
 | 
					 | 
				
			||||||
  void CodeGenAndEmitDAG();
 | 
					  void CodeGenAndEmitDAG();
 | 
				
			||||||
  void LowerArguments(const BasicBlock *BB);
 | 
					
 | 
				
			||||||
 | 
					  /// \brief Generate instructions for lowering the incoming arguments of the
 | 
				
			||||||
 | 
					  /// given function.
 | 
				
			||||||
 | 
					  void LowerArguments(const Function &F);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void ComputeLiveOutVRegInfo();
 | 
					  void ComputeLiveOutVRegInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6596,9 +6596,7 @@ static bool isOnlyUsedInEntryBlock(const Argument *A, bool FastISel) {
 | 
				
			||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
 | 
					void SelectionDAGISel::LowerArguments(const Function &F) {
 | 
				
			||||||
  // If this is the entry block, emit arguments.
 | 
					 | 
				
			||||||
  const Function &F = *LLVMBB->getParent();
 | 
					 | 
				
			||||||
  SelectionDAG &DAG = SDB->DAG;
 | 
					  SelectionDAG &DAG = SDB->DAG;
 | 
				
			||||||
  DebugLoc dl = SDB->getCurDebugLoc();
 | 
					  DebugLoc dl = SDB->getCurDebugLoc();
 | 
				
			||||||
  const DataLayout *TD = TLI.getDataLayout();
 | 
					  const DataLayout *TD = TLI.getDataLayout();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1054,15 +1054,12 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
 | 
				
			||||||
      if (LLVMBB == &Fn.getEntryBlock()) {
 | 
					      if (LLVMBB == &Fn.getEntryBlock()) {
 | 
				
			||||||
        // Lower any arguments needed in this block if this is the entry block.
 | 
					        // Lower any arguments needed in this block if this is the entry block.
 | 
				
			||||||
        if (!FastIS->LowerArguments()) {
 | 
					        if (!FastIS->LowerArguments()) {
 | 
				
			||||||
 | 
					          // Fast isel failed to lower these arguments
 | 
				
			||||||
          if (EnableFastISelAbortArgs)
 | 
					          if (EnableFastISelAbortArgs)
 | 
				
			||||||
            // The "fast" selector couldn't lower these arguments.  For the
 | 
					 | 
				
			||||||
            // purpose of debugging, just abort.
 | 
					 | 
				
			||||||
            llvm_unreachable("FastISel didn't lower all arguments");
 | 
					            llvm_unreachable("FastISel didn't lower all arguments");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          // Call target indepedent SDISel argument lowering code if the target
 | 
					          // Use SelectionDAG argument lowering
 | 
				
			||||||
          // specific routine is not successful.
 | 
					          LowerArguments(Fn);
 | 
				
			||||||
          LowerArguments(LLVMBB);
 | 
					 | 
				
			||||||
          CurDAG->setRoot(SDB->getControlRoot());
 | 
					          CurDAG->setRoot(SDB->getControlRoot());
 | 
				
			||||||
          SDB->clear();
 | 
					          SDB->clear();
 | 
				
			||||||
          CodeGenAndEmitDAG();
 | 
					          CodeGenAndEmitDAG();
 | 
				
			||||||
| 
						 | 
					@ -1181,7 +1178,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      // Lower any arguments needed in this block if this is the entry block.
 | 
					      // Lower any arguments needed in this block if this is the entry block.
 | 
				
			||||||
      if (LLVMBB == &Fn.getEntryBlock())
 | 
					      if (LLVMBB == &Fn.getEntryBlock())
 | 
				
			||||||
        LowerArguments(LLVMBB);
 | 
					        LowerArguments(Fn);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (Begin != BI)
 | 
					    if (Begin != BI)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue