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

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 17 12:14:28 PDT 2004



Changes in directory llvm/include/llvm/CodeGen:

AsmPrinter.h updated: 1.6 -> 1.7
---
Log message:

Add support for alignment


---
Diffs of the changes:  (+21 -2)

Index: llvm/include/llvm/CodeGen/AsmPrinter.h
diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.6 llvm/include/llvm/CodeGen/AsmPrinter.h:1.7
--- llvm/include/llvm/CodeGen/AsmPrinter.h:1.6	Tue Aug 17 11:26:36 2004
+++ llvm/include/llvm/CodeGen/AsmPrinter.h	Tue Aug 17 14:14:17 2004
@@ -47,7 +47,7 @@
 
     /// CommentChar - This indicates the comment character used by the
     /// assembler.
-    const char *CommentChar;
+    const char *CommentChar;     // Defaults to "#"
 
     /// GlobalPrefix - If this is set to a non-empty string, it is prepended
     /// onto all global symbols.  This is often used for "_" or ".".
@@ -71,6 +71,17 @@
     const char *Data32bitsDirective;  // Defaults to "\t.long\t"
     const char *Data64bitsDirective;  // Defaults to "\t.quad\t"
 
+    /// AlignDirective - The directive used to emit round up to an alignment
+    /// boundary.
+    ///
+    const char *AlignDirective;       // Defaults to "\t.align\t"
+
+    /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
+    /// emits ".align N" directives, where N is the number of bytes to align to.
+    /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
+    /// boundary.
+    bool AlignmentIsInBytes;          // Defaults to true
+
     AsmPrinter(std::ostream &o, TargetMachine &tm)
       : O(o), TM(tm),
         CommentChar("#"),
@@ -80,7 +91,10 @@
         Data8bitsDirective("\t.byte\t"),
         Data16bitsDirective("\t.short\t"),
         Data32bitsDirective("\t.long\t"),
-        Data64bitsDirective("\t.quad\t") { }
+        Data64bitsDirective("\t.quad\t"),
+        AlignDirective("\t.align\t"),
+        AlignmentIsInBytes(true) {
+    }
 
     /// doInitialization - Set up the AsmPrinter when we are working on a new
     /// module.  If your pass overrides this, it must make sure to explicitly
@@ -95,6 +109,11 @@
     /// is being processed from runOnMachineFunction.
     void setupMachineFunction(MachineFunction &MF);
 
+    /// emitAlignment - Emit an alignment directive to the specified power of
+    /// two boundary.  For example, if you pass in 3 here, you will get an 8
+    /// byte alignment.
+    void emitAlignment(unsigned NumBits) const;
+
     /// emitConstantValueOnly - Print out the specified constant, without a
     /// storage class.  Only constants of first-class type are allowed here.
     void emitConstantValueOnly(const Constant *CV);






More information about the llvm-commits mailing list