Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tybor/Liberty
Browse files Browse the repository at this point in the history
  • Loading branch information
cadrian committed May 1, 2010
2 parents 085031e + 26713fb commit 5413382
Show file tree
Hide file tree
Showing 121 changed files with 2,188 additions and 126 deletions.
2 changes: 2 additions & 0 deletions src/wrappers/common/library/wrapper_handler.e
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ feature {} -- Utility features

collection_to_c_array (a_collection: COLLECTION[WRAPPER]): FAST_ARRAY[POINTER] is
-- An array containing the pointers to the objects wrapped by `a_collection' wrappers.

-- TODO: avoid creating a new array whenever possible.
require
a_collection/=Void
not a_collection.is_empty
Expand Down
12 changes: 9 additions & 3 deletions src/wrappers/llvm/examples/plain/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
## A crude Makefile to compile Smart/Liberty Eiffel programs using LLVM , because it requires C++ linkage even if Eiffel is usually lowered/compiled to C.


example: example.s
@echo "Assembling to executable; 'as example.s -o example' produces a relocatable; currently llvm tools - even experimantal - do not provide an assembler that produces executables."
gcc -o example example.s
## "as example.s -o example" produces a relocatable; currently llvm tools - even experimantal - do not provide an assembler that produces executables.
@echo Running the generated executable.
./example

example.s: example.bc
@echo Compiling bytecode into assembly
llc example.bc

example.bc: llvm_example
@echo Running Liberty application, outputting bytecode
./llvm_example >example.bc

llvm_example: llvm_example.e
compile_to_c -debug -no-split -all-check llvm_example
gcc `llvm-config --cflags all` -c llvm_example.c
@echo "Building the Liberty application (the warning suppression flag '-w' is used because SmartEiffel or my low level code does not interact well with const)"
compile_to_c -no-split -all-check llvm_example
gcc -w `llvm-config --cflags all` -c llvm_example.c
g++ llvm_example.o -o llvm_example `llvm-config --libs --cflags --ldflags core bitwriter`

clean:
Expand Down
15 changes: 15 additions & 0 deletions src/wrappers/llvm/library/factories/llvm_function_factory.e
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,18 @@ feature {WRAPPER, WRAPPER_HANDLER}
create Result.from_external_pointer(a_pointer)
end
end -- class LLVM_FUNCTION_FACTORY
-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

15 changes: 15 additions & 0 deletions src/wrappers/llvm/library/factories/llvm_instruction_factory.e
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,18 @@ feature
end -- class LLVM_INSTRUCTION_FACTORY

-- Copyright 2009 Paolo Redaelli
-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

15 changes: 15 additions & 0 deletions src/wrappers/llvm/library/factories/llvm_type_factory.e
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,18 @@ feature {WRAPPER, WRAPPER_HANDLER}
end
end
end -- class LLVM_TYPE_FACTORY
-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

15 changes: 15 additions & 0 deletions src/wrappers/llvm/library/factories/llvm_value_wrapper_factory.e
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,18 @@ feature {WRAPPER, WRAPPER_HANDLER}
end -- class LLVM_VALUE_WRAPPER_FACTORY

-- Copyright 2009 Paolo Redaelli
-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

15 changes: 15 additions & 0 deletions src/wrappers/llvm/library/factories/llvm_values_factory.e
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ feature {ANY} -- Commodity features
ensure Result/=Void -- Result.type.is_equal(bool)
end
end -- class LLVM_VALUES_FACTORY
-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

31 changes: 23 additions & 8 deletions src/wrappers/llvm/library/iterators/iterator_over_basic_blocks.e
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ inherit
WRAPPER_FACTORY[LLVM_BASIC_BLOCK]
insert CORE_EXTERNALS

creation from_value
creation {LLVM_FUNCTION} from_function

feature {LLVM_VALUE}
from_value (a_value: LLVM_VALUE) is
require a_value/=Void
from_function (a_function: LLVM_VALUE) is
require a_function/=Void
do
value:=a_value
function:=a_function
end

feature {ANY}
value: LLVM_VALUE
function: LLVM_VALUE

start is
do
item := wrapper_or_void(llvmget_first_basic_block(value.handle))
item := wrapper_or_void(llvmget_first_basic_block(function.handle))
end

finish is
do
item := wrapper_or_void(llvmget_last_basic_block(value.handle))
item := wrapper_or_void(llvmget_last_basic_block(function.handle))
end

next is
Expand All @@ -52,7 +52,7 @@ feature
do
create Result.from_external_pointer(p)
end
invariant value/=Void
invariant function/=Void

end -- class ITERATOR_OVER_BASIC_BLOCKS

Expand All @@ -78,3 +78,18 @@ end -- class ITERATOR_OVER_BASIC_BLOCKS
-- THE SOFTWARE.


-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,18 @@ end -- class ITERATOR_OVER_FUNCTION_PARAMETERS
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

-- This file is part of a Liberty Eiffel library.
-- See the full copyright at the end.
--
class ITERATOR_OVER_GLOBAL_VARIABLES

inherit
BIDIRECTIONAL_ITERATOR[LLVM_GLOBAL_VARIABLE]
WRAPPER_FACTORY[LLVM_GLOBAL_VARIABLE]

insert CORE_EXTERNALS

creation {LLVM_MODULE} from_module

feature {LLVM_VALUE}
from_module (a_module: like module) is
require a_module/=Void
do
module:=a_module
end

feature {ANY}
module: LLVM_MODULE

start is
do
item := wrapper_or_void(llvmget_first_global(module.handle))
end

finish is
do
item := wrapper_or_void(llvmget_last_global(module.handle))
end

next is
do
item := wrapper_or_void(llvmget_next_global(item.handle))
end

previous is
do
item := wrapper_or_void(llvmget_previous_global(item.handle))
end

is_off: BOOLEAN is
do
Result:=(item=Void)
end

item: LLVM_GLOBAL_VARIABLE is attribute end
feature
wrapper (p: POINTER): LLVM_GLOBAL_VARIABLE is
do
create Result.from_external_pointer(p)
end
invariant module/=Void

end -- class ITERATOR_OVER_GLOBAL_VARIABLES

--
-- Copyright (c) 2009 by all the people cited in the AUTHORS file.
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.


-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

19 changes: 18 additions & 1 deletion src/wrappers/llvm/library/iterators/iterator_over_instructions.e
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ creation from_block

feature {LLVM_BASIC_BLOCK}
from_block (a_block: LLVM_BASIC_BLOCK) is
require a_block/=Void
require
a_block/=Void
not a_block.is_deleted
do
block:=a_block
end
Expand Down Expand Up @@ -74,3 +76,18 @@ end -- class ITERATOR_OVER_INSTRUCTIONS
-- THE SOFTWARE.


-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,18 @@ end -- class ITERATOR_OVER_MODULE_FUNCTIONS
-- THE SOFTWARE.


-- This file is part of LLVM wrappers for Liberty Eiffel.
--
-- This library is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, version 3 of the License.
--
-- Liberty Eiffel is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
--

0 comments on commit 5413382

Please sign in to comment.