Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if (NOT DEFINED LLVM_VERSION_MAJOR)
project(llvm-cbe)
set (USE_SYSTEM_LLVM 1)
cmake_minimum_required(VERSION 3.20.0)
find_package(LLVM 19.1 REQUIRED CONFIG)
find_package(LLVM 20.1 REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
message(STATUS "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS}")
Expand Down
9 changes: 1 addition & 8 deletions lib/Target/CBackend/CBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ raw_ostream &CWriter::printTypeString(raw_ostream &Out, Type *Ty,
case Type::FP128TyID:
return Out << "f128";

case Type::X86_MMXTyID:
return Out << (isSigned ? "i32y2" : "u32y2");

case Type::FunctionTyID:
llvm_unreachable(
"printTypeString should never be called with a function type");
Expand Down Expand Up @@ -543,10 +540,6 @@ raw_ostream &CWriter::printSimpleType(raw_ostream &Out, Type *Ty,
case Type::FP128TyID:
return Out << "long double";

case Type::X86_MMXTyID:
return Out << (isSigned ? "int32_t" : "uint32_t")
<< " __attribute__((vector_size(8)))";

default:
DBG_ERRS("Unknown primitive type: " << *Ty);
errorWithMessage("unknown primitive type");
Expand Down Expand Up @@ -2380,7 +2373,7 @@ void CWriter::generateCompilerSpecificCode(raw_ostream &Out,
bool CWriter::doInitialization(Module &M) {
TheModule = &M;

TD = new DataLayout(&M);
TD = new DataLayout(M.getDataLayout());
IL = new IntrinsicLowering(*TD);

TAsm = new CBEMCAsmInfo();
Expand Down
14 changes: 9 additions & 5 deletions lib/Target/CBackend/CTargetMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CTargetSubtargetInfo : public TargetSubtargetInfo {
CTargetSubtargetInfo(const TargetMachine &TM, const Triple &TT, StringRef CPU,
StringRef TuneCPU, StringRef FS)
: TargetSubtargetInfo(TT, CPU, TuneCPU, FS,
ArrayRef<StringRef>(),
ArrayRef<SubtargetFeatureKV>(),
ArrayRef<SubtargetSubTypeKV>(), nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr),
Expand All @@ -42,16 +43,19 @@ class CTargetSubtargetInfo : public TargetSubtargetInfo {
const CTargetLowering Lowering;
};

class CTargetMachine : public LLVMTargetMachine {
class CTargetMachine : public TargetMachine {
public:
CTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
const TargetOptions &Options, std::optional<Reloc::Model> RM,
std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
bool /*JIT*/)
: LLVMTargetMachine(T, "", TT, CPU, FS, Options,
RM.value_or(Reloc::Static),
CM.value_or(CodeModel::Small), OL),
SubtargetInfo(*this, TT, CPU, "", FS) {}
: TargetMachine(T, "", TT, CPU, FS, Options),
SubtargetInfo(*this, TT, CPU, "", FS)
{
this->RM = RM.value_or(Reloc::Static);
this->CMModel = CM.value_or(CodeModel::Small);
this->OptLevel = OL;
}

/// Add passes to the specified pass manager to get the specified file
/// emitted. Typically this will involve several steps of code generation.
Expand Down
4 changes: 3 additions & 1 deletion tools/llvm-cbe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ if(USE_SYSTEM_LLVM)
CBackendCodeGen
CBackendInfo
)
target_link_libraries(llvm-cbe LLVM ${llvm_libs})
target_link_libraries(llvm-cbe
LLVMXRay;LLVMLibDriver;LLVMDlltoolDriver;LLVMTelemetry;LLVMTextAPIBinaryReader;LLVMCoverage;LLVMLineEditor;LLVMNVPTXCodeGen;LLVMNVPTXDesc;LLVMNVPTXInfo;LLVMRISCVTargetMCA;LLVMRISCVDisassembler;LLVMRISCVAsmParser;LLVMRISCVCodeGen;LLVMRISCVDesc;LLVMRISCVInfo;LLVMWebAssemblyDisassembler;LLVMWebAssemblyAsmParser;LLVMWebAssemblyCodeGen;LLVMWebAssemblyUtils;LLVMWebAssemblyDesc;LLVMWebAssemblyInfo;LLVMBPFDisassembler;LLVMBPFAsmParser;LLVMBPFCodeGen;LLVMBPFDesc;LLVMBPFInfo;LLVMX86TargetMCA;LLVMX86Disassembler;LLVMX86AsmParser;LLVMX86CodeGen;LLVMX86Desc;LLVMX86Info;LLVMARMDisassembler;LLVMARMAsmParser;LLVMARMCodeGen;LLVMARMDesc;LLVMARMUtils;LLVMARMInfo;LLVMAArch64Disassembler;LLVMAArch64AsmParser;LLVMAArch64CodeGen;LLVMAArch64Desc;LLVMAArch64Utils;LLVMAArch64Info;LLVMOrcDebugging;LLVMOrcJIT;LLVMWindowsDriver;LLVMMCJIT;LLVMJITLink;LLVMInterpreter;LLVMExecutionEngine;LLVMRuntimeDyld;LLVMOrcTargetProcess;LLVMOrcShared;LLVMDWP;LLVMOption;LLVMObjectYAML;LLVMObjCopy;LLVMMCA;LLVMMCDisassembler;LLVMLTO;LLVMPasses;LLVMHipStdPar;LLVMCFGuard;LLVMCoroutines;LLVMipo;LLVMVectorize;LLVMSandboxIR;LLVMLinker;LLVMInstrumentation;LLVMFrontendOpenMP;LLVMFrontendOffloading;LLVMFrontendOpenACC;LLVMFrontendHLSL;LLVMFrontendDriver;LLVMFrontendAtomic;LLVMExtensions;LLVMDWARFLinkerParallel;LLVMDWARFLinkerClassic;LLVMDWARFLinker;LLVMGlobalISel;LLVMMIRParser;LLVMAsmPrinter;LLVMSelectionDAG;LLVMCodeGen;LLVMTarget;LLVMObjCARCOpts;LLVMCodeGenTypes;LLVMCGData;LLVMIRPrinter;LLVMInterfaceStub;LLVMFileCheck;LLVMFuzzMutate;LLVMScalarOpts;LLVMInstCombine;LLVMAggressiveInstCombine;LLVMTransformUtils;LLVMBitWriter;LLVMAnalysis;LLVMProfileData;LLVMSymbolize;LLVMObject;LLVMTextAPI;LLVMMCParser;LLVMIRReader;LLVMAsmParser;LLVMMC;LLVMBitReader;LLVMFuzzerCLI;LLVMCore;LLVMRemarks;LLVMBitstreamReader;LLVMBinaryFormat;LLVMTargetParser;LLVMTableGen;LLVMSupport;LLVMDemangle;
${llvm_libs})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment from the peanut gallery. LLVM provide cmake commands that are more robust across different installations and between version updates. I believe they are called llvm_map_components_to_libnames and llvm_expand_dependencies. You can see an example usage here:
https://github.com/symengine/symengine/blob/c574fa8d7018a850481afa7a59809d30e774d78d/CMakeLists.txt#L427-L445

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that is already in use here, but I don't know enough specifically about cmake. Try removing this change? Also change the CI scripts (in .github) to use llvm-v20 please

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump?

endif()
Loading