Work on CPU, codegen skeleton, and thunk.

This commit is contained in:
Ben Vanik
2013-01-13 15:48:18 -08:00
parent 2f4bc598e5
commit 099e37490a
12 changed files with 557 additions and 46 deletions

View File

@@ -61,6 +61,7 @@ def discover_commands():
'pull': PullCommand(),
'gyp': GypCommand(),
'build': BuildCommand(),
'xethunk': XethunkCommand(),
'clean': CleanCommand(),
'nuke': NukeCommand(),
}
@@ -379,6 +380,33 @@ class BuildCommand(Command):
return 0
class XethunkCommand(Command):
"""'xethunk' command."""
def __init__(self, *args, **kwargs):
super(XethunkCommand, self).__init__(
name='xethunk',
help_short='Updates the xethunk.bc file.',
*args, **kwargs)
def execute(self, args, cwd):
print 'Building xethunk...'
print ''
path = 'src/cpu/xethunk/xethunk'
result = shell_call('clang -emit-llvm -O0 -c %s.c -o %s.bc' % (path, path),
throw_on_error=False)
if result != 0:
return result
shell_call('build/llvm/release/bin/llvm-dis %s.bc -o %s.ll' % (path, path))
shell_call('cat %s.ll' % (path))
print 'Success!'
return 0
class CleanCommand(Command):
"""'clean' command."""