KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > baf > internal > BSwapInst


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 1999 Patrick Lam, Patrick Pominville and Raja Vallee-Rai
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /*
21  * Modified by the Sable Research Group and others 1997-1999.
22  * See the 'credits' file distributed with Soot for the complete list of
23  * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24  */

25
26
27
28
29
30
31
32
33 package soot.baf.internal;
34
35 import soot.*;
36 import soot.baf.*;
37 import soot.util.*;
38 import java.util.*;
39
40 public class BSwapInst extends AbstractInst implements SwapInst
41 {
42
43     protected Type mFromType, mToType;
44     
45
46     public BSwapInst(Type fromType, Type toType)
47     {
48
49         if(fromType instanceof LongType || fromType instanceof DoubleType)
50             throw new RuntimeException JavaDoc("fromType is LongType or DoubleType !");
51         if(toType instanceof LongType || toType instanceof DoubleType)
52             throw new RuntimeException JavaDoc("toType is LongType or DoubleType !");
53         
54         mFromType = Baf.getDescriptorTypeOf(fromType);
55         mToType = Baf.getDescriptorTypeOf(toType);
56     }
57
58     public Type getFromType()
59     {
60         return mFromType;
61     }
62     public void setFromType(Type fromType)
63     {
64         mFromType = fromType;
65     }
66     
67     public Type getToType()
68     {
69         return mToType;
70     }
71     
72     public void setToType(Type toType)
73     {
74         mToType = toType;
75     }
76
77
78
79     public int getInCount()
80     {
81         return 2;
82     }
83
84     public int getInMachineCount()
85     {
86         return 2;
87     }
88     
89     public int getOutCount()
90     {
91         return 2;
92     }
93
94     public int getOutMachineCount()
95     {
96         return 2;
97     }
98     
99     public void apply(Switch sw)
100     {
101         ((InstSwitch) sw).caseSwapInst(this);
102     }
103     
104     public String JavaDoc toString()
105     {
106         return "swap." + Baf.bafDescriptorOf(mFromType) + Baf.bafDescriptorOf(mToType);
107     }
108     
109     
110     public String JavaDoc getName() {return "swap";}
111  
112     
113
114 }
115
116
117
Popular Tags