@@ -112,15 +112,15 @@ extern "C" LLVM_C_ABI void LLVMInitializeX86Target() {
112112
113113static std::unique_ptr<TargetLoweringObjectFile> createTLOF (const Triple &TT) {
114114 if (TT.isOSBinFormatMachO ()) {
115- if (TT.getArch () == Triple::x86_64 )
115+ if (TT.isX86_64 () )
116116 return std::make_unique<X86_64MachoTargetObjectFile>();
117117 return std::make_unique<TargetLoweringObjectFileMachO>();
118118 }
119119
120120 if (TT.isOSBinFormatCOFF ())
121121 return std::make_unique<TargetLoweringObjectFileCOFF>();
122122
123- if (TT.getArch () == Triple::x86_64 )
123+ if (TT.isX86_64 () )
124124 return std::make_unique<X86_64ELFTargetObjectFile>();
125125 return std::make_unique<X86ELFTargetObjectFile>();
126126}
@@ -131,7 +131,7 @@ static std::string computeDataLayout(const Triple &TT) {
131131
132132 Ret += DataLayout::getManglingComponent (TT);
133133 // X86 and x32 have 32 bit pointers.
134- if (TT.getArch () != Triple::x86_64 || TT.isX32 ())
134+ if (TT.isX86_32 () || TT.isX32 ())
135135 Ret += " -p:32:32" ;
136136
137137 // Address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers.
@@ -140,7 +140,7 @@ static std::string computeDataLayout(const Triple &TT) {
140140 // Some ABIs align 64 bit integers and doubles to 64 bits, others to 32.
141141 // 128 bit integers are not specified in the 32-bit ABIs but are used
142142 // internally for lowering f128, so we match the alignment to that.
143- if (TT.getArch () == Triple::x86_64 || TT.isOSWindows ())
143+ if (TT.isX86_64 () || TT.isOSWindows ())
144144 Ret += " -i64:64-i128:128" ;
145145 else if (TT.isOSIAMCU ())
146146 Ret += " -i64:32-f64:32" ;
@@ -150,8 +150,7 @@ static std::string computeDataLayout(const Triple &TT) {
150150 // Some ABIs align long double to 128 bits, others to 32.
151151 if (TT.isOSIAMCU ())
152152 ; // No f80
153- else if (TT.getArch () == Triple::x86_64 || TT.isOSDarwin () ||
154- TT.isWindowsMSVCEnvironment ())
153+ else if (TT.isX86_64 () || TT.isOSDarwin () || TT.isWindowsMSVCEnvironment ())
155154 Ret += " -f80:128" ;
156155 else
157156 Ret += " -f80:32" ;
@@ -160,13 +159,13 @@ static std::string computeDataLayout(const Triple &TT) {
160159 Ret += " -f128:32" ;
161160
162161 // The registers can hold 8, 16, 32 or, in x86-64, 64 bits.
163- if (TT.getArch () == Triple::x86_64 )
162+ if (TT.isX86_64 () )
164163 Ret += " -n8:16:32:64" ;
165164 else
166165 Ret += " -n8:16:32" ;
167166
168167 // The stack is aligned to 32 bits on some ABIs and 128 bits on others.
169- if ((TT.getArch () != Triple::x86_64 && TT.isOSWindows ()) || TT.isOSIAMCU ())
168+ if ((TT.isX86_32 () && TT.isOSWindows ()) || TT.isOSIAMCU ())
170169 Ret += " -a:0:32-S32" ;
171170 else
172171 Ret += " -S128" ;
@@ -176,7 +175,7 @@ static std::string computeDataLayout(const Triple &TT) {
176175
177176static Reloc::Model getEffectiveRelocModel (const Triple &TT, bool JIT,
178177 std::optional<Reloc::Model> RM) {
179- bool is64Bit = TT.getArch () == Triple::x86_64 ;
178+ bool is64Bit = TT.isX86_64 () ;
180179 if (!RM) {
181180 // JIT codegen should use static relocations by default, since it's
182181 // typically executed in process and not relocatable.
@@ -218,7 +217,7 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT, bool JIT,
218217static CodeModel::Model
219218getEffectiveX86CodeModel (const Triple &TT, std::optional<CodeModel::Model> CM,
220219 bool JIT) {
221- bool Is64Bit = TT.getArch () == Triple::x86_64 ;
220+ bool Is64Bit = TT.isX86_64 () ;
222221 if (CM) {
223222 if (*CM == CodeModel::Tiny)
224223 reportFatalUsageError (" target does not support the tiny CodeModel" );
@@ -489,7 +488,7 @@ void X86PassConfig::addIRPasses() {
489488 // Add Control Flow Guard checks.
490489 const Triple &TT = TM->getTargetTriple ();
491490 if (TT.isOSWindows ()) {
492- if (TT.getArch () == Triple::x86_64 ) {
491+ if (TT.isX86_64 () ) {
493492 addPass (createCFGuardDispatchPass ());
494493 } else {
495494 addPass (createCFGuardCheckPass ());
@@ -548,7 +547,7 @@ bool X86PassConfig::addILPOpts() {
548547bool X86PassConfig::addPreISel () {
549548 // Only add this pass for 32-bit x86 Windows.
550549 const Triple &TT = TM->getTargetTriple ();
551- if (TT.isOSWindows () && TT.getArch () == Triple::x86 )
550+ if (TT.isOSWindows () && TT.isX86_32 () )
552551 addPass (createX86WinEHStatePass ());
553552 return true ;
554553}
@@ -637,7 +636,7 @@ void X86PassConfig::addPreEmitPass2() {
637636
638637 // Insert extra int3 instructions after trailing call instructions to avoid
639638 // issues in the unwinder.
640- if (TT.isOSWindows () && TT.getArch () == Triple::x86_64 )
639+ if (TT.isOSWindows () && TT.isX86_64 () )
641640 addPass (createX86AvoidTrailingCallPass ());
642641
643642 // Verify basic block incoming and outgoing cfa offset and register values and
@@ -674,7 +673,7 @@ void X86PassConfig::addPreEmitPass2() {
674673
675674 // Analyzes and emits pseudos to support Win x64 Unwind V2. This pass must run
676675 // after all real instructions have been added to the epilog.
677- if (TT.isOSWindows () && ( TT.getArch () == Triple::x86_64 ))
676+ if (TT.isOSWindows () && TT.isX86_64 ( ))
678677 addPass (createX86WinEHUnwindV2Pass ());
679678}
680679
0 commit comments