diff modules/il.tp @ 361:06dceff348ea

llcompile now has Hacky support for calling C functions using dl to lookup symbols and almost has support string constants
author Michael Pavone <pavone@retrodev.com>
date Thu, 23 Apr 2015 19:24:20 -0700
parents 3b023e5a0b42
children d949fe826e04
line wrap: on
line diff
--- a/modules/il.tp	Tue Apr 21 09:00:56 2015 -0700
+++ b/modules/il.tp	Thu Apr 23 19:24:20 2015 -0700
@@ -24,6 +24,8 @@
 	_skipifelse <- 20
 	_save   <- 21
 	_bool   <- 22
+	_label  <- 23
+	_data   <- 24
 
 	_names <- #[
 		"add"
@@ -49,6 +51,8 @@
 		"skipIf:else"
 		"save"
 		"bool"
+		"label"
+		"data"
 	]
 
 	op3:a:b:out:size <- :_opcode :_ina :_inb :_out :_size {
@@ -204,6 +208,8 @@
 	_ule <- condition: 7
 	_ugr <- condition: 8
 	_uls <- condition: 9
+	
+	_curLabel <- 0
 
 	#{
 		b <- { byte }
@@ -555,6 +561,55 @@
 				}
 			}
 		}
+		
+		label <- {
+			_labelNum <- _curLabel
+			_curLabel <- _curLabel + 1
+			#{
+				opcode <- { _label }
+				numops <- { 0 }
+				name <- { _names get: opcode }
+				string <- { name . " " . _labelNum }
+				reference <- {
+					#{
+						isInteger? <- { false }
+						register? <- { false }
+						argument? <- { false }
+						return? <- { false }
+						label? <- { true }
+						num <- { _labelNum }
+						string <- { "label " . _labelNum}
+						
+						recordUsage:at:withSize <- :tracker :address :size {
+						}
+						assign:withSource <- :assignments :regSrc {
+							self
+						}
+					}
+				}
+				recordUsage:at <- :tracker :address {
+					
+				}
+				assignRegs:at:withSource:andUsage <- :assignments :at :regSrc :usage {
+					self
+				}
+			}
+		}
+		data <- :_bytes {
+			#{
+				opcode <- { _data }
+				numops <- { 0 }
+				name <- { _names get: opcode }
+				string <- { name . " " . _bytes }
+				bytes <- { _bytes }
+				recordUsage:at <- :tracker :address {
+					
+				}
+				assignRegs:at:withSource:andUsage <- :assignments :at :regSrc :usage {
+					self
+				}
+			}
+		}
 
 		allocRegs:withSource <- :instarr :regSrc {
 			_regMap <- dict linear