Author Topic: C--  (Read 3129 times)

0 Members and 1 Guest are viewing this topic.

JRS

  • Guest
C--
« on: January 05, 2013, 09:29:31 PM »
This looks interesting and might be worth having a peek.

C-- Project Site

Quote
Suppose you are writing a compiler; how will you get quality machine code? You might write your own code generator---but that's a lot of work. You might use somebody else's: perhaps VPO, MLRISC, or the gcc back end. But each of these impressive systems has a rich, complex, and ill-documented interface, and furthermore, to use MLRISC you must write your front end in ML, to use gcc you must write it in C, and so on. You might generate C, if you can live without multiple results in registers, proper tail calls, computed gotos, accurate garbage collection, and efficient exceptions.

You would be much happier with one portable assembly language that could be generated by a front end and implemented by any of several code generators. Such a language should serve as the interface between high-level compilers and retargetable, optimizing code generators. Authors of front ends and authors of code generators could cooperate easily. C-- is that language.

Charles Pegge

  • Guest
Re: C--
« Reply #1 on: January 06, 2013, 08:39:47 AM »
Hmm. This project seems to have come to a halt in 2008, but I like the general concept of a C--.

My intermediate code is more on the assembler side, and I am currently working on 'dead code removal' in this layer. It is proving to be quite tricky to do efficiently, though very important when working with large code libraries.

Charles

JRS

  • Guest
Re: C--
« Reply #2 on: January 06, 2013, 09:09:26 AM »
It was just a heads up and another resource you might find some useful code from.

BTW, It looks like someone ported Jose's editor/IDE to FreeBASIC. That's much closer to home and may be worth including in the O2 distribution as an alternative IDE.

Charles Pegge

  • Guest
Re: C--
« Reply #3 on: January 06, 2013, 11:27:03 AM »
My plate is full at the moment. I wonder whether it can be configured to work with Oxygen in its present form. Any Volunteers?  :)

JRS

  • Guest
Re: C--
« Reply #4 on: January 06, 2013, 12:26:26 PM »
Sounds like something Aurel would be good at.


Emil_halim

  • Guest
Re: C--
« Reply #5 on: March 14, 2013, 08:20:49 AM »
Hi all

what about Sphinx C-- http://www.goosee.com/cmm/ or http://c--sphinx.narod.ru/indexe.htm

i really liked it very much , but it is very old and has no development.

here was my first approach
Code: [Select]
/***************************************
*             Sphinx C--               *   
*                                      *
*    TimerTest demo  By Emil Halim     *
*           26 / 9 / 2011              *
***************************************/
#speed
?useMMX 
#pragma option w32         //create Windows GUI EXE.
#pragma option OBJ         //create OBJ file
#pragma option OS          //speed optimization 
#pragma option J0          //no startup code.

#include <Windows.h> 

#pragma option ia          // allow inline asm
#pragma option LST

extern cdecl _printf();   
#define printf  _printf

int strlen1(char* pStr)
{
    EAX=0;
    while(byte *pStr !=0 )
     {
        pStr++;
        EAX++;
     }


// *** SSE2 version  from MASM forum***
int  fastcall strlen4(EAX) 
{     
    EBX = EAX ;                 // get the string pointer
       LEA ECX, DSDWORD[EAX+16]        // save pointer to string, on par with eax after first loop
 EAX &= 0xFFFFFFF0;          // align for use with SSE2
@shiftOK:     
    XORPS XMM0, XMM0                // zero xmm0 for finding zero bytes
@a1: 
    PCMPEQB XMM0, DSQWORD[EAX]      // ---- inner loop -----
    PMOVMSKB EDX, XMM0              // set byte mask in edx
     EAX += 16;                      // len counter (best position here)
 TEST EDX,EDX
        JE a1
       if(ECX<=EAX) goto a2;
    ECX -= EAX;                 // get difference, and cancel "misalign flag"
 SHR EDX, CL                 // shift invalid
        SHL EDX, CL                     // bits out
 JE shiftOK
@a2:   
    BSF EDX, EDX                // bit scan for the index
       SUB EAX, EBX                    // subtract original src pointer
    LEA EAX, DSDWORD[EAX+EDX-16]    // add scan index
}

char* testStr = "SPHINX C-- is so easy (an intermediate position between Assembler and C)";

qword  EAX_EDX_;

main()
int i;
{
_start: 

  SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS);           
  rdtsc
  EAX_EDX_ = EDX:EAX;
   
          strlen1( testStr );
             
  rdtsc
  EDX:EAX -= EAX_EDX_;
  i = EAX;
  SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
 
  printf("time is %i",  i );
  MessageBox(0,"","",0);   
}

here was the link in fasm http://board.flatassembler.net/topic.php?t=13432 

so  can we see C-- features ported to OxyGen Basic ? how knows !!!!

efgee

  • Guest
Re: C--
« Reply #6 on: March 14, 2013, 08:43:26 AM »
I Liked C-- a lot back in the days.

It's a bummer that the open source version is still from Peter Cellik, when Michael Sheker took it and transferred into the 32bit world and added more capabilities he never released the sources.

Another project gone south...

efgee

  • Guest
Re: C--
« Reply #7 on: March 14, 2013, 08:45:37 AM »
BTW: the two C-- projects mentioned in this thread are not compatible...