Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
miura1729
committed
Sep 10, 2009
1 parent
14f19db
commit fbae697
Showing
6 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
m = LLVM::Module.new('hello') | ||
LLVM::ExecutionEngine.get(m) | ||
p_char = LLVM::pointer(Type::Int8Ty) | ||
ftype = LLVM::function(Type::Int32Ty, [p_char]) | ||
p_char = Type.pointer(Type::Int8Ty) | ||
#ftype = LLVM::function(Type::Int32Ty, [p_char]) | ||
ftype = Type.function(Type::Int32Ty, [p_char]) | ||
ftype = ftype.to_raw | ||
printf = m.external_function('printf', ftype) | ||
ftype = LLVM::function(Type::Int32Ty, []) | ||
#ftype = LLVM::function(Type::Int32Ty, []) | ||
ftype = Type.function(Type::Int32Ty, []) | ||
ftype = ftype.to_raw | ||
main = m.get_or_insert_function('main', ftype) | ||
b = main.create_block.builder | ||
strptr = b.create_global_string_ptr("Hello World! \n") | ||
b.call(printf, strptr) | ||
b.return(strptr) | ||
b.return(LLVM::Value.get_constant(Type::Int32Ty, 0)) | ||
LLVM::ExecutionEngine.run_function(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters