[OT] Control Flow Graph(CFG) into Abstract Syntax Tree(AST)

2012-09-14 Thread James Courtier-Dutton
Hi, I know most compilers go from AST to CFG. I am writing a decompiler, so I was wondering if anyone knew of any documents describing how best to get from CFG to AST. The decompiler project is open source. https://github.com/jcdutton/libbeauty The decompiler already contains a disassembler and

Re: [LLVMdev] updated code size comparison

2012-05-07 Thread James Courtier-Dutton
On 17 December 2009 21:53, Bill Wendling wendl...@apple.com wrote: On Dec 16, 2009, at 1:26 AM, Paolo Bonzini wrote: On 12/16/2009 03:21 AM, John Regehr wrote: Hopefully the results are more fair and useful now.  Again, feedback is appreciated. I would also avoid testcases using volatile.  

Re: Some confuse about the pass of the arguments by gcc

2012-02-22 Thread James Courtier-Dutton
On 22 February 2012 13:34, 嘉谟 yxy@gmail.com wrote: 2012/2/22 James Courtier-Dutton james.dut...@gmail.com: The order that function parameters are evaluated is undefined. Therefore it is wise to ensure that no matter what order they are evaluated, the result should be the same

Re: Some confuse about the pass of the arguments by gcc

2012-02-22 Thread James Courtier-Dutton
On 22 February 2012 19:05, James Courtier-Dutton james.dut...@gmail.com wrote: On 22 February 2012 13:34, 嘉谟 yxy@gmail.com wrote: 2012/2/22 James Courtier-Dutton james.dut...@gmail.com: The order that function parameters are evaluated is undefined. Therefore it is wise to ensure

Re: weird optimization in sin+cos, x86 backend

2012-02-18 Thread James Courtier-Dutton
On 13 February 2012 15:24, Vincent Lefevre vincent+...@vinc17.org wrote: On 2012-02-10 17:41:49 +, Andrew Haley wrote: On 02/10/2012 05:31 PM, Paweł Sikora wrote: it would be also nice to see functions for reducing argument range in public api. finally the end-user can use e.g.

Re: weird optimization in sin+cos, x86 backend

