[llvm-commits] Add operand iterator for machine instruction.

Chris Lattner clattner at apple.com
Fri Oct 29 08:54:15 PDT 2010


On Oct 29, 2010, at 7:21 AM, ether zhhb wrote:

>> From 64aed599d3d9e59756d874e1693f884a4f6e5a02 Mon Sep 17 00:00:00 2001
> From: ether <etherzhhb at gmail.com>
> Date: Fri, 29 Oct 2010 22:18:01 +0800
> Subject: [PATCH] Add operand iterator to machine instruction.
> 
> hi all,
> 
> This patch add the operand iterator to machine instruction.

Hi Ether,

This patch doesn't build.

-Chris

> 
> best regards
> ether
> 
> ---
> include/llvm/CodeGen/MachineInstr.h |   12 +++++++++++-
> 1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/include/llvm/CodeGen/MachineInstr.h
> b/include/llvm/CodeGen/MachineInstr.h
> index fc84f8c..ea5f2cb 100644
> --- a/include/llvm/CodeGen/MachineInstr.h
> +++ b/include/llvm/CodeGen/MachineInstr.h
> @@ -167,7 +167,17 @@ public:
>   /// getNumExplicitOperands - Returns the number of non-implicit operands.
>   ///
>   unsigned getNumExplicitOperands() const;
> -
> +
> +  /// iterator/begin/end - Iterate over all operands of a machine instruction.
> +  typedef std::vector<MachineOperand>::iterator mop_iterator;
> +  typedef std::vector<MachineOperand>::const_iterator const_mop_iterator;
> +
> +  mop_iterator operands_begin() { return Operands.begin(); }
> +  mop_iterator operands_end() { return Operands.end(); }
> +
> +  const_mop_iterator operands_begin() { return Operands.begin(); }
> +  const_mop_iterator operands_end() { return Operands.end(); }
> +
>   /// Access to memory operands of the instruction
>   mmo_iterator memoperands_begin() const { return MemRefs; }
>   mmo_iterator memoperands_end() const { return MemRefsEnd; }
> -- 
> 1.7.1
> <0001-Add-operand-iterator-to-machine-instruction.patch>_______________________________________________
> 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