1 /*
2 * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2008, 2009 Red Hat, Inc.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 class SharkTopLevelBlock;
27 class DeferredZeroCheck;
28
29 class SharkFunction : public SharkTargetInvariants {
30 friend class SharkStackWithNormalFrame;
31
32 public:
33 static llvm::Function* build(ciEnv* env,
34 SharkBuilder* builder,
35 ciTypeFlow* flow,
36 const char* name) {
37 SharkFunction function(env, builder, flow, name);
38 return function.function();
39 }
40
41 private:
42 SharkFunction(ciEnv* env,
43 SharkBuilder* builder,
44 ciTypeFlow* flow,
45 const char* name)
92 _block_insertion_point = block_insertion_point;
93 }
94 llvm::BasicBlock* block_insertion_point() const {
95 return _block_insertion_point;
96 }
97
98 public:
99 llvm::BasicBlock* CreateBlock(const char* name = "") const {
100 return llvm::BasicBlock::Create(
101 SharkContext::current(), name, function(), block_insertion_point());
102 }
103
104 // Deferred zero checks
105 public:
106 void add_deferred_zero_check(SharkTopLevelBlock* block,
107 SharkValue* value);
108
109 private:
110 void do_deferred_zero_checks();
111 };
|
1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2008, 2009 Red Hat, Inc.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_VM_SHARK_SHARKFUNCTION_HPP
27 #define SHARE_VM_SHARK_SHARKFUNCTION_HPP
28
29 #include "ci/ciEnv.hpp"
30 #include "ci/ciStreams.hpp"
31 #include "ci/ciTypeFlow.hpp"
32 #include "memory/allocation.hpp"
33 #include "shark/llvmHeaders.hpp"
34 #include "shark/llvmValue.hpp"
35 #include "shark/sharkBuilder.hpp"
36 #include "shark/sharkContext.hpp"
37 #include "shark/sharkInvariants.hpp"
38 #include "shark/sharkStack.hpp"
39
40 class SharkTopLevelBlock;
41 class DeferredZeroCheck;
42
43 class SharkFunction : public SharkTargetInvariants {
44 friend class SharkStackWithNormalFrame;
45
46 public:
47 static llvm::Function* build(ciEnv* env,
48 SharkBuilder* builder,
49 ciTypeFlow* flow,
50 const char* name) {
51 SharkFunction function(env, builder, flow, name);
52 return function.function();
53 }
54
55 private:
56 SharkFunction(ciEnv* env,
57 SharkBuilder* builder,
58 ciTypeFlow* flow,
59 const char* name)
106 _block_insertion_point = block_insertion_point;
107 }
108 llvm::BasicBlock* block_insertion_point() const {
109 return _block_insertion_point;
110 }
111
112 public:
113 llvm::BasicBlock* CreateBlock(const char* name = "") const {
114 return llvm::BasicBlock::Create(
115 SharkContext::current(), name, function(), block_insertion_point());
116 }
117
118 // Deferred zero checks
119 public:
120 void add_deferred_zero_check(SharkTopLevelBlock* block,
121 SharkValue* value);
122
123 private:
124 void do_deferred_zero_checks();
125 };
126
127 #endif // SHARE_VM_SHARK_SHARKFUNCTION_HPP
|