fix some qbe stuff

This commit is contained in:
Robin 2025-01-31 22:09:55 +01:00
parent 5905a198b3
commit f98d0b8d18
4 changed files with 9 additions and 4 deletions

View File

@ -102,6 +102,10 @@ func emitInstruction(w io.Writer, i ttir.Instruction) error {
inst = "mul"
case ast.Divide:
inst = "div"
case ast.Equal:
inst = "ceql"
case ast.NotEqual:
inst = "cnel"
case ast.GreaterThan:
inst = "csgtl"
case ast.GreaterThanEqual:

View File

@ -3,6 +3,8 @@
; https://en.wikipedia.org/wiki/X86_calling_conventions#List_of_x86_calling_conventions
format ELF64
section ".text" executable
public syscall1
public syscall2
public syscall3

View File

@ -34,8 +34,8 @@ type processTask struct {
func NewProcessTask(name string, args ...string) task {
return &processTask{
taskName: name,
name: name,
taskName: fmt.Sprintf("starting %q %v\n", name, args),
args: args,
}
}
@ -49,7 +49,6 @@ func (pt *processTask) Run(id int, output io.Writer, doneChan chan taskResult) {
cmd.Stdout = utils.NewPrefixWriterString(output, pt.name+" output: ")
cmd.Stderr = cmd.Stdout
io.WriteString(output, fmt.Sprintf("starting %q %v\n", pt.name, pt.args))
err := cmd.Run()
var exitError error
if cmd.ProcessState.ExitCode() != 0 {
@ -330,7 +329,7 @@ func runTasks(nodes map[int]*node, rootNodes []int, l *utils.Logger) error {
for id, node := range nodes {
if output[id] == nil {
l.Errorf("output of task %q is nil", nodes[id].task.Name())
l.Warnf("output of task %q is nil", nodes[id].task.Name())
} else if output[id].Len() > 0 {
l.Infof("task %q output: %s", node.task.Name(), output[id])
}

View File

@ -1,3 +1,3 @@
fn main() = {
3
5 == 3
};