llvm.org GIT mirror llvm / bb811a2
Add X86 MMX type to bitcode and Type. (The Ada bindings probably need it too, but all the obvious places to change say "do not edit this file".) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113618 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 10 years ago
17 changed file(s) with 64 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
263263 return LLVMPPCFP128TypeInContext(Context);
264264 }
265265
266 /* llcontext -> lltype */
267 CAMLprim LLVMTypeRef llvm_x86mmx_type(LLVMContextRef Context) {
268 return LLVMX86MMXTypeInContext(Context);
269 }
270
266271 /*--... Operations on function types .......................................--*/
267272
268273 /* lltype -> lltype array -> lltype */
9393 TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa)
9494 TYPE_CODE_PPC_FP128= 15, // PPC LONG DOUBLE (2 doubles)
9595
96 TYPE_CODE_METADATA = 16 // METADATA
96 TYPE_CODE_METADATA = 16, // METADATA
97
98 TYPE_CODE_X86_MMX = 17 // X86 MMX
9799 };
98100
99101 // The type symbol table only has one code (TST_ENTRY_CODE).
8787 class x86_fp80 {};
8888 class fp128 {};
8989 class ppc_fp128 {};
90 // X86 MMX.
91 class x86_mmx {};
9092 } // namespace types
9193
9294 // LLVM doesn't have const or volatile types.
218220 public:
219221 static const Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
220222 };
223 template class TypeBuilder {
224 public:
225 static const Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
226 };
221227
222228 template class TypeBuilder {
223229 public:
7575 PPC_FP128TyID, ///< 5: 128 bit floating point type (two 64-bits)
7676 LabelTyID, ///< 6: Labels
7777 MetadataTyID, ///< 7: Metadata
78 X86_MMXTyID, ///< 8: MMX vectors (64 bits)
7879
7980 // Derived types... see DerivedTypes.h file...
8081 // Make sure FirstDerivedTyID stays up to date!!!
81 IntegerTyID, ///< 8: Arbitrary bit width integers
82 FunctionTyID, ///< 9: Functions
83 StructTyID, ///< 10: Structures
84 ArrayTyID, ///< 11: Arrays
85 PointerTyID, ///< 12: Pointers
86 OpaqueTyID, ///< 13: Opaque: type with unknown structure
87 VectorTyID, ///< 14: SIMD 'packed' format, or other vector type
82 IntegerTyID, ///< 9: Arbitrary bit width integers
83 FunctionTyID, ///< 10: Functions
84 StructTyID, ///< 11: Structures
85 ArrayTyID, ///< 12: Arrays
86 PointerTyID, ///< 13: Pointers
87 OpaqueTyID, ///< 14: Opaque: type with unknown structure
88 VectorTyID, ///< 15: SIMD 'packed' format, or other vector type
8889
8990 NumTypeIDs, // Must remain as last defined ID
90 LastPrimitiveTyID = MetadataTyID,
91 LastPrimitiveTyID = X86_MMXTyID,
9192 FirstDerivedTyID = IntegerTyID
9293 };
9394
211212 bool isFloatingPointTy() const { return ID == FloatTyID || ID == DoubleTyID ||
212213 ID == X86_FP80TyID || ID == FP128TyID || ID == PPC_FP128TyID; }
213214
215 /// isPPC_FP128Ty - Return true if this is X86 MMX.
216 bool isX86_MMXTy() const { return ID == X86_MMXTyID; }
217
214218 /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
215219 ///
216220 bool isFPOrFPVectorTy() const;
399403 static const Type *getX86_FP80Ty(LLVMContext &C);
400404 static const Type *getFP128Ty(LLVMContext &C);
401405 static const Type *getPPC_FP128Ty(LLVMContext &C);
406 static const Type *getX86_MMXTy(LLVMContext &C);
402407 static const IntegerType *getIntNTy(LLVMContext &C, unsigned N);
403408 static const IntegerType *getInt1Ty(LLVMContext &C);
404409 static const IntegerType *getInt8Ty(LLVMContext &C);
415420 static const PointerType *getX86_FP80PtrTy(LLVMContext &C, unsigned AS = 0);
416421 static const PointerType *getFP128PtrTy(LLVMContext &C, unsigned AS = 0);
417422 static const PointerType *getPPC_FP128PtrTy(LLVMContext &C, unsigned AS = 0);
423 static const PointerType *getX86_MMXPtrTy(LLVMContext &C, unsigned AS = 0);
418424 static const PointerType *getIntNPtrTy(LLVMContext &C, unsigned N,
419425 unsigned AS = 0);
420426 static const PointerType *getInt1PtrTy(LLVMContext &C, unsigned AS = 0);
203203 LLVMPointerTypeKind, /**< Pointers */
204204 LLVMOpaqueTypeKind, /**< Opaque: type with unknown structure */
205205 LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
206 LLVMMetadataTypeKind /**< Metadata */
206 LLVMMetadataTypeKind, /**< Metadata */
207 LLVMX86_MMXTypeKind /**< X86 MMX */
207208 } LLVMTypeKind;
208209
209210 typedef enum {
594594 TYPEKEYWORD("ppc_fp128", Type::getPPC_FP128Ty(Context));
595595 TYPEKEYWORD("label", Type::getLabelTy(Context));
596596 TYPEKEYWORD("metadata", Type::getMetadataTy(Context));
597 TYPEKEYWORD("x86_mmx", Type::getX86_MMXTy(Context));
597598 #undef TYPEKEYWORD
598599
599600 // Handle special forms for autoupgrading. Drop these in LLVM 3.0. This is
547547 break;
548548 case bitc::TYPE_CODE_METADATA: // METADATA
549549 ResultTy = Type::getMetadataTy(Context);
550 break;
551 case bitc::TYPE_CODE_X86_MMX: // X86_MMX
552 ResultTy = Type::getX86_MMXTy(Context);
550553 break;
551554 case bitc::TYPE_CODE_INTEGER: // INTEGER: [width]
552555 if (Record.size() < 1)
210210 case Type::LabelTyID: Code = bitc::TYPE_CODE_LABEL; break;
211211 case Type::OpaqueTyID: Code = bitc::TYPE_CODE_OPAQUE; break;
212212 case Type::MetadataTyID: Code = bitc::TYPE_CODE_METADATA; break;
213 case Type::X86_MMXTyID: Code = bitc::TYPE_CODE_X86_MMX; break;
213214 case Type::IntegerTyID:
214215 // INTEGER: [width]
215216 Code = bitc::TYPE_CODE_INTEGER;
513513 case Type::X86_FP80TyID:
514514 case Type::PPC_FP128TyID:
515515 case Type::FP128TyID: return Out << "long double " << NameSoFar;
516
516
517 case Type::X86_MMXTyID:
518 return printSimpleType(Out, Type::getInt32Ty(Ty->getContext()), isSigned,
519 " __attribute__((vector_size(64))) " + NameSoFar);
520
517521 case Type::VectorTyID: {
518522 const VectorType *VTy = cast(Ty);
519523 return printSimpleType(Out, VTy->getElementType(), isSigned,
357357 case Type::FloatTyID: return "Type::getFloatTy(mod->getContext())";
358358 case Type::DoubleTyID: return "Type::getDoubleTy(mod->getContext())";
359359 case Type::LabelTyID: return "Type::getLabelTy(mod->getContext())";
360 case Type::X86_MMXTyID: return "Type::getX86_MMXTy(mod->getContext())";
360361 default:
361362 error("Invalid primitive type");
362363 break;
460460 case Type::FloatTyID:
461461 return 32;
462462 case Type::DoubleTyID:
463 case Type::X86_MMXTyID:
463464 return 64;
464465 case Type::PPC_FP128TyID:
465466 case Type::FP128TyID:
197197 case Type::PPC_FP128TyID: OS << "ppc_fp128"; break;
198198 case Type::LabelTyID: OS << "label"; break;
199199 case Type::MetadataTyID: OS << "metadata"; break;
200 case Type::X86_MMXTyID: OS << "x86_mmx"; break;
200201 case Type::IntegerTyID:
201202 OS << 'i' << cast(Ty)->getBitWidth();
202203 break;
163163 return LLVMOpaqueTypeKind;
164164 case Type::VectorTyID:
165165 return LLVMVectorTypeKind;
166 case Type::X86_MMXTyID:
167 return LLVMX86_MMXTypeKind;
166168 }
167169 }
168170
231233 LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C) {
232234 return (LLVMTypeRef) Type::getPPC_FP128Ty(*unwrap(C));
233235 }
236 LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C) {
237 return (LLVMTypeRef) Type::getX86_MMXTy(*unwrap(C));
238 }
234239
235240 LLVMTypeRef LLVMFloatType(void) {
236241 return LLVMFloatTypeInContext(LLVMGetGlobalContext());
246251 }
247252 LLVMTypeRef LLVMPPCFP128Type(void) {
248253 return LLVMPPCFP128TypeInContext(LLVMGetGlobalContext());
254 }
255 LLVMTypeRef LLVMX86MMXType(void) {
256 return LLVMX86MMXTypeInContext(LLVMGetGlobalContext());
249257 }
250258
251259 /*--.. Operations on function types ........................................--*/
2525 X86_FP80Ty(C, Type::X86_FP80TyID),
2626 FP128Ty(C, Type::FP128TyID),
2727 PPC_FP128Ty(C, Type::PPC_FP128TyID),
28 X86_MMXTy(C, Type::X86_MMXTyID),
2829 Int1Ty(C, 1),
2930 Int8Ty(C, 8),
3031 Int16Ty(C, 16),
173173 const Type X86_FP80Ty;
174174 const Type FP128Ty;
175175 const Type PPC_FP128Ty;
176 const Type X86_MMXTy;
176177 const IntegerType Int1Ty;
177178 const IntegerType Int8Ty;
178179 const IntegerType Int16Ty;
108108 case PPC_FP128TyID : return getPPC_FP128Ty(C);
109109 case LabelTyID : return getLabelTy(C);
110110 case MetadataTyID : return getMetadataTy(C);
111 case X86_MMXTyID : return getX86_MMXTy(C);
111112 default:
112113 return 0;
113114 }
191192 case Type::X86_FP80TyID: return 80;
192193 case Type::FP128TyID: return 128;
193194 case Type::PPC_FP128TyID: return 128;
195 case Type::X86_MMXTyID: return 64;
194196 case Type::IntegerTyID: return cast(this)->getBitWidth();
195197 case Type::VectorTyID: return cast(this)->getBitWidth();
196198 default: return 0;
353355 return &C.pImpl->PPC_FP128Ty;
354356 }
355357
358 const Type *Type::getX86_MMXTy(LLVMContext &C) {
359 return &C.pImpl->X86_MMXTy;
360 }
361
356362 const IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) {
357363 return IntegerType::get(C, N);
358364 }
395401
396402 const PointerType *Type::getPPC_FP128PtrTy(LLVMContext &C, unsigned AS) {
397403 return getPPC_FP128Ty(C)->getPointerTo(AS);
404 }
405
406 const PointerType *Type::getX86_MMXPtrTy(LLVMContext &C, unsigned AS) {
407 return getX86_MMXTy(C)->getPointerTo(AS);
398408 }
399409
400410 const PointerType *Type::getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS) {
155155 case MVT::f80: return Type::getX86_FP80Ty(Context);
156156 case MVT::f128: return Type::getFP128Ty(Context);
157157 case MVT::ppcf128: return Type::getPPC_FP128Ty(Context);
158 case MVT::x86mmx: return Type::getX86_MMXTy(Context);
158159 case MVT::v2i8: return VectorType::get(Type::getInt8Ty(Context), 2);
159160 case MVT::v4i8: return VectorType::get(Type::getInt8Ty(Context), 4);
160161 case MVT::v8i8: return VectorType::get(Type::getInt8Ty(Context), 8);