llvm-2.9 PB Code Generator progress

Sujets variés concernant le développement en PureBasic
Avatar de l’utilisateur
flaith
Messages : 1487
Inscription : jeu. 07/avr./2005 1:06
Localisation : Rennes
Contact :

Re: llvm-2.9 PB Code Generator progress

Message par flaith »

@idle : Thank you so much for your huge work, i already check llvm and it has a lot of possibilities.
Will especially wait for your work to test it :D
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

Re: llvm-2.9 PB Code Generator progress

Message par blendman »

salut

Tout ceci m'a l'air très intéressant. Si j'ai bien compris, ce serait un compilateur qui permettrait de compiler du code PB vers des téléphones portables par exemple ?
Si c'est ça, ce serait effectivement très intéressant ;).

En tout cas, bravo et merci de faire l'effort de parler le français, qui n'est pas une langue facile, même pour nous :).

Hi

It's a very interesting project. If I have understand, it would be a compiler to compile some code (pb) for telephon portable, for example ?
Si it's that, it would be really great.

Anyway, congratulations and thank you for making the effort to speak French, a language which is not easy, even for us ;).
idle
Messages : 63
Inscription : ven. 30/juil./2010 2:31

Re: llvm-2.9 PB Code Generator progress

Message par idle »

@Flaith
I hope I can get it to a testing stage quickly as I fear my idle time may be over in another week.
and I'll have to join the horde of rats packed into metal box's. (go do some work in the city)

@blendman

oui c'est le plan final mais il vous faudra un Mac a developper pour l'iPhone
It's a long way from there though and it won't have any high level functions.
idle
Messages : 63
Inscription : ven. 30/juil./2010 2:31

Re: llvm-2.9 PB Code Generator progress

Message par idle »

compilation de PB IDE, cela m'aidera à éliminer les bogues

Code : Tout sélectionner


file: /tmp/PureBasic_TempFile1.pb

Declare.q fibPB2(n.i)

Procedure.q fibPB2(n.i)
  Protected a.q,b.q,c.q
  If n <= 2
    ProcedureReturn 1
  Else 
    a = 1
    b = 1
    While n > 2
      c = a + b
      b = a
      a = c
      n = n-1
    Wend
    ProcedureReturn c
 EndIf    
EndProcedure

Procedure.q main()
  ProcedureReturn fibPB2(20)
EndProcedure  

; IDE Options = PureBasic 4.51 (Linux - x86)
; CursorPosition = 12
; CursorColumn = 12
; Folding = -
; EnableXP

; ModuleID = 'test'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i686-pc-linux-gnu"

define i64 @fibPB2(i32 %n) {
Entry:
  %cond = icmp slt i32 %n, 3
  br i1 %cond, label %CmpTrue1, label %While1

CmpTrue1:                                         ; preds = %While1, %Entry
  %merge = phi i64 [ 1, %Entry ], [ %c.0, %While1 ]
  ret i64 %merge

While1:                                           ; preds = %Entry, %WhileBody1
  %c.0 = phi i64 [ %add, %WhileBody1 ], [ 0, %Entry ]
  %b.0 = phi i64 [ %a.0, %WhileBody1 ], [ 1, %Entry ]
  %a.0 = phi i64 [ %add, %WhileBody1 ], [ 1, %Entry ]
  %n1.0 = phi i32 [ %sub, %WhileBody1 ], [ %n, %Entry ]
  %cond4 = icmp sgt i32 %n1.0, 2
  br i1 %cond4, label %WhileBody1, label %CmpTrue1

WhileBody1:                                       ; preds = %While1
  %add = add i64 %a.0, %b.0
  %sub = add i32 %n1.0, -1
  br label %While1
}

define i64 @main() {
Entry:
  %fibPB2 = tail call i64 @fibPB2(i32 20)
  ret i64 %fibPB2
}

module succeeded
Run Function in JIT

Jit Result: 
6765
Répondre