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

Last change on this file since 4945 was 4945, checked in by lindanl, 4 years ago

Use kernel state methods.

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