Zack Rusin | 02cf317 | 2007-10-24 12:48:06 -0400 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. |
| 4 | * All Rights Reserved. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the |
| 8 | * "Software"), to deal in the Software without restriction, including |
| 9 | * without limitation the rights to use, copy, modify, merge, publish, |
| 10 | * distribute, sub license, and/or sell copies of the Software, and to |
| 11 | * permit persons to whom the Software is furnished to do so, subject to |
| 12 | * the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice (including the |
| 15 | * next paragraph) shall be included in all copies or substantial portions |
| 16 | * of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR |
| 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | * |
| 26 | **************************************************************************/ |
| 27 | |
| 28 | /* |
| 29 | * Authors: |
| 30 | * Zack Rusin zack@tungstengraphics.com |
| 31 | */ |
Zack Rusin | a6a3d8c | 2007-10-29 10:01:29 -0400 | [diff] [blame] | 32 | #ifdef MESA_LLVM |
Zack Rusin | 02cf317 | 2007-10-24 12:48:06 -0400 | [diff] [blame] | 33 | |
Zack Rusin | 7ff0df6 | 2007-10-31 06:51:19 -0400 | [diff] [blame] | 34 | #include "gallivm.h" |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 35 | #include "gallivm_p.h" |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 36 | |
Zack Rusin | b0f8069 | 2007-10-17 11:28:26 -0400 | [diff] [blame] | 37 | #include "instructions.h" |
Zack Rusin | f625c6d | 2008-01-25 06:36:35 -0500 | [diff] [blame] | 38 | #include "loweringpass.h" |
Zack Rusin | b0f8069 | 2007-10-17 11:28:26 -0400 | [diff] [blame] | 39 | #include "storage.h" |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 40 | #include "tgsitollvm.h" |
Zack Rusin | b0f8069 | 2007-10-17 11:28:26 -0400 | [diff] [blame] | 41 | |
Zack Rusin | 5ffdada | 2007-10-15 09:59:19 -0400 | [diff] [blame] | 42 | #include "pipe/p_context.h" |
Zack Rusin | a0dacbf | 2007-12-11 09:44:41 -0500 | [diff] [blame] | 43 | #include "pipe/p_shader_tokens.h" |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 44 | |
José Fonseca | c208a2c | 2008-07-28 12:42:13 +0900 | [diff] [blame] | 45 | #include "tgsi/tgsi_exec.h" |
| 46 | #include "tgsi/tgsi_dump.h" |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 47 | |
| 48 | #include <llvm/Module.h> |
| 49 | #include <llvm/CallingConv.h> |
| 50 | #include <llvm/Constants.h> |
| 51 | #include <llvm/DerivedTypes.h> |
| 52 | #include <llvm/Instructions.h> |
| 53 | #include <llvm/ModuleProvider.h> |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 54 | #include <llvm/Pass.h> |
| 55 | #include <llvm/PassManager.h> |
Michel Dänzer | f586c31 | 2009-01-12 12:34:27 +0100 | [diff] [blame] | 56 | #include <llvm/Attributes.h> |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 57 | #include <llvm/Support/PatternMatch.h> |
| 58 | #include <llvm/ExecutionEngine/JIT.h> |
| 59 | #include <llvm/ExecutionEngine/Interpreter.h> |
| 60 | #include <llvm/ExecutionEngine/GenericValue.h> |
| 61 | #include <llvm/Support/MemoryBuffer.h> |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 62 | #include <llvm/LinkAllPasses.h> |
| 63 | #include <llvm/Analysis/Verifier.h> |
| 64 | #include <llvm/Analysis/LoopPass.h> |
| 65 | #include <llvm/Target/TargetData.h> |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 66 | #include <llvm/Bitcode/ReaderWriter.h> |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 67 | #include <llvm/Transforms/Utils/Cloning.h> |
Zack Rusin | ba88751 | 2007-10-22 08:46:28 -0400 | [diff] [blame] | 68 | |
| 69 | #include <sstream> |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 70 | #include <fstream> |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 71 | #include <iostream> |
| 72 | |
Zack Rusin | ba88751 | 2007-10-22 08:46:28 -0400 | [diff] [blame] | 73 | static int GLOBAL_ID = 0; |
| 74 | |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 75 | using namespace llvm; |
| 76 | |
| 77 | static inline |
| 78 | void AddStandardCompilePasses(PassManager &PM) |
| 79 | { |
Zack Rusin | f625c6d | 2008-01-25 06:36:35 -0500 | [diff] [blame] | 80 | PM.add(new LoweringPass()); |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 81 | PM.add(createVerifierPass()); // Verify that input is correct |
| 82 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 83 | PM.add(createLowerSetJmpPass()); // Lower llvm.setjmp/.longjmp |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 84 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 85 | //PM.add(createStripSymbolsPass(true)); |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 86 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 87 | PM.add(createRaiseAllocationsPass()); // call %malloc -> malloc inst |
| 88 | PM.add(createCFGSimplificationPass()); // Clean up disgusting code |
| 89 | PM.add(createPromoteMemoryToRegisterPass());// Kill useless allocas |
| 90 | PM.add(createGlobalOptimizerPass()); // Optimize out global vars |
| 91 | PM.add(createGlobalDCEPass()); // Remove unused fns and globs |
| 92 | PM.add(createIPConstantPropagationPass());// IP Constant Propagation |
| 93 | PM.add(createDeadArgEliminationPass()); // Dead argument elimination |
| 94 | PM.add(createInstructionCombiningPass()); // Clean up after IPCP & DAE |
| 95 | PM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 96 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 97 | PM.add(createPruneEHPass()); // Remove dead EH info |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 98 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 99 | PM.add(createFunctionInliningPass()); // Inline small functions |
| 100 | PM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 101 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 102 | PM.add(createTailDuplicationPass()); // Simplify cfg by copying code |
| 103 | PM.add(createInstructionCombiningPass()); // Cleanup for scalarrepl. |
| 104 | PM.add(createCFGSimplificationPass()); // Merge & remove BBs |
| 105 | PM.add(createScalarReplAggregatesPass()); // Break up aggregate allocas |
| 106 | PM.add(createInstructionCombiningPass()); // Combine silly seq's |
| 107 | PM.add(createCondPropagationPass()); // Propagate conditionals |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 108 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 109 | PM.add(createTailCallEliminationPass()); // Eliminate tail calls |
| 110 | PM.add(createCFGSimplificationPass()); // Merge & remove BBs |
| 111 | PM.add(createReassociatePass()); // Reassociate expressions |
| 112 | PM.add(createLoopRotatePass()); |
| 113 | PM.add(createLICMPass()); // Hoist loop invariants |
| 114 | PM.add(createLoopUnswitchPass()); // Unswitch loops. |
| 115 | PM.add(createLoopIndexSplitPass()); // Index split loops. |
| 116 | PM.add(createInstructionCombiningPass()); // Clean up after LICM/reassoc |
| 117 | PM.add(createIndVarSimplifyPass()); // Canonicalize indvars |
| 118 | PM.add(createLoopUnrollPass()); // Unroll small loops |
| 119 | PM.add(createInstructionCombiningPass()); // Clean up after the unroller |
| 120 | PM.add(createGVNPass()); // Remove redundancies |
| 121 | PM.add(createSCCPPass()); // Constant prop with SCCP |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 122 | |
| 123 | // Run instcombine after redundancy elimination to exploit opportunities |
| 124 | // opened up by them. |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 125 | PM.add(createInstructionCombiningPass()); |
| 126 | PM.add(createCondPropagationPass()); // Propagate conditionals |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 127 | |
Zack Rusin | 9d4b51a | 2007-10-24 11:41:28 -0400 | [diff] [blame] | 128 | PM.add(createDeadStoreEliminationPass()); // Delete dead stores |
| 129 | PM.add(createAggressiveDCEPass()); // SSA based 'Aggressive DCE' |
| 130 | PM.add(createCFGSimplificationPass()); // Merge & remove BBs |
| 131 | PM.add(createSimplifyLibCallsPass()); // Library Call Optimizations |
| 132 | PM.add(createDeadTypeEliminationPass()); // Eliminate dead types |
| 133 | PM.add(createConstantMergePass()); // Merge dup global constants |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 134 | } |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 135 | |
Zack Rusin | 02cf317 | 2007-10-24 12:48:06 -0400 | [diff] [blame] | 136 | void gallivm_prog_delete(struct gallivm_prog *prog) |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 137 | { |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 138 | delete prog->module; |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 139 | prog->module = 0; |
Zack Rusin | 9e6d58f | 2007-10-15 08:12:22 -0400 | [diff] [blame] | 140 | prog->function = 0; |
Zack Rusin | b2e5299 | 2007-10-08 10:24:35 -0400 | [diff] [blame] | 141 | free(prog); |
| 142 | } |
| 143 | |
Zack Rusin | 45003b0 | 2007-11-01 14:00:25 -0400 | [diff] [blame] | 144 | static inline void |
| 145 | constant_interpolation(float (*inputs)[16][4], |
| 146 | const struct tgsi_interp_coef *coefs, |
| 147 | unsigned attrib, |
| 148 | unsigned chan) |
| 149 | { |
| 150 | unsigned i; |
| 151 | |
| 152 | for (i = 0; i < QUAD_SIZE; ++i) { |
| 153 | inputs[i][attrib][chan] = coefs[attrib].a0[chan]; |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | static inline void |
| 158 | linear_interpolation(float (*inputs)[16][4], |
| 159 | const struct tgsi_interp_coef *coefs, |
| 160 | unsigned attrib, |
| 161 | unsigned chan) |
| 162 | { |
| 163 | unsigned i; |
| 164 | |
| 165 | for( i = 0; i < QUAD_SIZE; i++ ) { |
| 166 | const float x = inputs[i][0][0]; |
| 167 | const float y = inputs[i][0][1]; |
| 168 | |
| 169 | inputs[i][attrib][chan] = |
| 170 | coefs[attrib].a0[chan] + |
| 171 | coefs[attrib].dadx[chan] * x + |
| 172 | coefs[attrib].dady[chan] * y; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | static inline void |
| 177 | perspective_interpolation(float (*inputs)[16][4], |
| 178 | const struct tgsi_interp_coef *coefs, |
| 179 | unsigned attrib, |
| 180 | unsigned chan ) |
| 181 | { |
| 182 | unsigned i; |
| 183 | |
| 184 | for( i = 0; i < QUAD_SIZE; i++ ) { |
| 185 | const float x = inputs[i][0][0]; |
| 186 | const float y = inputs[i][0][1]; |
| 187 | /* WPOS.w here is really 1/w */ |
| 188 | const float w = 1.0f / inputs[i][0][3]; |
| 189 | assert(inputs[i][0][3] != 0.0); |
| 190 | |
| 191 | inputs[i][attrib][chan] = |
| 192 | (coefs[attrib].a0[chan] + |
| 193 | coefs[attrib].dadx[chan] * x + |
| 194 | coefs[attrib].dady[chan] * y) * w; |
| 195 | } |
| 196 | } |
| 197 | |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 198 | void gallivm_ir_dump(struct gallivm_ir *ir, const char *file_prefix) |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 199 | { |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 200 | if (!ir || !ir->module) |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 201 | return; |
| 202 | |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 203 | if (file_prefix) { |
| 204 | std::ostringstream stream; |
| 205 | stream << file_prefix; |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 206 | stream << ir->id; |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 207 | stream << ".ll"; |
| 208 | std::string name = stream.str(); |
| 209 | std::ofstream out(name.c_str()); |
| 210 | if (!out) { |
| 211 | std::cerr<<"Can't open file : "<<stream.str()<<std::endl;; |
| 212 | return; |
| 213 | } |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 214 | out << (*ir->module); |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 215 | out.close(); |
| 216 | } else { |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 217 | const llvm::Module::FunctionListType &funcs = ir->module->getFunctionList(); |
Zack Rusin | 75a9018 | 2007-10-29 13:20:55 -0400 | [diff] [blame] | 218 | llvm::Module::FunctionListType::const_iterator itr; |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 219 | std::cout<<"; ---------- Start shader "<<ir->id<<std::endl; |
Zack Rusin | 75a9018 | 2007-10-29 13:20:55 -0400 | [diff] [blame] | 220 | for (itr = funcs.begin(); itr != funcs.end(); ++itr) { |
| 221 | const llvm::Function &func = (*itr); |
| 222 | std::string name = func.getName(); |
| 223 | const llvm::Function *found = 0; |
Zack Rusin | bac991d | 2008-01-24 07:49:36 -0500 | [diff] [blame] | 224 | if (name.find("vs_shader") != std::string::npos || |
| 225 | name.find("fs_shader") != std::string::npos || |
Zack Rusin | 75a9018 | 2007-10-29 13:20:55 -0400 | [diff] [blame] | 226 | name.find("function") != std::string::npos) |
| 227 | found = &func; |
| 228 | if (found) { |
| 229 | std::cout<<*found<<std::endl; |
| 230 | } |
| 231 | } |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 232 | std::cout<<"; ---------- End shader "<<ir->id<<std::endl; |
Zack Rusin | b04430e | 2007-10-22 11:00:28 -0400 | [diff] [blame] | 233 | } |
| 234 | } |
Zack Rusin | d76a7b6 | 2007-10-24 08:34:01 -0400 | [diff] [blame] | 235 | |
Zack Rusin | 25b17b2 | 2007-10-29 08:27:32 -0400 | [diff] [blame] | 236 | |
Zack Rusin | 45003b0 | 2007-11-01 14:00:25 -0400 | [diff] [blame] | 237 | void gallivm_prog_inputs_interpolate(struct gallivm_prog *prog, |
| 238 | float (*inputs)[16][4], |
| 239 | const struct tgsi_interp_coef *coef) |
| 240 | { |
| 241 | for (int i = 0; i < prog->num_interp; ++i) { |
| 242 | const gallivm_interpolate &interp = prog->interpolators[i]; |
| 243 | switch (interp.type) { |
| 244 | case TGSI_INTERPOLATE_CONSTANT: |
| 245 | constant_interpolation(inputs, coef, interp.attrib, interp.chan); |
| 246 | break; |
| 247 | |
| 248 | case TGSI_INTERPOLATE_LINEAR: |
| 249 | linear_interpolation(inputs, coef, interp.attrib, interp.chan); |
| 250 | break; |
| 251 | |
| 252 | case TGSI_INTERPOLATE_PERSPECTIVE: |
| 253 | perspective_interpolation(inputs, coef, interp.attrib, interp.chan); |
| 254 | break; |
| 255 | |
| 256 | default: |
| 257 | assert( 0 ); |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 262 | |
| 263 | struct gallivm_ir * gallivm_ir_new(enum gallivm_shader_type type) |
| 264 | { |
| 265 | struct gallivm_ir *ir = |
| 266 | (struct gallivm_ir *)calloc(1, sizeof(struct gallivm_ir)); |
| 267 | ++GLOBAL_ID; |
| 268 | ir->id = GLOBAL_ID; |
| 269 | ir->type = type; |
| 270 | |
| 271 | return ir; |
| 272 | } |
| 273 | |
| 274 | void gallivm_ir_set_layout(struct gallivm_ir *ir, |
| 275 | enum gallivm_vector_layout layout) |
| 276 | { |
| 277 | ir->layout = layout; |
| 278 | } |
| 279 | |
| 280 | void gallivm_ir_set_components(struct gallivm_ir *ir, int num) |
| 281 | { |
| 282 | ir->num_components = num; |
| 283 | } |
| 284 | |
| 285 | void gallivm_ir_fill_from_tgsi(struct gallivm_ir *ir, |
| 286 | const struct tgsi_token *tokens) |
| 287 | { |
| 288 | std::cout << "Creating llvm from: " <<std::endl; |
| 289 | tgsi_dump(tokens, 0); |
| 290 | |
Zack Rusin | 3c3c1ff | 2008-02-12 23:08:42 -0500 | [diff] [blame] | 291 | llvm::Module *mod = tgsi_to_llvmir(ir, tokens); |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 292 | ir->module = mod; |
| 293 | gallivm_ir_dump(ir, 0); |
| 294 | } |
| 295 | |
| 296 | void gallivm_ir_delete(struct gallivm_ir *ir) |
| 297 | { |
| 298 | delete ir->module; |
| 299 | free(ir); |
| 300 | } |
| 301 | |
| 302 | struct gallivm_prog * gallivm_ir_compile(struct gallivm_ir *ir) |
| 303 | { |
| 304 | struct gallivm_prog *prog = |
| 305 | (struct gallivm_prog *)calloc(1, sizeof(struct gallivm_prog)); |
Zack Rusin | 59766ac | 2008-05-15 17:46:20 -0400 | [diff] [blame] | 306 | |
Zack Rusin | 17f543f | 2008-03-01 08:32:31 -0500 | [diff] [blame] | 307 | std::cout << "Before optimizations:"<<std::endl; |
| 308 | ir->module->dump(); |
| 309 | std::cout<<"-------------------------------"<<std::endl; |
Zack Rusin | 59766ac | 2008-05-15 17:46:20 -0400 | [diff] [blame] | 310 | |
Zack Rusin | 17f543f | 2008-03-01 08:32:31 -0500 | [diff] [blame] | 311 | PassManager veri; |
| 312 | veri.add(createVerifierPass()); |
| 313 | veri.run(*ir->module); |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 314 | llvm::Module *mod = llvm::CloneModule(ir->module); |
| 315 | prog->num_consts = ir->num_consts; |
| 316 | memcpy(prog->interpolators, ir->interpolators, sizeof(prog->interpolators)); |
| 317 | prog->num_interp = ir->num_interp; |
Zack Rusin | 59766ac | 2008-05-15 17:46:20 -0400 | [diff] [blame] | 318 | |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 319 | /* Run optimization passes over it */ |
| 320 | PassManager passes; |
| 321 | passes.add(new TargetData(mod)); |
| 322 | AddStandardCompilePasses(passes); |
| 323 | passes.run(*mod); |
| 324 | prog->module = mod; |
| 325 | |
Zack Rusin | 4c84562 | 2008-02-13 00:48:08 -0500 | [diff] [blame] | 326 | std::cout << "After optimizations:"<<std::endl; |
| 327 | mod->dump(); |
| 328 | |
Zack Rusin | 7d69090 | 2008-02-04 10:07:02 -0500 | [diff] [blame] | 329 | return prog; |
| 330 | } |
| 331 | |
Zack Rusin | d76a7b6 | 2007-10-24 08:34:01 -0400 | [diff] [blame] | 332 | #endif /* MESA_LLVM */ |