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

Last change on this file since 4925 was 4925, checked in by nmedfort, 3 years ago

Slight optimization for Simplifier; major change to CarryManager? to build summary variables whenever a carry operation is performed.

File size: 20.9 KB
Line 
1/*
2 *  Copyright (c) 2014-15 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/codegenstate.h>
9#include <pablo/carry_data.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 <include/simd-lib/bitblock.hpp>
16#include <sstream>
17#include <IDISA/idisa_builder.h>
18#include <IDISA/idisa_avx_builder.h>
19#include <llvm/Pass.h>
20#include <llvm/PassManager.h>
21#include <llvm/ADT/SmallVector.h>
22#include <llvm/Analysis/Passes.h>
23#include <llvm/IR/BasicBlock.h>
24#include <llvm/IR/CallingConv.h>
25#include <llvm/IR/DataLayout.h>
26#include <llvm/IR/DerivedTypes.h>
27#include <llvm/IR/Function.h>
28#include <llvm/IR/GlobalVariable.h>
29#include <llvm/IR/InlineAsm.h>
30#include <llvm/IR/Instructions.h>
31#include <llvm/IR/LLVMContext.h>
32#include <llvm/IR/Module.h>
33#include <llvm/Support/FormattedStream.h>
34#include <llvm/Support/MathExtras.h>
35#include <llvm/Support/Casting.h>
36#include <llvm/Support/Compiler.h>
37#include <llvm/Support/Debug.h>
38#include <llvm/Support/TargetSelect.h>
39#include <llvm/Support/Host.h>
40#include <llvm/Transforms/Scalar.h>
41#include <llvm/IRReader/IRReader.h>
42#include <llvm/Bitcode/ReaderWriter.h>
43#include <llvm/Support/MemoryBuffer.h>
44#include <llvm/IR/IRBuilder.h>
45#include <llvm/Support/CommandLine.h>
46#include <llvm/ADT/Twine.h>
47#include <iostream>
48#include <llvm/Support/raw_ostream.h>
49#include <llvm/Support/FileSystem.h>
50#ifndef NDEBUG
51#include <llvm/IR/Verifier.h>
52#endif
53
54//#include <llvm/PassManager.h>
55//#include <llvm/Transforms/IPO/PassManagerBuilder.h>
56
57#include <hrtime.h>
58
59static cl::OptionCategory eIRDumpOptions("LLVM IR Dump Options", "These options control dumping of LLVM IR.");
60static cl::opt<bool> DumpGeneratedIR("dump-generated-IR", cl::init(false), cl::desc("Print LLVM IR generated by Pablo Compiler."), cl::cat(eIRDumpOptions));
61static cl::opt<std::string> IROutputFilename("dump-generated-IR-output", cl::init(""), cl::desc("output IR filename"), cl::cat(eIRDumpOptions));
62
63
64static cl::OptionCategory fTracingOptions("Run-time Tracing Options", "These options control execution traces.");
65static cl::opt<bool> DumpTrace("dump-trace", cl::init(false), cl::desc("Generate dynamic traces of executed assignments."), cl::cat(fTracingOptions));
66
67namespace pablo {
68
69PabloCompiler::PabloCompiler(Module * m, IDISA::IDISA_Builder * b)
70: mMod(m)
71, iBuilder(b)
72, mBitBlockType(b->getBitBlockType())
73, mCarryManager(nullptr)
74, mInputType(nullptr)
75, mWhileDepth(0)
76, mIfDepth(0)
77, mFunction(nullptr)
78, mInputAddressPtr(nullptr)
79, mOutputAddressPtr(nullptr)
80, mMaxWhileDepth(0) {
81   
82}
83
84PabloCompiler::~PabloCompiler() {
85}
86       
87llvm::Function * PabloCompiler::compile(PabloFunction * function) {
88
89    #ifdef PRINT_TIMING_INFORMATION
90    const timestamp_t pablo_compilation_start = read_cycle_counter();
91    #endif
92 
93    PabloBlock * const mainScope = function->getEntryBlock();
94
95    mainScope->enumerateScopes(0);
96   
97    Examine(*function);
98
99    mCarryManager = new CarryManager(iBuilder);
100   
101    GenerateFunction(*function);
102   
103    iBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", mFunction,0));
104
105    //The basis bits structure
106    for (unsigned i = 0; i != function->getNumOfParameters(); ++i) {
107        Value* indices[] = {iBuilder->getInt64(0), iBuilder->getInt32(i)};
108        Value * gep = iBuilder->CreateGEP(mInputAddressPtr, indices);
109        LoadInst * basisBit = iBuilder->CreateAlignedLoad(gep, iBuilder->getBitBlockWidth()/8, false, function->getParameter(i)->getName()->to_string());
110        mMarkerMap[function->getParameter(i)] = basisBit;
111        if (DumpTrace) {
112            iBuilder->genPrintRegister(function->getParameter(i)->getName()->to_string(), basisBit);
113        }
114    }
115     
116    //Generate the IR instructions for the function.
117   
118    mCarryManager->initialize(mMod, mainScope);
119
120    compileBlock(mainScope);
121   
122    mCarryManager->generateBlockNoIncrement();
123
124    if (DumpTrace) {
125        iBuilder->genPrintRegister("mBlockNo", iBuilder->CreateAlignedLoad(iBuilder->CreateBitCast(mCarryManager->getBlockNoPtr(), PointerType::get(mBitBlockType, 0)), iBuilder->getBitBlockWidth()/8, false));
126    }
127   
128    // Write the output values out
129    for (unsigned i = 0; i != function->getNumOfResults(); ++i) {
130        assert (function->getResult(i));
131        SetOutputValue(mMarkerMap[function->getResult(i)], i);
132    }
133
134    //Terminate the block
135    ReturnInst::Create(mMod->getContext(), iBuilder->GetInsertBlock());
136   
137    // Clean up
138    delete mCarryManager;
139    mCarryManager = nullptr;
140   
141    #ifdef PRINT_TIMING_INFORMATION
142    const timestamp_t pablo_compilation_end = read_cycle_counter();
143    std::cerr << "PABLO COMPILATION TIME: " << (pablo_compilation_end - pablo_compilation_start) << std::endl;
144    #endif
145
146//    llvm::PassManager pm;
147//    llvm::PassManagerBuilder pmb;
148//    pmb.OptLevel = 3;
149//    pmb.populateModulePassManager(pm);
150//    pm.run(*mMod);
151
152    if (LLVM_UNLIKELY(DumpGeneratedIR)) {
153
154        if (IROutputFilename.empty()) {
155            mMod->dump();
156        } else {
157            std::error_code error;
158            llvm::raw_fd_ostream out(IROutputFilename, error, sys::fs::OpenFlags::F_None);
159            mMod->print(out, nullptr);
160        }
161    }
162
163    #ifndef NDEBUG
164    raw_os_ostream err(std::cerr);
165    verifyModule(*mMod, &err);
166    #endif
167
168    return mFunction;
169}
170
171inline void PabloCompiler::GenerateFunction(PabloFunction & function) {
172    mInputType = PointerType::get(StructType::get(mMod->getContext(), std::vector<Type *>(function.getNumOfParameters(), mBitBlockType)), 0);
173    Type * outputType = PointerType::get(StructType::get(mMod->getContext(), std::vector<Type *>(function.getNumOfResults(), mBitBlockType)), 0);
174    FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), std::vector<Type *>({mInputType, outputType}), false);
175
176
177    //Starts on process_block
178    SmallVector<AttributeSet, 3> Attrs;
179    Attrs.push_back(AttributeSet::get(mMod->getContext(), ~0U, std::vector<Attribute::AttrKind>({ Attribute::NoUnwind, Attribute::UWTable })));
180    Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, std::vector<Attribute::AttrKind>({ Attribute::ReadOnly, Attribute::NoCapture })));
181    Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, std::vector<Attribute::AttrKind>({ Attribute::ReadNone, Attribute::NoCapture })));
182    AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
183
184    // Create the function that will be generated.
185    mFunction = Function::Create(functionType, GlobalValue::ExternalLinkage, function.getName()->value(), mMod);
186    mFunction->setCallingConv(CallingConv::C);
187    mFunction->setAttributes(AttrSet);
188
189    Function::arg_iterator args = mFunction->arg_begin();
190    mInputAddressPtr = args++;
191    mInputAddressPtr->setName("input");
192    mOutputAddressPtr = args++;
193    mOutputAddressPtr->setName("output");
194}
195
196inline void PabloCompiler::Examine(PabloFunction & function) {
197    mWhileDepth = 0;
198    mIfDepth = 0;
199    mMaxWhileDepth = 0;
200    Examine(function.getEntryBlock());
201    if (LLVM_UNLIKELY(mWhileDepth != 0 || mIfDepth != 0)) {
202        throw std::runtime_error("Malformed Pablo AST: Unbalanced If or While nesting depth!");
203    }
204}
205
206
207void PabloCompiler::Examine(PabloBlock * block) {
208    for (Statement * stmt : *block) {
209        if (If * ifStatement = dyn_cast<If>(stmt)) {
210            Examine(ifStatement->getBody());
211        }
212        else if (While * whileStatement = dyn_cast<While>(stmt)) {
213            mMaxWhileDepth = std::max(mMaxWhileDepth, ++mWhileDepth);
214            Examine(whileStatement->getBody());
215            --mWhileDepth;
216        }
217    }
218}
219
220void PabloCompiler::compileBlock(PabloBlock * block) {
221    mPabloBlock = block;
222    for (const Statement * statement : *block) {
223        compileStatement(statement);
224    }
225    mPabloBlock = block->getParent();
226}
227
228void PabloCompiler::compileIf(const If * ifStatement) {       
229    //
230    //  The If-ElseZero stmt:
231    //  if <predicate:expr> then <body:stmt>* elsezero <defined:var>* endif
232    //  If the value of the predicate is nonzero, then determine the values of variables
233    //  <var>* by executing the given statements.  Otherwise, the value of the
234    //  variables are all zero.  Requirements: (a) no variable that is defined within
235    //  the body of the if may be accessed outside unless it is explicitly
236    //  listed in the variable list, (b) every variable in the defined list receives
237    //  a value within the body, and (c) the logical consequence of executing
238    //  the statements in the event that the predicate is zero is that the
239    //  values of all defined variables indeed work out to be 0.
240    //
241    //  Simple Implementation with Phi nodes:  a phi node in the if exit block
242    //  is inserted for each variable in the defined variable list.  It receives
243    //  a zero value from the ifentry block and the defined value from the if
244    //  body.
245    //
246
247    BasicBlock * const ifEntryBlock = iBuilder->GetInsertBlock();
248    BasicBlock * const ifBodyBlock = BasicBlock::Create(mMod->getContext(), "if.body", mFunction, 0);
249    BasicBlock * const ifEndBlock = BasicBlock::Create(mMod->getContext(), "if.end", mFunction, 0);
250   
251    PabloBlock * ifBody = ifStatement->getBody();
252   
253    Value * const condition = compileExpression(ifStatement->getCondition());
254   
255    mCarryManager->enterScope(ifBody);
256    iBuilder->CreateCondBr(mCarryManager->generateSummaryTest(condition), ifBodyBlock, ifEndBlock);
257   
258    // Entry processing is complete, now handle the body of the if.
259    iBuilder->SetInsertPoint(ifBodyBlock);
260   
261    compileBlock(ifBody);
262    BasicBlock * ifExitBlock = iBuilder->GetInsertBlock();
263
264    if (mCarryManager->hasCarries()) {
265        mCarryManager->storeCarryOutSummary();
266    }
267    mCarryManager->blendCarrySummaryWithOuterSummary();
268
269    iBuilder->CreateBr(ifEndBlock);
270    //End Block
271    iBuilder->SetInsertPoint(ifEndBlock);
272    for (const PabloAST * node : ifStatement->getDefined()) {
273        const Assign * assign = cast<Assign>(node);
274        PHINode * phi = iBuilder->CreatePHI(mBitBlockType, 2, assign->getName()->value());
275        auto f = mMarkerMap.find(assign);
276        assert (f != mMarkerMap.end());
277        phi->addIncoming(iBuilder->allZeroes(), ifEntryBlock);
278        phi->addIncoming(f->second, ifExitBlock);
279        mMarkerMap[assign] = phi;
280    }
281    // Create the phi Node for the summary variable, if needed.
282    mCarryManager->buildCarryDataPhisAfterIfBody(ifEntryBlock, ifExitBlock);
283    mCarryManager->leaveScope();
284}
285
286void PabloCompiler::compileWhile(const While * whileStatement) {
287
288    PabloBlock * const whileBody = whileStatement->getBody();
289   
290    BasicBlock * whileEntryBlock = iBuilder->GetInsertBlock();
291    BasicBlock * whileBodyBlock = BasicBlock::Create(mMod->getContext(), "while.body", mFunction, 0);
292    BasicBlock * whileEndBlock = BasicBlock::Create(mMod->getContext(), "while.end", mFunction, 0);
293
294    mCarryManager->enterScope(whileBody);
295    mCarryManager->ensureCarriesLoadedRecursive();
296
297    const auto & nextNodes = whileStatement->getVariants();
298    std::vector<PHINode *> nextPhis;
299    nextPhis.reserve(nextNodes.size());
300
301    // On entry to the while structure, proceed to execute the first iteration
302    // of the loop body unconditionally.   The while condition is tested at the end of
303    // the loop.
304
305    iBuilder->CreateBr(whileBodyBlock);
306    iBuilder->SetInsertPoint(whileBodyBlock);
307
308    //
309    // There are 3 sets of Phi nodes for the while loop.
310    // (1) Carry-ins: (a) incoming carry data first iterations, (b) zero thereafter
311    // (2) Carry-out accumulators: (a) zero first iteration, (b) |= carry-out of each iteration
312    // (3) Next nodes: (a) values set up before loop, (b) modified values calculated in loop.
313
314    mCarryManager->initializeWhileEntryCarryDataPhis(whileEntryBlock);
315
316    // for any Next nodes in the loop body, initialize to (a) pre-loop value.
317    for (const Next * n : nextNodes) {
318        PHINode * phi = iBuilder->CreatePHI(mBitBlockType, 2, n->getName()->value());
319        auto f = mMarkerMap.find(n->getInitial());
320        assert (f != mMarkerMap.end());
321        phi->addIncoming(f->second, whileEntryBlock);
322        mMarkerMap[n->getInitial()] = phi;
323        nextPhis.push_back(phi);
324    }
325
326    //
327    // Now compile the loop body proper.  Carry-out accumulated values
328    // and iterated values of Next nodes will be computed.
329    ++mWhileDepth;
330    compileBlock(whileBody);
331
332    BasicBlock * whileExitBlock = iBuilder->GetInsertBlock();
333
334    if (mCarryManager->hasCarries()) {
335        mCarryManager->storeCarryOutSummary();
336    }
337    mCarryManager->finalizeWhileBlockCarryDataPhis(whileExitBlock);
338
339    // Terminate the while loop body with a conditional branch back.
340    iBuilder->CreateCondBr(iBuilder->bitblock_any(compileExpression(whileStatement->getCondition())), whileBodyBlock, whileEndBlock);
341
342    // and for any Next nodes in the loop body
343    for (unsigned i = 0; i < nextNodes.size(); i++) {
344        const Next * n = nextNodes[i];
345        auto f = mMarkerMap.find(n->getExpr());
346        if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
347            throw std::runtime_error("Next node expression was not compiled!");
348        }
349        nextPhis[i]->addIncoming(f->second, whileExitBlock);
350    }
351
352    iBuilder->SetInsertPoint(whileEndBlock);
353    --mWhileDepth;
354
355    mCarryManager->ensureCarriesStoredRecursive();
356    mCarryManager->leaveScope();
357}
358
359
360void PabloCompiler::compileStatement(const Statement * stmt) {
361    Value * expr = nullptr;
362    if (const Assign * assign = dyn_cast<const Assign>(stmt)) {
363        expr = compileExpression(assign->getExpression());
364    }
365    else if (const Next * next = dyn_cast<const Next>(stmt)) {
366        expr = compileExpression(next->getExpr());
367    }
368    else if (const If * ifStatement = dyn_cast<const If>(stmt)) {
369        compileIf(ifStatement);
370        return;
371    }
372    else if (const While * whileStatement = dyn_cast<const While>(stmt)) {
373        compileWhile(whileStatement);
374        return;
375    }
376    else if (const Call* call = dyn_cast<Call>(stmt)) {
377        // Call the callee once and store the result in the marker map.
378        if (mMarkerMap.count(call)) {
379            return;
380        }
381
382        const Prototype * proto = call->getPrototype();
383        const String * callee = proto->getName();
384
385        Type * inputType = StructType::get(mMod->getContext(), std::vector<Type *>{proto->getNumOfParameters(), mBitBlockType});
386        Type * outputType = StructType::get(mMod->getContext(), std::vector<Type *>{proto->getNumOfResults(), mBitBlockType});
387        FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), std::vector<Type *>{PointerType::get(inputType, 0), PointerType::get(outputType, 0)}, false);
388
389        //Starts on process_block
390        SmallVector<AttributeSet, 3> Attrs;
391        Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, std::vector<Attribute::AttrKind>({ Attribute::ReadOnly, Attribute::NoCapture })));
392        Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, std::vector<Attribute::AttrKind>({ Attribute::ReadNone, Attribute::NoCapture })));
393        AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
394
395        Function * externalFunction = cast<Function>(mMod->getOrInsertFunction(callee->value(), functionType, AttrSet));
396        if (LLVM_UNLIKELY(externalFunction == nullptr)) {
397            throw std::runtime_error("Could not create static method call for external function \"" + callee->to_string() + "\"");
398        }
399        externalFunction->setCallingConv(llvm::CallingConv::C);
400
401
402        AllocaInst * outputStruct = iBuilder->CreateAlloca(outputType);
403        iBuilder->CreateCall2(externalFunction, mInputAddressPtr, outputStruct);
404        Value * outputPtr = iBuilder->CreateGEP(outputStruct, std::vector<Value *>({ iBuilder->getInt32(0), iBuilder->getInt32(0) }));
405        expr = iBuilder->CreateAlignedLoad(outputPtr, iBuilder->getBitBlockWidth() / 8, false);
406    }
407    else if (const And * pablo_and = dyn_cast<And>(stmt)) {
408        expr = iBuilder->simd_and(compileExpression(pablo_and->getOperand(0)), compileExpression(pablo_and->getOperand(1)));
409    }
410    else if (const Or * pablo_or = dyn_cast<Or>(stmt)) {
411        expr = iBuilder->simd_or(compileExpression(pablo_or->getOperand(0)), compileExpression(pablo_or->getOperand(1)));
412    }
413    else if (const Xor * pablo_xor = dyn_cast<Xor>(stmt)) {
414        expr = iBuilder->simd_xor(compileExpression(pablo_xor->getOperand(0)), compileExpression(pablo_xor->getOperand(1)));
415    }
416    else if (const Sel * sel = dyn_cast<Sel>(stmt)) {
417        Value* ifMask = compileExpression(sel->getCondition());
418        Value* ifTrue = iBuilder->simd_and(ifMask, compileExpression(sel->getTrueExpr()));
419        Value* ifFalse = iBuilder->simd_and(iBuilder->simd_not(ifMask), compileExpression(sel->getFalseExpr()));
420        expr = iBuilder->simd_or(ifTrue, ifFalse);
421    }
422    else if (const Not * pablo_not = dyn_cast<Not>(stmt)) {
423        expr = iBuilder->simd_not(compileExpression(pablo_not->getExpr()));
424    }
425    else if (const Advance * adv = dyn_cast<Advance>(stmt)) {
426        Value * const strm_value = compileExpression(adv->getExpr());
427        expr = mCarryManager->advanceCarryInCarryOut(adv->getLocalAdvanceIndex(), adv->getAdvanceAmount(), strm_value);
428    }
429    else if (const Mod64Advance * adv = dyn_cast<Mod64Advance>(stmt)) {
430        Value * const strm_value = compileExpression(adv->getExpr());
431        expr = iBuilder->simd_slli(64, strm_value, adv->getAdvanceAmount());
432    }
433    else if (const MatchStar * mstar = dyn_cast<MatchStar>(stmt)) {
434        Value * const marker = compileExpression(mstar->getMarker());
435        Value * const cc = compileExpression(mstar->getCharClass());
436        Value * const marker_and_cc = iBuilder->simd_and(marker, cc);
437        Value * const sum = mCarryManager->addCarryInCarryOut(mstar->getLocalCarryIndex(), marker_and_cc, cc);
438        expr = iBuilder->simd_or(iBuilder->simd_xor(sum, cc), marker);
439    }
440    else if (const Mod64MatchStar * mstar = dyn_cast<Mod64MatchStar>(stmt)) {
441        Value * const marker = compileExpression(mstar->getMarker());
442        Value * const cc = compileExpression(mstar->getCharClass());
443        Value * const marker_and_cc = iBuilder->simd_and(marker, cc);
444        Value * const sum = iBuilder->simd_add(64, marker_and_cc, cc);
445        expr = iBuilder->simd_or(iBuilder->simd_xor(sum, cc), marker);
446    }
447    else if (const ScanThru * sthru = dyn_cast<ScanThru>(stmt)) {
448        Value * const  marker_expr = compileExpression(sthru->getScanFrom());
449        Value * const  cc_expr = compileExpression(sthru->getScanThru());
450        Value * const  sum = mCarryManager->addCarryInCarryOut(sthru->getLocalCarryIndex(), marker_expr, cc_expr);
451        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
452    }
453    else if (const Mod64ScanThru * sthru = dyn_cast<Mod64ScanThru>(stmt)) {
454        Value * const marker_expr = compileExpression(sthru->getScanFrom());
455        Value * const cc_expr = compileExpression(sthru->getScanThru());
456        Value * const sum = iBuilder->simd_add(64, marker_expr, cc_expr);
457        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
458    }
459    else if (const Count * c = dyn_cast<Count>(stmt)) {
460        Value * const to_count = compileExpression(c->getExpr());
461        expr = mCarryManager->popCount(to_count, c->getGlobalCountIndex());
462    } else {
463        std::string tmp;
464        llvm::raw_string_ostream msg(tmp);
465        msg << "Internal error: ";
466        PabloPrinter::print(stmt, msg);
467        msg << " is not a recognized statement in the Pablo compiler.";
468        throw std::runtime_error(msg.str());
469    }
470    mMarkerMap[stmt] = expr;
471    if (DumpTrace) {
472        iBuilder->genPrintRegister(stmt->getName()->to_string(), expr);
473    }
474   
475}
476
477Value * PabloCompiler::compileExpression(const PabloAST * expr) {
478    if (isa<Ones>(expr)) {
479        return iBuilder->allOnes();
480    }
481    else if (isa<Zeroes>(expr)) {
482        return iBuilder->allZeroes();
483    }
484    auto f = mMarkerMap.find(expr);
485    if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
486        std::string o;
487        llvm::raw_string_ostream str(o);
488        str << "\"";
489        PabloPrinter::print(expr, str);
490        str << "\" was used before definition!";
491        throw std::runtime_error(str.str());
492    }
493    return f->second;
494}
495
496void PabloCompiler::SetOutputValue(Value * marker, const unsigned index) {
497    if (LLVM_UNLIKELY(marker == nullptr)) {
498        throw std::runtime_error("Cannot set result " + std::to_string(index) + " to Null");
499    }
500    if (LLVM_UNLIKELY(marker->getType()->isPointerTy())) {
501        marker = iBuilder->CreateAlignedLoad(marker, iBuilder->getBitBlockWidth()/8, false);
502    }
503    Value* indices[] = {iBuilder->getInt64(0), iBuilder->getInt32(index)};
504    Value* gep = iBuilder->CreateGEP(mOutputAddressPtr, indices);
505    if (marker->getType() != mBitBlockType) {
506        marker = iBuilder->CreateBitCast(marker, mBitBlockType);
507    }
508    iBuilder->CreateAlignedStore(marker, gep, iBuilder->getBitBlockWidth()/8, false);
509}
510
511}
Note: See TracBrowser for help on using the repository browser.