<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [PowerPC] PPCAsmParser request: support darwin asm syntax in PPCAsmParser"
href="http://llvm.org/bugs/show_bug.cgi?id=16701">16701</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[PowerPC] PPCAsmParser request: support darwin asm syntax in PPCAsmParser
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>fang@csl.cornell.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>hfinkel@anl.gov, llvmbugs@cs.uiuc.edu, ulrich.weigand@de.ibm.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This is a feature request for supporting darwin asm syntax for PPC assembly.
The most noticeable difference is in the naming of register operands.
% cat hello-puts.c
extern int puts(const char*);
int
main(int argc, char* argv[]) {
puts("Hello, world!\n");
return 0;
}
% make hello-puts.s
~/local/src/LLVM-svn/gcc40-cmake-build/bin/clang -v -fno-common -DPIC
-femit-all-decls -c hello-puts.c -S -o hello-puts.s
clang version 3.4
Target: powerpc-apple-darwin8.11.0
Thread model: posix
"/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/bin/clang-3.4" -cc1 -triple
powerpc-apple-macosx10.4.0 -S -disable-free -main-file-name hello-puts.c
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -v
-coverage-file /Users/fang/temp/clang/hello-puts.s -resource-dir
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/bin/../lib/clang/3.4 -D PIC
-fdebug-compilation-dir /Users/fang/temp/clang -ferror-limit 19
-fmessage-length 80 -femit-all-decls -mstackrealign -fblocks
-fblocks-runtime-optional -fobjc-runtime=macosx-10.4.0
-fobjc-default-synthesize-properties -fencode-extended-block-signature
-fno-common -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -o
hello-puts.s -x c hello-puts.c
clang -cc1 version 3.4 based upon LLVM 3.4git-969f343 default target
powerpc-apple-darwin8.11.0
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/bin/../lib/clang/3.4/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
% cat hello-puts.s
.machine ppc7400
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
.section
__TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.section __TEXT,__text,regular,pure_instructions
.globl _main
.align 4
_main: ; @main
; BB#0: ; %entry
mflr r0
stw r31, -4(r1)
stw r0, 8(r1)
stwu r1, -96(r1)
mr r31, r1
bl L0$pb
L0$pb:
mflr r2
li r5, 0
stw r5, 88(r31)
stw r3, 84(r31)
addis r2, r2, ha16(L_.str-L0$pb)
stw r4, 80(r31)
la r2, lo16(L_.str-L0$pb)(r2)
stw r3, 76(r31) ; 4-byte Folded Spill
mr r3, r2
stw r4, 72(r31) ; 4-byte Folded Spill
stw r5, 68(r31) ; 4-byte Folded Spill
bl L_puts$stub
lwz r2, 72(r31) ; 4-byte Folded Reload
lwz r4, 76(r31) ; 4-byte Folded Reload
lwz r5, 68(r31) ; 4-byte Folded Reload
stw r3, 64(r31) ; 4-byte Folded Spill
mr r3, r5
stw r2, 60(r31) ; 4-byte Folded Spill
stw r4, 56(r31) ; 4-byte Folded Spill
addi r1, r1, 96
lwz r0, 8(r1)
lwz r31, -4(r1)
mtlr r0
blr
.section
__TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.align 4
L_puts$stub:
.indirect_symbol _puts
mflr r0
bcl 20, 31, L_puts$stub$tmp
L_puts$stub$tmp:
mflr r11
addis r11, r11, ha16(L_puts$lazy_ptr-L_puts$stub$tmp)
mtlr r0
lwzu r12, lo16(L_puts$lazy_ptr-L_puts$stub$tmp)(r11)
mtctr r12
bctr
.section __DATA,__la_symbol_ptr,lazy_symbol_pointers
L_puts$lazy_ptr:
.indirect_symbol _puts
.long dyld_stub_binding_helper
.subsections_via_symbols
.section __TEXT,__cstring,cstring_literals
L_.str: ; @.str
.asciz "Hello, world!\n"
and attempting to use llvm-mc:
% /Volumes/Isolde/builds/LLVM/gcc40-cmake-build/bin/llvm-mc
-triple=powerpc-apple-darwin8 hello-puts.s
.section __TEXT,__text,regular,pure_instructions
hello-puts.s:1:2: error: unrecognized machine type
.machine ppc7400
^
hello-puts.s:1:2: error: unknown directive
.machine ppc7400
^
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
.section
__TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
.section __TEXT,__text,regular,pure_instructions
.globl _main
.align 4
_main:
hello-puts.s:9:7: error: invalid operand for instruction
mflr r0
^
hello-puts.s:10:6: error: invalid operand for instruction
stw r31, -4(r1)
^
I've already taken a stab at accepting rX on memory operands with the following
patch:
<<PATCH>>
diff --git a/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
b/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
index 3c677cc..e49cf08 100644
--- a/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
+++ b/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
@@ -26,6 +26,8 @@
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
+#define ALLOW_DARWIN_ASM_SYNTAX 1
+
using namespace llvm;
namespace {
@@ -1158,7 +1160,14 @@ ParseOperand(SmallVectorImpl<MCParsedAsmOperand*>
&Operands) {
IntVal < 0 || IntVal > 31)
return Error(S, "invalid register number");
break;
-
+#if ALLOW_DARWIN_ASM_SYNTAX
+ case AsmToken::Identifier: // e.g. r31
+ unsigned RegNo2;
+ if (MatchRegisterName(Parser.getTok(), RegNo2, IntVal))
+ return Error(S, "invalid register name");
+ Parser.Lex(); // Eat the identifier token.
+ break;
+#endif
default:
return Error(S, "invalid memory operand");
}
<<END-PATCH>>
but I wouldn't know how to proceed from here.
How difficult would this project be?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>