Exemple #1
0
 def Call(self, i):
     """Generate code to Call a function"""
     if isinstance(i.a.type, il.Func):
         code = [x.call(i.a.type.entry)]
     else:  # Otherwise it is a function pointer.
         code = [x.call(x.loc(i.a.type, deref=True))]
     return code
Exemple #2
0
 def Call(self, i):
     if isinstance(i.a.type, il.Func):
         code = [
             x.call(i.a.type.entry),
         ]
     else:
         code = [
             x.call(x.loc(i.a.type, True)),
         ]
     return code
Exemple #3
0
 def Print(self, i):
     code = self.emit(x.pushl, i.a)
     code += [
         x.pushl('$printf_msg'),
         x.call("printf"),
         x.addl(x.cint(8), x.esp),
     ]
     return code
Exemple #4
0
 def ExitCode(self):
     """Exits the program and returns to the OS. Currently implemented by
     calling into the libc exit function. In the past it directly generated
     the syscall."""
     return [x.push("$0"), x.call("exit")]
Exemple #5
0
 def ExitCode(self):
     return [
         x.push('$0'),
         x.call("exit"),
     ]