LLVMFuncOp: implement addEntryBlock
This function has been declared as a part of the LLVMFuncOp interface but never implemented. Closes #325. PiperOrigin-RevId: 286439619 Change-Id: I7f1c8c5c20ef2419c1a184fc0289f1f95b99c18e
This commit is contained in:
parent
ba91c04e00
commit
4f47c0d60f
@ -1115,9 +1115,23 @@ static ParseResult parseShuffleVectorOp(OpAsmParser &parser,
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Builder, printer and verifier for LLVM::LLVMFuncOp.
|
||||
// Implementations for LLVM::LLVMFuncOp.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Add the entry block to the function.
|
||||
Block *LLVMFuncOp::addEntryBlock() {
|
||||
assert(empty() && "function already has an entry block");
|
||||
assert(!isVarArg() && "unimplemented: non-external variadic functions");
|
||||
|
||||
auto *entry = new Block;
|
||||
push_back(entry);
|
||||
|
||||
LLVMType type = getType();
|
||||
for (unsigned i = 0, e = type.getFunctionNumParams(); i < e; ++i)
|
||||
entry->addArgument(type.getFunctionParamType(i));
|
||||
return entry;
|
||||
}
|
||||
|
||||
void LLVMFuncOp::build(Builder *builder, OperationState &result, StringRef name,
|
||||
LLVMType type, LLVM::Linkage linkage,
|
||||
ArrayRef<NamedAttribute> attrs,
|
||||
|
Loading…
Reference in New Issue
Block a user