[llvm-commits] [llvm] r54522 - in /llvm/trunk/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp SimpleBBISel.cpp SimpleBBISel.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Fri Aug 8 00:30:34 PDT 2008


That's awesome Evan! ;-)

Thanks! It's going the right direction... :)

Nicolas

Evan Cheng wrote:
> Author: evancheng
> Date: Fri Aug  8 02:27:28 2008
> New Revision: 54522
>
> URL: http://llvm.org/viewvc/llvm-project?rev=54522&view=rev
> Log:
> Add skeleton of simple basic block instruction selector.
>
> Added:
>     llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.cpp
>     llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.h
> Modified:
>     llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=54522&r1=54521&r2=54522&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Aug  8 02:27:28 2008
> @@ -12,10 +12,10 @@
>  //===----------------------------------------------------------------------===//
>  
>  #define DEBUG_TYPE "isel"
> +#include "llvm/CodeGen/SelectionDAGISel.h"
> +#include "SimpleBBISel.h"
>  #include "llvm/ADT/BitVector.h"
>  #include "llvm/Analysis/AliasAnalysis.h"
> -#include "llvm/CodeGen/SelectionDAGISel.h"
> -#include "llvm/CodeGen/ScheduleDAG.h"
>  #include "llvm/Constants.h"
>  #include "llvm/CallingConv.h"
>  #include "llvm/DerivedTypes.h"
> @@ -33,6 +33,7 @@
>  #include "llvm/CodeGen/MachineJumpTableInfo.h"
>  #include "llvm/CodeGen/MachineModuleInfo.h"
>  #include "llvm/CodeGen/MachineRegisterInfo.h"
> +#include "llvm/CodeGen/ScheduleDAG.h"
>  #include "llvm/CodeGen/SchedulerRegistry.h"
>  #include "llvm/CodeGen/SelectionDAG.h"
>  #include "llvm/Target/TargetRegisterInfo.h"
> @@ -5441,11 +5442,14 @@
>    // each basic block.
>    NodeAllocatorType NodeAllocator;
>  
> +  SimpleBBISel SISel(MF, TLI);
>    std::vector<std::pair<MachineInstr*, unsigned> > PHINodesToUpdate;
>    for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
>      BasicBlock *LLVMBB = &*I;
>      PHINodesToUpdate.clear();
> -    SelectBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator);
> +
> +    if (!FastISel || !SISel.SelectBasicBlock(LLVMBB,  FuncInfo.MBBMap[LLVMBB]))
> +      SelectBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator);
>      FinishBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator);
>    }
>  }
>
> Added: llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.cpp?rev=54522&view=auto
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.cpp (added)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.cpp Fri Aug  8 02:27:28 2008
> @@ -0,0 +1,29 @@
> +//===-- SimpleBBISel.cpp - Implement the SimpleBBISel class ---------------===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===----------------------------------------------------------------------===//
> +//
> +// This implements simple basic block instruction selection. If the given
> +// BasicBlock is considered "simple", i.e. all operations are supported by
> +// the target and their types are legal, it does instruction directly from
> +// LLVM BasicBlock to MachineInstr's.
> +//
> +//===----------------------------------------------------------------------===//
> +
> +#define DEBUG_TYPE "simple-isel"
> +#include "SimpleBBISel.h"
> +#include "llvm/CodeGen/MachineFunction.h"
> +#include "llvm/CodeGen/MachineInstrBuilder.h"
> +#include "llvm/CodeGen/SelectionDAG.h"
> +using namespace llvm;
> +
> +/// SelectBasicBlock - Try to convert a LLVM basic block into a
> +/// MachineBasicBlock using simple instruction selection. Returns false if it
> +/// is not able to do so.
> +bool SimpleBBISel::SelectBasicBlock(BasicBlock *BB, MachineBasicBlock *MBB) {
> +  return false;
> +}
>
> Added: llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.h?rev=54522&view=auto
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.h (added)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SimpleBBISel.h Fri Aug  8 02:27:28 2008
> @@ -0,0 +1,45 @@
> +//===-- SimpleBBISel.cpp - Definition of the SimpleBBISel class -----------===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===----------------------------------------------------------------------===//
> +//
> +// This file defines the SimpleBBISel class which handles simple basic block
> +// instruction selection. If the given BasicBlock is considered "simple", i.e.
> +// all operations are supported by the target and their types are legal, it
> +// does instruction directly from LLVM BasicBlock to MachineInstr's.
> +//
> +//===----------------------------------------------------------------------===//
> +
> +#ifndef SELECTIONDAG_SIMPLEBBISEL_H
> +#define SELECTIONDAG_SIMPLEBBISEL_H
> +
> +#include "llvm/Support/Compiler.h"
> +
> +namespace llvm {
> +
> +class BasicBlock;
> +class MachineBasicBlock;
> +class MachineFunction;
> +class TargetLowering;
> +
> +class VISIBILITY_HIDDEN SimpleBBISel {
> +  MachineFunction &MF;
> +  TargetLowering &TLI;
> +  
> + public:
> +  explicit SimpleBBISel(MachineFunction &mf, TargetLowering &tli)
> +    : MF(mf), TLI(tli) {};
> +
> +  /// SelectBasicBlock - Try to convert a LLVM basic block into a
> +  /// MachineBasicBlock using simple instruction selection. Returns false if it
> +  /// is not able to do so.
> +  bool SelectBasicBlock(BasicBlock *BB, MachineBasicBlock *MBB);
> +};
> +  
> +} // end namespace llvm.
> +
> +#endif
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>   




More information about the llvm-commits mailing list