source: icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp @ 5199

Last change on this file since 5199 was 5199, checked in by faldebey, 3 years ago

make_unique not supported in LLVM3.7

File size: 21.0 KB
Line 
1/*
2 *  Copyright (c) 2014-16 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#include <pablo/pablo_compiler.h>
8#include <pablo/pablo_toolchain.h>
9#include <pablo/codegenstate.h>
10#include <pablo/carry_manager.h>
11#include <pablo/printer_pablos.h>
12#include <pablo/function.h>
13#include <re/re_name.h>
14#include <stdexcept>
15#include <sstream>
16#include <IDISA/idisa_builder.h>
17#include <llvm/IR/Module.h>
18#include <llvm/IR/IRBuilder.h>
19#include <iostream>
20#include <hrtime.h>
21#include <llvm/Support/Debug.h>
22
23namespace pablo {
24
25PabloCompiler::PabloCompiler(IDISA::IDISA_Builder * b, PabloKernel * k, PabloFunction * const function)
26: mMod(b->getModule())
27, iBuilder(b)
28, mBitBlockType(b->getBitBlockType())
29, mCarryManager(nullptr)
30, mPabloFunction(function)
31, mPabloBlock(nullptr)
32, mKernelBuilder(k)
33, mWhileDepth(0)
34, mIfDepth(0)
35, mFunction(nullptr)
36, mMaxWhileDepth(0) {
37   
38}
39
40
41Type * PabloCompiler::initializeKernelData() {
42    Examine(mPabloFunction);
43   
44    mCarryManager = std::unique_ptr<CarryManager>(new CarryManager(iBuilder));
45    Type * carryDataType = mCarryManager->initializeCarryData(mPabloFunction);
46    return carryDataType;
47}
48   
49void PabloCompiler::compile(Function * doBlockFunction) {
50
51    // Make sure that we generate code into the right module.
52    mMod = iBuilder->getModule();
53    mFunction = doBlockFunction;
54    #ifdef PRINT_TIMING_INFORMATION
55    const timestamp_t pablo_compilation_start = read_cycle_counter();
56    #endif
57
58    //Generate Kernel//
59    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
60    mSelf = mKernelBuilder->getParameter(doBlockFunction, "self");
61    mCarryManager->initializeCodeGen(mKernelBuilder, mSelf);
62     
63    Value * blockNo = mKernelBuilder->getScalarField(mSelf, blockNoScalar);
64    std::string inputName = mKernelBuilder->mStreamSetInputs[0].ssName;
65    Value * inputSet_ptr  = mKernelBuilder->getStreamSetBlockPtr(mSelf, inputName, blockNo);
66
67    Value * outputSet_ptr = nullptr;
68    if (mPabloFunction->getNumOfResults() > 0) {
69        std::string outputName = mKernelBuilder->mStreamSetOutputs[0].ssName;
70        outputSet_ptr = mKernelBuilder->getStreamSetBlockPtr(mSelf, outputName, blockNo);
71    }
72
73    PabloBlock * const entryBlock = mPabloFunction->getEntryBlock();
74    mMarkerMap.emplace(entryBlock->createZeroes(), iBuilder->allZeroes());
75    mMarkerMap.emplace(entryBlock->createOnes(), iBuilder->allOnes());
76    for (unsigned j = 0; j < mPabloFunction->getNumOfParameters(); ++j) {
77        Value * inputVal = iBuilder->CreateGEP(inputSet_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(j)}); 
78        const Var * const var = mPabloFunction->getParameter(j);
79        if (DebugOptionIsSet(DumpTrace)) {
80            iBuilder->CallPrintRegister(var->getName()->to_string(), iBuilder->CreateBlockAlignedLoad(inputVal));
81        }
82        mMarkerMap.emplace(var, inputVal);
83    }
84   
85    compileBlock(entryBlock);
86   
87    for (unsigned j = 0; j < mPabloFunction->getNumOfResults(); ++j) {
88        const auto f = mMarkerMap.find(mPabloFunction->getResult(j));
89        if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
90            throw std::runtime_error("PabloCompiler: result " + std::to_string(j) + " was not assigned a value!");
91        }
92        iBuilder->CreateBlockAlignedStore(f->second, outputSet_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
93    }
94   
95    #ifdef PRINT_TIMING_INFORMATION
96    const timestamp_t pablo_compilation_end = read_cycle_counter();
97    std::cerr << "PABLO COMPILATION TIME: " << (pablo_compilation_end - pablo_compilation_start) << std::endl;
98    #endif
99}
100
101inline void PabloCompiler::Examine(const PabloFunction * const function) {
102    mWhileDepth = 0;
103    mIfDepth = 0;
104    mMaxWhileDepth = 0;
105    Examine(function->getEntryBlock());
106}
107
108void PabloCompiler::Examine(const PabloBlock * const block) {
109    unsigned maxOffset = 0;
110    for (const Statement * stmt : *block) {
111         boost::container::flat_set<unsigned> offsets;
112        if (LLVM_UNLIKELY(isa<Lookahead>(stmt))) {
113            const Lookahead * const la = cast<Lookahead>(stmt);
114            assert (isa<Var>(la->getExpr()));
115            if (la->getAmount() > maxOffset) maxOffset = la->getAmount();
116        } else {
117            if (LLVM_UNLIKELY(isa<If>(stmt))) {
118                Examine(cast<If>(stmt)->getBody());
119            } else if (LLVM_UNLIKELY(isa<While>(stmt))) {
120                mMaxWhileDepth = std::max(mMaxWhileDepth, ++mWhileDepth);
121                Examine(cast<While>(stmt)->getBody());
122                --mWhileDepth;
123            }
124        }
125        mKernelBuilder->setLookAhead(maxOffset);
126    }
127}
128
129void PabloCompiler::compileBlock(const PabloBlock * const block) {
130    mPabloBlock = block;
131    for (const Statement * statement : *block) {
132        compileStatement(statement);
133    }
134    mPabloBlock = block->getPredecessor ();
135}
136
137void PabloCompiler::compileIf(const If * ifStatement) {       
138    //
139    //  The If-ElseZero stmt:
140    //  if <predicate:expr> then <body:stmt>* elsezero <defined:var>* endif
141    //  If the value of the predicate is nonzero, then determine the values of variables
142    //  <var>* by executing the given statements.  Otherwise, the value of the
143    //  variables are all zero.  Requirements: (a) no variable that is defined within
144    //  the body of the if may be accessed outside unless it is explicitly
145    //  listed in the variable list, (b) every variable in the defined list receives
146    //  a value within the body, and (c) the logical consequence of executing
147    //  the statements in the event that the predicate is zero is that the
148    //  values of all defined variables indeed work out to be 0.
149    //
150    //  Simple Implementation with Phi nodes:  a phi node in the if exit block
151    //  is inserted for each variable in the defined variable list.  It receives
152    //  a zero value from the ifentry block and the defined value from the if
153    //  body.
154    //
155
156    BasicBlock * const ifEntryBlock = iBuilder->GetInsertBlock();
157    BasicBlock * const ifBodyBlock = BasicBlock::Create(mMod->getContext(), "if.body", mFunction, 0);
158    BasicBlock * const ifEndBlock = BasicBlock::Create(mMod->getContext(), "if.end", mFunction, 0);
159   
160    PabloBlock * ifBody = ifStatement->getBody();
161   
162    Value * const condition = compileExpression(ifStatement->getCondition());
163   
164    mCarryManager->enterScope(ifBody);
165    iBuilder->CreateCondBr(mCarryManager->generateSummaryTest(condition), ifBodyBlock, ifEndBlock);
166   
167    // Entry processing is complete, now handle the body of the if.
168    iBuilder->SetInsertPoint(ifBodyBlock);
169   
170    compileBlock(ifBody);
171    BasicBlock * ifExitBlock = iBuilder->GetInsertBlock();
172
173    if (mCarryManager->hasCarries()) {
174        mCarryManager->storeCarryOutSummary();
175    }
176    mCarryManager->addOuterSummaryToNestedSummary();
177
178    iBuilder->CreateBr(ifEndBlock);
179    //End Block
180    iBuilder->SetInsertPoint(ifEndBlock);
181    for (const PabloAST * node : ifStatement->getDefined()) {
182        const Assign * assign = cast<Assign>(node);
183        PHINode * phi = iBuilder->CreatePHI(mBitBlockType, 2, assign->getName()->value());
184        auto f = mMarkerMap.find(assign);
185        assert (f != mMarkerMap.end());
186        phi->addIncoming(iBuilder->allZeroes(), ifEntryBlock);
187        phi->addIncoming(f->second, ifExitBlock);
188        f->second = phi;
189        assert (mMarkerMap[assign] == phi);
190    }
191    // Create the phi Node for the summary variable, if needed.
192    mCarryManager->buildCarryDataPhisAfterIfBody(ifEntryBlock, ifExitBlock);
193    mCarryManager->leaveScope();
194}
195
196void PabloCompiler::compileWhile(const While * whileStatement) {
197
198    PabloBlock * const whileBody = whileStatement->getBody();
199   
200    BasicBlock * whileEntryBlock = iBuilder->GetInsertBlock();
201    BasicBlock * whileBodyBlock = BasicBlock::Create(mMod->getContext(), "while.body", mFunction, 0);
202    BasicBlock * whileEndBlock = BasicBlock::Create(mMod->getContext(), "while.end", mFunction, 0);
203
204    mCarryManager->enterScope(whileBody);
205    mCarryManager->ensureCarriesLoadedRecursive();
206
207    const auto & nextNodes = whileStatement->getVariants();
208    std::vector<PHINode *> nextPhis;
209    nextPhis.reserve(nextNodes.size());
210#ifdef ENABLE_BOUNDED_WHILE
211    PHINode * bound_phi = nullptr;  // Needed for bounded while loops.
212#endif
213    // On entry to the while structure, proceed to execute the first iteration
214    // of the loop body unconditionally.   The while condition is tested at the end of
215    // the loop.
216
217    iBuilder->CreateBr(whileBodyBlock);
218    iBuilder->SetInsertPoint(whileBodyBlock);
219
220    //
221    // There are 3 sets of Phi nodes for the while loop.
222    // (1) Carry-ins: (a) incoming carry data first iterations, (b) zero thereafter
223    // (2) Carry-out accumulators: (a) zero first iteration, (b) |= carry-out of each iteration
224    // (3) Next nodes: (a) values set up before loop, (b) modified values calculated in loop.
225#ifdef ENABLE_BOUNDED_WHILE
226    // (4) The loop bound, if any.
227#endif
228
229    mCarryManager->initializeWhileEntryCarryDataPhis(whileEntryBlock);
230
231    // for any Next nodes in the loop body, initialize to (a) pre-loop value.
232    for (const Next * n : nextNodes) {
233        PHINode * phi = iBuilder->CreatePHI(mBitBlockType, 2, n->getName()->value());
234        auto f = mMarkerMap.find(n->getInitial());       
235        assert (f != mMarkerMap.end());
236        phi->addIncoming(f->second, whileEntryBlock);
237        f->second = phi;
238        assert(mMarkerMap[n->getInitial()] == phi);
239        nextPhis.push_back(phi);
240    }
241#ifdef ENABLE_BOUNDED_WHILE
242    if (whileStatement->getBound()) {
243        bound_phi = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2, "while_bound");
244        bound_phi->addIncoming(ConstantInt::get(iBuilder->getSizeTy(), whileStatement->getBound()), whileEntryBlock);
245    }
246#endif
247    //
248    // Now compile the loop body proper.  Carry-out accumulated values
249    // and iterated values of Next nodes will be computed.
250    ++mWhileDepth;
251    compileBlock(whileBody);
252
253    // After the whileBody has been compiled, we may be in a different basic block.
254    BasicBlock * whileExitBlock = iBuilder->GetInsertBlock();
255
256    if (mCarryManager->hasCarries()) {
257        mCarryManager->storeCarryOutSummary();
258    }
259    mCarryManager->finalizeWhileBlockCarryDataPhis(whileExitBlock);
260
261    // Terminate the while loop body with a conditional branch back.
262    Value * cond_expr = iBuilder->bitblock_any(compileExpression(whileStatement->getCondition()));
263#ifdef ENABLE_BOUNDED_WHILE
264    if (whileStatement->getBound()) {
265        Value * new_bound = iBuilder->CreateSub(bound_phi, ConstantInt::get(iBuilder->getSizeTy(), 1));
266        bound_phi->addIncoming(new_bound, whileExitBlock);
267        cond_expr = iBuilder->CreateAnd(cond_expr, iBuilder->CreateICmpUGT(new_bound, ConstantInt::getNullValue(iBuilder->getSizeTy())));
268    }
269#endif   
270    iBuilder->CreateCondBr(cond_expr, whileBodyBlock, whileEndBlock);
271
272    // and for any Next nodes in the loop body
273    for (unsigned i = 0; i < nextNodes.size(); i++) {
274        const Next * n = nextNodes[i];
275        const auto f = mMarkerMap.find(n->getExpr());
276        if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
277            throw std::runtime_error("Next node expression was not compiled!");
278        }
279        nextPhis[i]->addIncoming(f->second, whileExitBlock);
280    }
281
282    iBuilder->SetInsertPoint(whileEndBlock);
283    --mWhileDepth;
284
285    mCarryManager->ensureCarriesStoredRecursive();
286    mCarryManager->leaveScope();
287}
288
289
290void PabloCompiler::compileStatement(const Statement * stmt) {
291    Value * expr = nullptr;
292    if (const Assign * assign = dyn_cast<const Assign>(stmt)) {
293        expr = compileExpression(assign->getExpression());
294    } else if (const Next * next = dyn_cast<const Next>(stmt)) {
295        expr = compileExpression(next->getExpr());
296    } else if (const If * ifStatement = dyn_cast<const If>(stmt)) {
297        compileIf(ifStatement);
298        return;
299    } else if (const While * whileStatement = dyn_cast<const While>(stmt)) {
300        compileWhile(whileStatement);
301        return;
302//    } else if (const Call* call = dyn_cast<Call>(stmt)) {
303//        // Call the callee once and store the result in the marker map.
304//        if (LLVM_UNLIKELY(mMarkerMap.count(call) == 0)) {
305//            return;
306//        }
307
308//        const Prototype * proto = call->getPrototype();
309//        const String * callee = proto->getName();
310
311//        Type * inputType = StructType::get(mMod->getContext(), std::vector<Type *>{proto->getNumOfParameters(), mBitBlockType});
312//        Type * outputType = StructType::get(mMod->getContext(), std::vector<Type *>{proto->getNumOfResults(), mBitBlockType});
313//        FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), std::vector<Type *>{PointerType::get(inputType, 0), PointerType::get(outputType, 0)}, false);
314
315//        //Starts on process_block
316//        SmallVector<AttributeSet, 3> Attrs;
317//        Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, std::vector<Attribute::AttrKind>({ Attribute::ReadOnly, Attribute::NoCapture })));
318//        Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, std::vector<Attribute::AttrKind>({ Attribute::ReadNone, Attribute::NoCapture })));
319//        AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
320
321//        Function * externalFunction = cast<Function>(mMod->getOrInsertFunction(callee->value(), functionType, AttrSet));
322//        if (LLVM_UNLIKELY(externalFunction == nullptr)) {
323//            throw std::runtime_error("Could not create static method call for external function \"" + callee->to_string() + "\"");
324//        }
325//        externalFunction->setCallingConv(llvm::CallingConv::C);
326
327//        AllocaInst * outputStruct = iBuilder->CreateAlloca(outputType);
328//        iBuilder->CreateCall2(externalFunction, mInputAddressPtr, outputStruct);
329//        Value * outputPtr = iBuilder->CreateGEP(outputStruct, std::vector<Value *>({ iBuilder->getInt32(0), iBuilder->getInt32(0) }));
330
331//        expr = iBuilder->CreateBlockAlignedLoad(outputPtr);
332    } else if (const And * pablo_and = dyn_cast<And>(stmt)) {
333        expr = iBuilder->simd_and(compileExpression(pablo_and->getOperand(0)), compileExpression(pablo_and->getOperand(1)));
334    } else if (const Or * pablo_or = dyn_cast<Or>(stmt)) {
335        expr = iBuilder->simd_or(compileExpression(pablo_or->getOperand(0)), compileExpression(pablo_or->getOperand(1)));
336    } else if (const Xor * pablo_xor = dyn_cast<Xor>(stmt)) {
337        expr = iBuilder->simd_xor(compileExpression(pablo_xor->getOperand(0)), compileExpression(pablo_xor->getOperand(1)));
338    } else if (const Sel * sel = dyn_cast<Sel>(stmt)) {
339        Value* ifMask = compileExpression(sel->getCondition());
340        Value* ifTrue = iBuilder->simd_and(ifMask, compileExpression(sel->getTrueExpr()));
341        Value* ifFalse = iBuilder->simd_and(iBuilder->simd_not(ifMask), compileExpression(sel->getFalseExpr()));
342        expr = iBuilder->simd_or(ifTrue, ifFalse);
343    } else if (const Not * pablo_not = dyn_cast<Not>(stmt)) {
344        expr = iBuilder->simd_not(compileExpression(pablo_not->getExpr()));
345    } else if (const Advance * adv = dyn_cast<Advance>(stmt)) {
346        Value * const strm_value = compileExpression(adv->getExpr());
347        expr = mCarryManager->advanceCarryInCarryOut(adv->getLocalIndex(), adv->getAmount(), strm_value);
348    } else if (const MatchStar * mstar = dyn_cast<MatchStar>(stmt)) {
349        Value * const marker = compileExpression(mstar->getMarker());
350        Value * const cc = compileExpression(mstar->getCharClass());
351        Value * const marker_and_cc = iBuilder->simd_and(marker, cc);
352        Value * const sum = mCarryManager->addCarryInCarryOut(mstar->getLocalCarryIndex(), marker_and_cc, cc);
353        expr = iBuilder->simd_or(iBuilder->simd_xor(sum, cc), marker);
354    } else if (const ScanThru * sthru = dyn_cast<ScanThru>(stmt)) {
355        Value * const  marker_expr = compileExpression(sthru->getScanFrom());
356        Value * const  cc_expr = compileExpression(sthru->getScanThru());
357        Value * const  sum = mCarryManager->addCarryInCarryOut(sthru->getLocalCarryIndex(), marker_expr, cc_expr);
358        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
359    } else if (const InFile * e = dyn_cast<InFile>(stmt)) {
360        Value * EOFmask = mKernelBuilder->getScalarField(mSelf, "EOFmask");
361        expr = iBuilder->simd_xor(compileExpression(e->getExpr()), EOFmask);
362    } else if (const AtEOF * e = dyn_cast<AtEOF>(stmt)) {
363        Value * EOFbit = mKernelBuilder->getScalarField(mSelf, "EOFbit");
364                expr = iBuilder->simd_and(compileExpression(e->getExpr()), EOFbit);
365    } else if (const Count * c = dyn_cast<Count>(stmt)) {
366        Value * const to_count = compileExpression(c->getExpr());
367        std::string counter = c->getName()->to_string();
368        Value * countSoFar = mKernelBuilder->getScalarField(mSelf, counter);
369        unsigned counterSize = countSoFar->getType()->getIntegerBitWidth();
370        Value * fieldCounts = iBuilder->simd_popcount(counterSize, to_count);
371        for (unsigned i = 0; i < iBuilder->getBitBlockWidth()/counterSize; ++i) {
372            countSoFar = iBuilder->CreateAdd(countSoFar, iBuilder->mvmd_extract(counterSize, fieldCounts, i));
373        }
374        mKernelBuilder->setScalarField(mSelf, counter, countSoFar);
375        expr = iBuilder->bitCast(iBuilder->CreateZExt(countSoFar, iBuilder->getIntNTy(iBuilder->getBitBlockWidth())));
376    } else if (const Lookahead * l = dyn_cast<Lookahead>(stmt)) {
377        PabloAST * const var = l->getExpr();
378        if (LLVM_UNLIKELY(!isa<Var>(var))) {
379            throw std::runtime_error("Lookahead operations may only be applied to input streams");
380        }
381        unsigned index = 0;
382        for (; index < mPabloFunction->getNumOfParameters(); ++index) {
383            if (mPabloFunction->getParameter(index) == var) {
384                break;
385            }
386        }
387        if (LLVM_UNLIKELY(index >= mPabloFunction->getNumOfParameters())) {
388            throw std::runtime_error("Lookahead has an illegal Var operand");
389        }
390        const unsigned bit_shift = (l->getAmount() % iBuilder->getBitBlockWidth());
391        const unsigned block_shift = (l->getAmount() / iBuilder->getBitBlockWidth());
392        std::string inputName = mKernelBuilder->mStreamSetInputs[0].ssName;
393        Value * blockNo = mKernelBuilder->getScalarField(mSelf, blockNoScalar);
394        Value * lookAhead_blockPtr  = mKernelBuilder->getStreamSetBlockPtr(mSelf, inputName, iBuilder->CreateAdd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), block_shift)));
395        Value * lookAhead_inputPtr = iBuilder->CreateGEP(lookAhead_blockPtr, {iBuilder->getInt32(0), iBuilder->getInt32(index)});
396        Value * lookAhead = iBuilder->CreateBlockAlignedLoad(lookAhead_inputPtr);
397        if (bit_shift == 0) {  // Simple case with no intra-block shifting.
398            expr = lookAhead; 
399        }
400        else { // Need to form shift result from two adjacent blocks.
401            Value * lookAhead_blockPtr1  = mKernelBuilder->getStreamSetBlockPtr(mSelf, inputName, iBuilder->CreateAdd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), block_shift + 1)));
402            Value * lookAhead_inputPtr1 = iBuilder->CreateGEP(lookAhead_blockPtr1, {iBuilder->getInt32(0), iBuilder->getInt32(index)});
403            Value * lookAhead1 = iBuilder->CreateBlockAlignedLoad(lookAhead_inputPtr1);
404            if (LLVM_UNLIKELY((bit_shift % 8) == 0)) { // Use a single whole-byte shift, if possible.
405                expr = iBuilder->mvmd_dslli(8, lookAhead1, lookAhead, (bit_shift / 8));
406            }
407            else {
408                Type  * const streamType = iBuilder->getIntNTy(iBuilder->getBitBlockWidth());
409                Value * b1 = iBuilder->CreateBitCast(lookAhead1, streamType);
410                Value * b0 = iBuilder->CreateBitCast(lookAhead, streamType);
411                Value * result = iBuilder->CreateOr(iBuilder->CreateShl(b1, iBuilder->getBitBlockWidth() - bit_shift), iBuilder->CreateLShr(b0, bit_shift));
412                expr = iBuilder->CreateBitCast(result, mBitBlockType);
413            }
414        }
415    } else {
416        std::string tmp;
417        llvm::raw_string_ostream msg(tmp);
418        msg << "Internal error: ";
419        PabloPrinter::print(stmt, msg);
420        msg << " is not a recognized statement in the Pablo compiler.";
421        throw std::runtime_error(msg.str());
422    }
423    mMarkerMap.emplace(stmt, expr);
424    if (DebugOptionIsSet(DumpTrace)) {
425        iBuilder->CallPrintRegister(stmt->getName()->to_string(), expr);
426    }
427   
428}
429
430Value * PabloCompiler::compileExpression(const PabloAST * expr) {
431    if (LLVM_UNLIKELY(isa<Ones>(expr))) {
432        return iBuilder->allOnes();
433    } else if (LLVM_UNLIKELY(isa<Zeroes>(expr))) {
434        return iBuilder->allZeroes();
435    }
436    auto f = mMarkerMap.find(expr);
437    if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
438        std::string tmp;
439        llvm::raw_string_ostream out(tmp);
440        out << "\"";
441        PabloPrinter::print(expr, out);
442        out << "\" was used before definition!";
443        throw std::runtime_error(out.str());
444    }
445    Value * result = f->second;
446    if (LLVM_UNLIKELY(isa<Var>(expr))) {
447        assert (isa<GetElementPtrInst>(result));
448        result = iBuilder->CreateBlockAlignedLoad(result);
449    }
450    return result;
451}
452
453}
Note: See TracBrowser for help on using the repository browser.