[llvm-commits] CVS: llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Dec 18 07:07:01 PST 2003


Changes in directory llvm/include/llvm/CodeGen:

TwoAddressInstructionPass.h added (r1.1)

---
Log message:

Add TwoAddressInstructionPass to handle instructions that have two or
more operands and the two first operands are constrained to be the
same. The pass takes an instruction of the form:

        a = b op c

and transforms it into:

        a = b
        a = a op c

and also preserves live variables.


---
Diffs of the changes:  (+51 -0)

Index: llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h
diff -c /dev/null llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h:1.1
*** /dev/null	Thu Dec 18 07:06:14 2003
--- llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h	Thu Dec 18 07:06:04 2003
***************
*** 0 ****
--- 1,51 ----
+ //===-- llvm/CodeGen/TwoAddressInstructionPass.h - Two-Address instruction pass  -*- C++ -*-===//
+ //
+ //                     The LLVM Compiler Infrastructure
+ //
+ // This file was developed by the LLVM research group and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This file implements the Two-Address instruction rewriter pass. In
+ // some architectures instructions have a combined source/destination
+ // operand. In those cases the instruction cannot have three operands
+ // as the destination is implicit (for example ADD %EAX, %EBX on the
+ // IA-32). After code generation this restrictions are not handled and
+ // instructions may have three operands. This pass remedies this and
+ // reduces all two-address instructions to two operands.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #ifndef LLVM_CODEGEN_TWOADDRESSINSTRUCTIONPASS_H
+ #define LLVM_CODEGEN_TWOADDRESSINSTRUCTIONPASS_H
+ 
+ #include "llvm/CodeGen/MachineFunctionPass.h"
+ #include "llvm/CodeGen/MachineBasicBlock.h"
+ #include <iostream>
+ #include <map>
+ 
+ namespace llvm {
+ 
+     class LiveVariables;
+     class MRegisterInfo;
+ 
+     class TwoAddressInstructionPass : public MachineFunctionPass
+     {
+     private:
+         MachineFunction* mf_;
+         const TargetMachine* tm_;
+         const MRegisterInfo* mri_;
+         LiveVariables* lv_;
+ 
+     public:
+         virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+ 
+     private:
+         /// runOnMachineFunction - pass entry point
+         bool runOnMachineFunction(MachineFunction&);
+     };
+ 
+ } // End llvm namespace
+ 
+ #endif





More information about the llvm-commits mailing list