llvm.org GIT mirror llvm / 55a7ec3
Honor the command line specification for machine type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32483 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 13 years ago
4 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
8080 /// Set the CPU string. Replaces previous setting. Setting to "" clears CPU.
8181 void setCPU(const std::string &String);
8282
83 /// Get the CPU string.
84 const std::string &getCPU() const { return Features[0]; }
85
8386 /// Setting CPU string only if no string is set.
8487 void setCPUIfNone(const std::string &String);
8588
1313 #ifndef LLVM_TARGET_TARGETSUBTARGET_H
1414 #define LLVM_TARGET_TARGETSUBTARGET_H
1515
16 #include
17
1618 namespace llvm {
1719
1820 //===----------------------------------------------------------------------===//
2426 class TargetSubtarget {
2527 TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT
2628 void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT
29 std::string CPU; // CPU name.
2730 protected: // Can only create subclasses...
2831 TargetSubtarget();
2932 public:
3033 virtual ~TargetSubtarget();
34 void setCPU(const std::string &C) { CPU = C; }
35 const std::string &getCPU() const { return CPU; }
3136 };
3237
3338 } // End llvm namespace
541541
542542
543543 bool DarwinAsmPrinter::doInitialization(Module &M) {
544 if (Subtarget.isGigaProcessor())
544 const std::string &CPU = Subtarget.getCPU();
545
546 if (CPU != "generic")
547 O << "\t.machine ppc" << CPU << "\n";
548 else if (Subtarget.isGigaProcessor())
545549 O << "\t.machine ppc970\n";
550 else if (Subtarget.isPPC64())
551 O << "\t.machine ppc64\n";
552 else if (Subtarget.hasAltivec())
553 O << "\t.machine ppc7400\n";
554 else
555 O << "\t.machine ppc\n";
556
546557 AsmPrinter::doInitialization(M);
547558
548559 // Darwin wants symbols to be quoted if they have complex names.
459459 " const std::string &CPU) {\n"
460460 " SubtargetFeatures Features(FS);\n"
461461 " Features.setCPUIfNone(CPU);\n"
462 " setCPU(Features.getCPU());\n"
462463 " uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n"
463464 " FeatureKV, FeatureKVSize);\n";
464465