2012-02-10 Thread James Courtier-Dutton
On 10 February 2012 10:42, Andrew Haley a...@redhat.com wrote: On 02/10/2012 10:07 AM, Richard Guenther wrote: The issue with libm in glibc here is that Drepper absolutely does not want new ABIs in libm - he believes that for example vectorized routines do not belong there (nor the SSE

Re: weird optimization in sin+cos, x86 backend

2012-02-10 Thread James Courtier-Dutton
On 10 February 2012 14:05, Andrew Haley a...@redhat.com wrote: On 02/10/2012 01:30 PM, James Courtier-Dutton wrote: On 10 February 2012 10:42, Andrew Haley a...@redhat.com wrote: I think a starting point would be at least documenting correctly the accuracy of the current libm, because what

Re: weird optimization in sin+cos, x86 backend

2012-02-10 Thread James Courtier-Dutton
On 10 February 2012 14:36, Andrew Haley a...@redhat.com wrote: On 02/10/2012 02:24 PM, James Courtier-Dutton wrote: On 10 February 2012 14:05, Andrew Haley a...@redhat.com wrote: On 02/10/2012 01:30 PM, James Courtier-Dutton wrote: On 10 February 2012 10:42, Andrew Haley a...@redhat.com wrote

Re: weird optimization in sin+cos, x86 backend

2012-02-09 Thread James Courtier-Dutton
On 3 February 2012 21:48, Vincent Lefevre vincent+...@vinc17.org wrote: On 2012-02-03 17:44:21 +0100, Michael Matz wrote: Hi, On Fri, 3 Feb 2012, Vincent Lefevre wrote: For the glibc, I've finally reported a bug here:   http://sourceware.org/bugzilla/show_bug.cgi?id=13658

Re: weird optimization in sin+cos, x86 backend

2012-02-09 Thread James Courtier-Dutton
2012/2/9 Andrew Haley a...@redhat.com: On 02/09/2012 01:38 PM, Tim Prince wrote: x87 built-ins should be a fair compromise between speed, code size, and accuracy, for long double, on most CPUs.  As Richard says, it's certainly possible to do better in the context of SSE, but gcc doesn't know

Re: weird optimization in sin+cos, x86 backend

2012-02-09 Thread James Courtier-Dutton
On 9 February 2012 14:51, James Courtier-Dutton james.dut...@gmail.com wrote: 2012/2/9 Andrew Haley a...@redhat.com: On 02/09/2012 01:38 PM, Tim Prince wrote: x87 built-ins should be a fair compromise between speed, code size, and accuracy, for long double, on most CPUs.  As Richard says, it's

Re: weird optimization in sin+cos, x86 backend

2012-02-05 Thread James Courtier-Dutton
Hi, I looked at this a bit closer. sin(1.0e22) is outside the +-2^63 range, so FPREM1 is used to bring it inside the range. So, I looked at FPREM1 a bit closer. #include stdio.h #include math.h int main (void) { long double x, r, m; x = 1.0e22; // x = 5.26300791462049950360708478127784; -

Re: weird optimization in sin+cos, x86 backend

2012-02-04 Thread James Courtier-Dutton
On 4 February 2012 00:06, Vincent Lefevre vincent+...@vinc17.org wrote: On 2012-02-03 17:40:05 +0100, Dominique Dhumieres wrote: While I fail to see how the correct value of cos(4.47460300787e+182)+sin(4.47460300787e+182) can be defined in the 'double' world, cos^2(x)+sin^2(x)=1 and

Re: weird optimization in sin+cos, x86 backend

2012-02-03 Thread James Courtier-Dutton
On 3 February 2012 16:24, Vincent Lefevre vincent+...@vinc17.org wrote: On 2012-02-03 16:57:19 +0100, Michael Matz wrote: And it may be important that some identities (like cos^2+sin^2=1) be preserved. Well, you're not going to get this without much more work in sin/cos. If you use the

Re: weird optimization in sin+cos, x86 backend

2012-02-03 Thread James Courtier-Dutton
On 3 February 2012 18:12, Konstantin Vladimirov konstantin.vladimi...@gmail.com wrote: Hi, I agree, that this case have no practical value. It was autogenerated between other thousands of tests and showed really strange results, so I decided to ask. I thought, this value fits double precision

Re: Memory corruption due to word sharing

2012-02-02 Thread James Courtier-Dutton
On 1 February 2012 15:19, Jan Kara j...@suse.cz wrote:  Hello,  we've spotted the following mismatch between what kernel folks expect from a compiler and what GCC really does, resulting in memory corruption on some architectures. Consider the following structure: struct x {    long a;    

structure offset to structure name conversion.

2011-10-27 Thread James Courtier-Dutton
Hi, If I have a structure e.g. struct test_s { int32_t var1; int32_t var2; uint64_t var3; int var4; } test; If I have an offset value of 8, I wish to do a lookup and get to: test.var3 Is there some part of gcc that I could use to parse .h files and produce a table for me of

Re: Transforms on SSA form

2008-12-05 Thread James Courtier-Dutton
2008/12/4 Diego Novillo [EMAIL PROTECTED]: On Thu, Dec 4, 2008 at 11:20, John Freeman [EMAIL PROTECTED] wrote: There are documented methods of SSA decomposition. The naive method is a simple reversal of SSA composition: SSA composition: rename variables (typically by adding suffix), add phi

Transforms on SSA form

2008-12-03 Thread James Courtier-Dutton
Hi, I am looking to transform a tree in SSA form into a representation of it in C. Example C code: a = 1; if (condition) a = 2; b = a; In SSA (use $ for the Phi, Φ) a1 = 1; if (condition) a2 = 2; a3 = $(a1, a2); b1 = a3; My problem is how do I convert the a3 = $(a1, a2); back to normal C

Code representations

2008-04-28 Thread James Courtier-Dutton
I am trying to look at assembler code, and representing it as C code. For ia32, x86 platforms, assembler like the following ADD eax,ebx; JO integer_overflow_detected; How would I represent this in C? Kind Regards James

Re: Code representations

2008-04-28 Thread James Courtier-Dutton
2008/4/28 Kai Tietz [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote on 28.04.2008 13:11:39: I am trying to look at assembler code, and representing it as C code. For ia32, x86 platforms, assembler like the following ADD eax,ebx; JO integer_overflow_detected; How would I

Re: Security vulernarability or security feature?

2008-04-27 Thread James Courtier-Dutton
2008/4/25 Prateek Saxena [EMAIL PROTECTED]: On Thu, Apr 24, 2008 at 2:20 PM, Ralph Loader [EMAIL PROTECTED] wrote: I am very interested in seeing how this optimization can remove arithmetic overflows. int foo (char * buf, int n) { // buf+n may overflow of the

Re: Security vulernarability or security feature?

2008-04-27 Thread James Courtier-Dutton
2008/4/27 Robert Dewar [EMAIL PROTECTED]: Fortunately there is a assembler instruction to do just this on most CPUs. e.g. jo, jc, js It would be nice to be able to write this sort of C code. int a,b,c; a = b + c; if (a overflowed) { handle_overflow(); } Yes, but there is

Processor for header files.

2008-02-01 Thread James Courtier-Dutton
Hi, I am writing a decompiler for lib or .o files. For the application developer, one would have the lib or .o file and a .h file that would identify the api for the application developer to use to make use of the lib or .o file. For my decompiler, I therefore need to be able to process the .h