MCPcopy Create free account
hub / github.com/beefytech/Beef / GetLLVMType

Method GetLLVMType

IDEHelper/Compiler/BfIRCodeGen.cpp:588–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588llvm::Type* BfIRCodeGen::GetLLVMType(BfTypeCode typeCode, bool& isSigned)
589{
590 if ((typeCode == BfTypeCode_IntPtr) || (typeCode == BfTypeCode_UIntPtr))
591 {
592 /*isSigned = typeCode == BfTypeCode_IntPtr;
593 if (mModule->mSystem->mPtrSize == 4)
594 return llvm::Type::getInt32Ty(*mLLVMContext);
595 else
596 return llvm::Type::getInt64Ty(*mLLVMContext);*/
597 BF_FATAL("Unsupported");
598 }
599
600 isSigned = false;
601 switch (typeCode)
602 {
603 case BfTypeCode_None:
604 return llvm::Type::getVoidTy(*mLLVMContext);
605 case BfTypeCode_NullPtr:
606 return llvm::PointerType::get(*mLLVMContext, 0);
607 case BfTypeCode_Boolean:
608 return llvm::Type::getInt1Ty(*mLLVMContext);
609 case BfTypeCode_Int8:
610 isSigned = true;
611 return llvm::Type::getInt8Ty(*mLLVMContext);
612 case BfTypeCode_UInt8:
613 case BfTypeCode_Char8:
614 return llvm::Type::getInt8Ty(*mLLVMContext);
615 case BfTypeCode_Int16:
616 isSigned = true;
617 return llvm::Type::getInt16Ty(*mLLVMContext);
618 case BfTypeCode_UInt16:
619 case BfTypeCode_Char16:
620 return llvm::Type::getInt16Ty(*mLLVMContext);
621 case BfTypeCode_Int24:
622 isSigned = true;
623 return llvm::Type::getIntNTy(*mLLVMContext, 24);
624 case BfTypeCode_UInt24:
625 return llvm::Type::getIntNTy(*mLLVMContext, 24);
626 case BfTypeCode_Int32:
627 isSigned = true;
628 return llvm::Type::getInt32Ty(*mLLVMContext);
629 case BfTypeCode_UInt32:
630 case BfTypeCode_Char32:
631 return llvm::Type::getInt32Ty(*mLLVMContext);
632 case BfTypeCode_Int40:
633 isSigned = true;
634 return llvm::Type::getIntNTy(*mLLVMContext, 40);
635 case BfTypeCode_UInt40:
636 return llvm::Type::getIntNTy(*mLLVMContext, 40);
637 case BfTypeCode_Int48:
638 isSigned = true;
639 return llvm::Type::getIntNTy(*mLLVMContext, 48);
640 case BfTypeCode_UInt48:
641 return llvm::Type::getIntNTy(*mLLVMContext, 48);
642 case BfTypeCode_Int56:
643 isSigned = true;
644 return llvm::Type::getIntNTy(*mLLVMContext, 56);
645 case BfTypeCode_UInt56:

Callers 1

ToStringMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected