[llvm-dev] About the concept of "materialization"

Duncan P. N. Exon Smith via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 30 08:35:08 PDT 2017


> On Jun 30, 2017, at 06:14, 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote:
> 
> 2017-06-29 2:08 GMT+08:00 Pei Wang <pxw172 at ist.psu.edu>:
>> OK. About the error it’s a long story, so it’s probably better to pin some source code here. Below is a piece of code related to my problem, clipped from lib/Transforms/Utils/ValueMapper.cpp. I was wondering what “materialized” means here.
>> 
>> Value *Mapper::mapBlockAddress(const BlockAddress &BA) {
>>   Function *F = cast<Function>(mapValue(BA.getFunction()));
>> 
>>   // F may not have materialized its initializer.  In that case, create a
>>   // dummy basic block for now, and replace it once we've materialized all
>>   // the initializers.
>>   BasicBlock *BB;
>>   if (F->empty()) {
>>     DelayedBBs.push_back(DelayedBasicBlock(BA));
>>     BB = DelayedBBs.back().TempBB.get();
>>   } else {
>>     BB = cast_or_null<BasicBlock>(mapValue(BA.getBasicBlock()));
>>   }
>> 
>>   return getVM()[&BA] = BlockAddress::get(F, BB ? BB : BA.getBasicBlock());
>> }
> 
> 
> Hi Duncan,
> 
>  Could you shed light on that? I guess the code you wrote here
> relates to JIT, but I am not sure
> what materialize actually means. Thanks.

This is for when a bitcode file has been lazy-loaded, and you're materializing global values (and related metadata) into the in-memory representation.

> 
> Regards,
> chenwj
> 
> -- 
> Wei-Ren Chen (陳韋任)
> Homepage: https://people.cs.nctu.edu.tw/~chenwj



More information about the llvm-dev mailing list