diff options
author | Sirui Mu <msrlancern@gmail.com> | 2025-04-17 22:38:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 22:38:37 +0800 |
commit | 78857e7263ba555fb40b286c6b40fcd35a85a65a (patch) | |
tree | eca7fe7d4e35254cfc143617f3783703ca9f1b92 /clang/lib/CIR/CodeGen/CIRGenModule.cpp | |
parent | 7daa5010ab6a2ae77ac88ffd84e2cc37a2e11faa (diff) | |
download | llvm-78857e7263ba555fb40b286c6b40fcd35a85a65a.zip llvm-78857e7263ba555fb40b286c6b40fcd35a85a65a.tar.gz llvm-78857e7263ba555fb40b286c6b40fcd35a85a65a.tar.bz2 |
[CIR] cir.call with scalar return type (#135552)
This PR introduces support for calling functions with a scalar return
type to the upstream. This PR also includes an initial version of
`CIRGenTargetInfo` and related definitions which are essential for the
CIRGen of call ops.
Related to #132487 .
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenModule.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index ddcdc0d..1b50454 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -129,6 +129,34 @@ CharUnits CIRGenModule::getNaturalTypeAlignment(QualType t, return alignment; } +const TargetCIRGenInfo &CIRGenModule::getTargetCIRGenInfo() { + if (theTargetCIRGenInfo) + return *theTargetCIRGenInfo; + + const llvm::Triple &triple = getTarget().getTriple(); + switch (triple.getArch()) { + default: + assert(!cir::MissingFeatures::targetCIRGenInfoArch()); + + // Currently we just fall through to x86_64. + [[fallthrough]]; + + case llvm::Triple::x86_64: { + switch (triple.getOS()) { + default: + assert(!cir::MissingFeatures::targetCIRGenInfoOS()); + + // Currently we just fall through to x86_64. + [[fallthrough]]; + + case llvm::Triple::Linux: + theTargetCIRGenInfo = createX8664TargetCIRGenInfo(genTypes); + return *theTargetCIRGenInfo; + } + } + } +} + mlir::Location CIRGenModule::getLoc(SourceLocation cLoc) { assert(cLoc.isValid() && "expected valid source location"); const SourceManager &sm = astContext.getSourceManager(); |