1 cananian 1.1.4.1 // ALIGN.java, created Tue Oct 19 13:52:16 1999 by cananian
 2 cananian 1.1.4.1 // Copyright (C) 1999 C. Scott Ananian <cananian@alumni.princeton.edu>
 3 cananian 1.1.4.1 // Licensed under the terms of the GNU GPL; see COPYING for details.
 4 cananian 1.1.4.1 package harpoon.IR.Tree;
 5 cananian 1.1.4.1 
 6 cananian 1.1.4.1 import harpoon.ClassFile.HCodeElement;
 7 cananian 1.1.4.8 import harpoon.Temp.TempMap;
 8 cananian 1.1.4.1 import harpoon.Util.Util;
 9 cananian 1.1.4.1 
10 cananian 1.1.4.1 import java.util.Collections;
11 cananian 1.1.4.1 import java.util.Set;
12 cananian 1.1.4.1 /**
13 cananian 1.1.4.1  * <code>ALIGN</code> statements are used to enforce a given alignment on
14 cananian 1.1.4.1  * the following data items.  Its effect on code is undefined.  The next
15 cananian 1.1.4.4  * <code>DATUM</code> element (and any <code>LABEL</code> between the
16 cananian 1.1.4.4  * <code>ALIGN</code> and the <code>DATUM</code>) will be aligned on the
17 cananian 1.1.4.1  * specified n-byte boundary.
18 cananian 1.1.4.1  * 
19 cananian 1.1.4.1  * @author  C. Scott Ananian <cananian@alumni.princeton.edu>
20 cananian 1.4      * @version $Id: ALIGN.java,v 1.4 2002/04/10 03:05:36 cananian Exp $
21 cananian 1.1.4.1  */
22 cananian 1.1.4.1 public class ALIGN extends Stm implements harpoon.ClassFile.HDataElement {
23 cananian 1.1.4.1     /** The alignment to enforce, in bytes. Zero or one specify no
24 cananian 1.1.4.1      *  particular alignment. */
25 cananian 1.1.4.1     public final int alignment;
26 cananian 1.1.4.1 
27 cananian 1.1.4.1     /** Creates a <code>ALIGN</code>. */
28 cananian 1.1.4.1     public ALIGN(TreeFactory tf, HCodeElement source, int alignment) {
29 cananian 1.1.4.7         super(tf, source, 0);
30 cananian 1.1.4.1         this.alignment = alignment;
31 cananian 1.3.2.1         assert alignment >=0;
32 pnkfelix 1.1.4.5         
33 pnkfelix 1.1.4.6         // FSK: debugging hack
34 pnkfelix 1.1.4.6         // this.accept(TreeVerifyingVisitor.norepeats());
35 cananian 1.1.4.1     }
36 cananian 1.1.4.1 
37 cananian 1.1.4.1     public int     kind() { return TreeKind.ALIGN; }
38 cananian 1.1.4.1 
39 cananian 1.1.4.1     public Stm build(TreeFactory tf, ExpList kids) {
40 cananian 1.3.2.1         assert kids==null;
41 cananian 1.1.4.1         return new ALIGN(tf, this, alignment);
42 cananian 1.1.4.1     }
43 cananian 1.1.4.1 
44 cananian 1.1.4.1     /** Accept a visitor. */
45 cananian 1.1.4.1     public void accept(TreeVisitor v) { v.visit(this); }
46 cananian 1.1.4.1 
47 cananian 1.1.4.8     public Tree rename(TreeFactory tf, TempMap tm, CloneCallback cb) {
48 cananian 1.1.4.9         return cb.callback(this, new ALIGN(tf, this, alignment), tm);
49 cananian 1.1.4.1     }
50 cananian 1.1.4.1 
51 cananian 1.1.4.1     public String toString() {
52 cananian 1.1.4.1         return "ALIGN<"+alignment+">";
53 cananian 1.1.4.1     }
54 cananian 1.2     }