MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / createGlobalCString

Function createGlobalCString

cudaq/lib/Optimizer/CodeGen/ConvertToQIRAPI.cpp:91–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91static Value createGlobalCString(Operation *op, Location loc,
92 ConversionPatternRewriter &rewriter,
93 StringRef regName) {
94 cudaq::IRBuilder irb(rewriter.getContext());
95 auto mod = op->getParentOfType<ModuleOp>();
96 auto nameObj = irb.genCStringLiteralAppendNul(loc, mod, regName);
97 Value nameVal = cudaq::cc::AddressOfOp::create(
98 rewriter, loc, cudaq::cc::PointerType::get(nameObj.getType()),
99 nameObj.getName());
100 auto cstrTy = cudaq::cc::PointerType::get(rewriter.getI8Type());
101 return cudaq::cc::CastOp::create(rewriter, loc, cstrTy, nameVal);
102}
103
104/// Use modifier class classes to specialize the QIR API to a particular flavor
105/// of QIR. For example, the names of the actual functions in "full QIR" are

Callers 3

matchAndRewriteMethod · 0.85
matchAndRewriteMethod · 0.85
matchAndRewriteMethod · 0.85

Calls 5

getContextMethod · 0.80
getNameMethod · 0.80
createFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected