commit 310899470ebde9fcba69649ddad51563fc337875
parent 1506cd5619672fd7d470b9dc6d3a6895731da628
Author: Alexander Burger <abu@software-lab.de>
Date: Fri, 25 Feb 2011 16:04:03 +0100
More flexible code and data alignments
Diffstat:
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src64/arch/x86-64.l b/src64/arch/x86-64.l
@@ -1,4 +1,4 @@
-# 21feb11abu
+# 25feb11abu
# (c) Software Lab. Alexander Burger
# Byte order
@@ -199,6 +199,14 @@
(asm nop ()
(prinst "nop") )
+(asm align (N)
+ (prinst ".balign" N) )
+
+(asm skip (N)
+ (if (== 'data *Section)
+ (or (=0 N) (prinst ".space" N))
+ (do N (prinst "nop")) ) )
+
# Move data
(asm ld (Dst D Src S)
(setq Dst (dst Dst D) Src (src Src S))
diff --git a/src64/lib/asm.l b/src64/lib/asm.l
@@ -1,4 +1,4 @@
-# 05aug10abu
+# 25feb11abu
# (c) Software Lab. Alexander Burger
# *LittleEndian *Registers optimize
@@ -70,9 +70,8 @@
(setq *Section '@Sym) )
(prinl)
(when Align
- (prinl " .balign 16")
- (do Align
- ((get 'nop 'asm)) ) )
+ ((get 'align 'asm) 16)
+ ((get 'skip 'asm) Align) )
(when (reg Lbl)
(quit "Register" Lbl) )
(when Lbl
@@ -106,7 +105,13 @@
(prinl (cdr *Statement) ':)
(apply (get (car *Statement) 'asm) (cdr *Statement)) ) ) ) ) )
+# (data 'lbl)
+# (data 'lbl 0)
(section 'data 'data)
+
+# (code 'lbl)
+# (code 'lbl 0)
+# (code 'lbl 2)
(section 'code 'text)
(de cleanUp ()
@@ -489,9 +494,6 @@
(asm :: (Lbl)
(label Lbl) )
-(asm align (N)
- (prinst ".balign" N) )
-
(asm word (N)
(prinst ".quad" N) )
@@ -510,9 +512,6 @@
(asm asciz (Str)
(prinst ".asciz " (pack "\"" Str "\"")) )
-(asm skip (N)
- (prinst ".space" N) )
-
(asm initSym (Lbl Name Val)
(idx '*Tags (def Name Val) T)
(setq Name