Re: [llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-16 Thread Chris Lattner

On Nov 10, 2007, at 12:10 PM, Lauro Ramos Venancio wrote:


 Does it make sense to make this work?  It seems much better than
 having to hack arm.h for every subtarget that doesn't use @ as a
 comment character.


 I'm afraid I didn't understand your point. I think the problem is
 - Target can have inline asm extensions (not only comments - ARM
 target has two extensions: '%@' and '%r').
 So we need a way to define this extensions. To do this, I copied the
 idea used by the gcc codegen.

 arm.h code for gcc codegen:

 /* These are a couple of extensions to the formats accepted
by asm_fprintf:
  %@ prints out ASM_COMMENT_START
  %r prints out REGISTER_PREFIX reg_names[arg]  */
 #define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \
   case '@':   \
 fputs (ASM_COMMENT_START, FILE);  \
 break;\
   \
   case 'r':   \
 fputs (REGISTER_PREFIX, FILE);\
 fputs (reg_names [va_arg (ARGS, int)], FILE); \
 break;

Hi Lauro,

It seems like there is two options: when lowering from GCC asm to  
llvm asm, we can either change %@ (for example) into  
ASM_COMMENT_START.  Alternatively, we can lower it to ${:comment},  
which llvm asm already expands out to the right thing.  Does this  
make sense?  The important point here is that not all arm targets use  
@ for their comment character, and we don't want to break that.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-16 Thread Lauro Ramos Venancio

 It seems like there is two options: when lowering from GCC asm to
 llvm asm, we can either change %@ (for example) into
 ASM_COMMENT_START.  Alternatively, we can lower it to ${:comment},
 which llvm asm already expands out to the right thing.

Nowadays, LLVM doesn't expand this in inline asm. I tested this.

  Does this
 make sense?  The important point here is that not all arm targets use
 @ for their comment character, and we don't want to break that.


I will use ASM_COMMENT_START. Nowadays, LLVM doesn't support any ARM
target that doesn't use '@' as comment character. So, I think it
doesn't worth to implement  ${:comment} now.


Lauro
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-10 Thread Lauro Ramos Venancio

 Does it make sense to make this work?  It seems much better than
 having to hack arm.h for every subtarget that doesn't use @ as a
 comment character.


I'm afraid I didn't understand your point. I think the problem is
- Target can have inline asm extensions (not only comments - ARM
target has two extensions: '%@' and '%r').
So we need a way to define this extensions. To do this, I copied the
idea used by the gcc codegen.

arm.h code for gcc codegen:

/* These are a couple of extensions to the formats accepted
   by asm_fprintf:
 %@ prints out ASM_COMMENT_START
 %r prints out REGISTER_PREFIX reg_names[arg]  */
#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P)   \
  case '@': \
fputs (ASM_COMMENT_START, FILE);\
break;  \
\
  case 'r': \
fputs (REGISTER_PREFIX, FILE);  \
fputs (reg_names [va_arg (ARGS, int)], FILE);   \
break;


Lauro
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-08 Thread Lauro Ramos Venancio
2007/11/8, Chris Lattner [EMAIL PROTECTED]:
 On Nov 8, 2007, at 2:10 PM, Lauro Ramos Venancio wrote:
  Author: laurov
  Date: Thu Nov  8 16:10:12 2007
  New Revision: 43909
 
  URL: http://llvm.org/viewvc/llvm-project?rev=43909view=rev
  Log:
  Implement the '%@' inline asm ARM extension.

 Hey Lauro,

 in .td files, you can use ${:comment} to print the comment
 character, does this work in inline asm?

I don't think so.

Error message:
Bad $ operand number in inline asm string: '${:comment test}

Lauro
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-08 Thread Chris Lattner
On Nov 8, 2007, at 2:10 PM, Lauro Ramos Venancio wrote:
 Author: laurov
 Date: Thu Nov  8 16:10:12 2007
 New Revision: 43909

 URL: http://llvm.org/viewvc/llvm-project?rev=43909view=rev
 Log:
 Implement the '%@' inline asm ARM extension.

Hey Lauro,

in .td files, you can use ${:comment} to print the comment  
character, does this work in inline asm?  If so, that might be a  
better thing to transform into.  See AsmPrinter::PrintSpecial for the  
code that does this,

-Chris


 Modified:
 llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
 llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

 Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ 
 config/arm/arm.h?rev=43909r1=43908r2=43909view=diff

 == 
 
 --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
 +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Thu Nov  8 16:10:12 2007
 @@ -2651,6 +2651,15 @@

  /* Doing struct copy by partial-word loads and stores is not a  
 good idea on ARM. */
  #define TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY 4
 +
 +/* These are a couple of extensions to the asm formats
 + %@ prints out ASM_COMMENT_START
 + TODO: %r prints out REGISTER_PREFIX reg_names[arg]  */
 +#define LLVM_ASM_EXTENSIONS(ESCAPED_CHAR, ASM, RESULT)   \
 +  else if ((ESCAPED_CHAR) == '@') {  \
 +(RESULT) += '@';\
 +  }
 +
  /* LLVM LOCAL end */

  #endif /* ! GCC_ARM_H */

 Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ 
 llvm-convert.cpp?rev=43909r1=43908r2=43909view=diff

 == 
 
 --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
 +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Nov  8 16:10:12 2007
 @@ -3375,7 +3375,11 @@
  Result += '%';
} else if (EscapedChar == '=') { // Unique ID for the  
 asm instance.
  Result += utostr(InlineAsmNum);
 -  } else if (ISALPHA(EscapedChar)) {
 +  }
 +#ifdef LLVM_ASM_EXTENSIONS
 +  LLVM_ASM_EXTENSIONS(EscapedChar, InStr, Result)
 +#endif
 +  else if (ISALPHA(EscapedChar)) {
  // % followed by a letter and some digits. This outputs an  
 operand in a
  // special way depending on the letter.  We turn this into  
 LLVM ${N:o}
  // syntax.


 ___
 llvm-commits mailing list
 llvm-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-08 Thread Lauro Ramos Venancio
Author: laurov
Date: Thu Nov  8 16:10:12 2007
New Revision: 43909

URL: http://llvm.org/viewvc/llvm-project?rev=43909view=rev
Log:
Implement the '%@' inline asm ARM extension.


Modified:
llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=43909r1=43908r2=43909view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Thu Nov  8 16:10:12 2007
@@ -2651,6 +2651,15 @@
 
 /* Doing struct copy by partial-word loads and stores is not a good idea on 
ARM. */
 #define TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY 4
+
+/* These are a couple of extensions to the asm formats
+ %@ prints out ASM_COMMENT_START
+ TODO: %r prints out REGISTER_PREFIX reg_names[arg]  */
+#define LLVM_ASM_EXTENSIONS(ESCAPED_CHAR, ASM, RESULT) \
+  else if ((ESCAPED_CHAR) == '@') {\
+(RESULT) += '@';\
+  }
+
 /* LLVM LOCAL end */
 
 #endif /* ! GCC_ARM_H */

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43909r1=43908r2=43909view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Nov  8 16:10:12 2007
@@ -3375,7 +3375,11 @@
 Result += '%';
   } else if (EscapedChar == '=') { // Unique ID for the asm instance.
 Result += utostr(InlineAsmNum);
-  } else if (ISALPHA(EscapedChar)) {
+  }
+#ifdef LLVM_ASM_EXTENSIONS
+  LLVM_ASM_EXTENSIONS(EscapedChar, InStr, Result)
+#endif
+  else if (ISALPHA(EscapedChar)) {
 // % followed by a letter and some digits. This outputs an operand in a
 // special way depending on the letter.  We turn this into LLVM ${N:o}
 // syntax.


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r43909 - in /llvm-gcc-4.2/trunk/gcc: config/arm/arm.h llvm-convert.cpp

2007-11-08 Thread Chris Lattner

On Nov 8, 2007, at 2:58 PM, Lauro Ramos Venancio wrote:

 2007/11/8, Chris Lattner [EMAIL PROTECTED]:
 On Nov 8, 2007, at 2:10 PM, Lauro Ramos Venancio wrote:
 Author: laurov
 Date: Thu Nov  8 16:10:12 2007
 New Revision: 43909

 URL: http://llvm.org/viewvc/llvm-project?rev=43909view=rev
 Log:
 Implement the '%@' inline asm ARM extension.

 Hey Lauro,

 in .td files, you can use ${:comment} to print the comment
 character, does this work in inline asm?

 I don't think so.

 Error message:
 Bad $ operand number in inline asm string: '${:comment test}

Does it make sense to make this work?  It seems much better than  
having to hack arm.h for every subtarget that doesn't use @ as a  
comment character.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits