aboutsummaryrefslogtreecommitdiff
path: root/cljcc-compiler/src/cljcc
diff options
context:
space:
mode:
authorYour Name <agrawalshagun07@gmail.com>2025-07-26 00:25:27 +0530
committerYour Name <agrawalshagun07@gmail.com>2025-07-26 00:25:27 +0530
commita5105ccc4be5eb13fc87fd8554209ee03ccfc483 (patch)
tree2556b0657f292fdad33261915e0c1ee3c7fb97d9 /cljcc-compiler/src/cljcc
parent444fc88251b059ef6f86d0461754cdf5c38fdccd (diff)
Adding clojure-mcp setupmain
Diffstat (limited to 'cljcc-compiler/src/cljcc')
-rw-r--r--cljcc-compiler/src/cljcc/schema.clj30
-rw-r--r--cljcc-compiler/src/cljcc/token.clj3
2 files changed, 29 insertions, 4 deletions
diff --git a/cljcc-compiler/src/cljcc/schema.clj b/cljcc-compiler/src/cljcc/schema.clj
index bf216f9..99f1642 100644
--- a/cljcc-compiler/src/cljcc/schema.clj
+++ b/cljcc-compiler/src/cljcc/schema.clj
@@ -520,11 +520,13 @@
;;;; Assembly AST
-(def AssemblyType [:enum :longword :quadword])
+(def AssemblyType [:enum :longword :quadword :double])
(def CondCode [:enum :e :ne :g :ge :l :le :a :ae :b :be])
-(def Register [:enum :ax :dx :di :si :r8 :r9 :r10 :r11 :cx :cl :sp])
+(def Register [:enum :ax :dx :di :si :r8 :r9 :r10 :r11 :cx :cl :sp
+ :xmm0 :xmm1 :xmm2 :xmm3 :xmm4 :xmm5 :xmm6 :xmm7
+ :xmm8 :xmm9 :xmm10 :xmm11 :xmm12 :xmm13 :xmm14 :xmm15])
(def AssemblyImmOperand
[:map
@@ -653,6 +655,18 @@
[:src #'AssemblyOperand]
[:dst #'AssemblyOperand]])
+(def AssemblyCvttsd2siInstruction
+ [:map
+ [:op [:= :cvttsd2si]]
+ [:src #'AssemblyOperand]
+ [:dst #'AssemblyOperand]])
+
+(def AssemblyCvtsi2sdInstruction
+ [:map
+ [:op [:= :cvtsi2sd]]
+ [:src #'AssemblyOperand]
+ [:dst #'AssemblyOperand]])
+
(def AssemblyInstruction
[:multi {:dispatch :op}
[:mov #'AssemblyMovInstruction]
@@ -663,6 +677,8 @@
[:cmp #'AssemblyCmpInstruction]
[:idiv #'AssemblyIdivInstruction]
[:div #'AssemblyDivInstruction]
+ [:cvttsd2si #'AssemblyCvttsd2siInstruction]
+ [:cvtsi2sd #'AssemblyCvtsi2sdInstruction]
[:cdq #'AssemblyCdqInstruction]
[:jmp #'AssemblyJmpInstruction]
[:jmpcc #'AssemblyJmpCCInstruction]
@@ -672,6 +688,13 @@
[:call #'AssemblyCallInstruction]
[:ret #'AssemblyRetInstruction]])
+(def AssemblyStaticConstant
+ [:map
+ [:op [:= :static-constant]]
+ [:identifier string?]
+ [:alignment int?]
+ [:initial #'Initial]])
+
(def AssemblyStaticVariable
[:map
[:op [:= :static-variable]]
@@ -701,7 +724,8 @@
[:map
[:type [:= :obj-entry]]
[:assembly-type #'AssemblyType]
- [:static? boolean?]])
+ [:static? boolean?]
+ [:constant? {:optional true} boolean?]])
(def FunEntry
[:map
diff --git a/cljcc-compiler/src/cljcc/token.clj b/cljcc-compiler/src/cljcc/token.clj
index 213588c..f13386c 100644
--- a/cljcc-compiler/src/cljcc/token.clj
+++ b/cljcc-compiler/src/cljcc/token.clj
@@ -86,6 +86,7 @@
"Binary operands and their precedence."
{:multiply 100
:divide 100
+ :divide-double 100
:remainder 100
:plus 90
@@ -227,7 +228,7 @@
:literal literal}))
(def tacky-unary-ops
- #{:bit-not :negate :logical-not})
+ #{:bit-not :negate :logical-not :shr})
(def tacky-binary-ops
#{:add