OLD | NEW |
1 //===-- pnacl-llc.cpp - PNaCl-specific llc: pexe ---> nexe ---------------===// | 1 //===-- pnacl-llc.cpp - PNaCl-specific llc: pexe ---> nexe ---------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // pnacl-llc: the core of the PNaCl translator, compiling a pexe into a nexe. | 10 // pnacl-llc: the core of the PNaCl translator, compiling a pexe into a nexe. |
(...skipping 187 matching lines...) Loading... |
198 case TargetMachine::CGFT_AssemblyFile: | 198 case TargetMachine::CGFT_AssemblyFile: |
199 break; | 199 break; |
200 case TargetMachine::CGFT_ObjectFile: | 200 case TargetMachine::CGFT_ObjectFile: |
201 case TargetMachine::CGFT_Null: | 201 case TargetMachine::CGFT_Null: |
202 Binary = true; | 202 Binary = true; |
203 break; | 203 break; |
204 } | 204 } |
205 | 205 |
206 // Open the file. | 206 // Open the file. |
207 std::string error; | 207 std::string error; |
208 unsigned OpenFlags = 0; | 208 sys::fs::OpenFlags OpenFlags = sys::fs::F_None; |
209 if (Binary) OpenFlags |= raw_fd_ostream::F_Binary; | 209 if (Binary) |
| 210 OpenFlags |= sys::fs::F_Binary; |
210 OwningPtr<tool_output_file> FDOut( | 211 OwningPtr<tool_output_file> FDOut( |
211 new tool_output_file(Filename.c_str(), error, OpenFlags)); | 212 new tool_output_file(Filename.c_str(), error, OpenFlags)); |
212 if (!error.empty()) { | 213 if (!error.empty()) { |
213 errs() << error << '\n'; | 214 errs() << error << '\n'; |
214 return 0; | 215 return 0; |
215 } | 216 } |
216 | 217 |
217 return FDOut.take(); | 218 return FDOut.take(); |
218 } | 219 } |
219 #endif // !defined(__native_client__) | 220 #endif // !defined(__native_client__) |
(...skipping 375 matching lines...) Loading... |
595 const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple, | 596 const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple, |
596 Error); | 597 Error); |
597 if (!TheTarget) { | 598 if (!TheTarget) { |
598 errs() << ProgramName << ": " << Error; | 599 errs() << ProgramName << ": " << Error; |
599 return 1; | 600 return 1; |
600 } | 601 } |
601 | 602 |
602 TargetOptions Options; | 603 TargetOptions Options; |
603 Options.LessPreciseFPMADOption = EnableFPMAD; | 604 Options.LessPreciseFPMADOption = EnableFPMAD; |
604 Options.NoFramePointerElim = DisableFPElim; | 605 Options.NoFramePointerElim = DisableFPElim; |
605 Options.NoFramePointerElimNonLeaf = DisableFPElimNonLeaf; | |
606 Options.AllowFPOpFusion = FuseFPOps; | 606 Options.AllowFPOpFusion = FuseFPOps; |
607 Options.UnsafeFPMath = EnableUnsafeFPMath; | 607 Options.UnsafeFPMath = EnableUnsafeFPMath; |
608 Options.NoInfsFPMath = EnableNoInfsFPMath; | 608 Options.NoInfsFPMath = EnableNoInfsFPMath; |
609 Options.NoNaNsFPMath = EnableNoNaNsFPMath; | 609 Options.NoNaNsFPMath = EnableNoNaNsFPMath; |
610 Options.HonorSignDependentRoundingFPMathOption = | 610 Options.HonorSignDependentRoundingFPMathOption = |
611 EnableHonorSignDependentRoundingFPMath; | 611 EnableHonorSignDependentRoundingFPMath; |
612 Options.UseSoftFloat = GenerateSoftFloatCalls; | 612 Options.UseSoftFloat = GenerateSoftFloatCalls; |
613 if (FloatABIForCalls != FloatABI::Default) | 613 if (FloatABIForCalls != FloatABI::Default) |
614 Options.FloatABIType = FloatABIForCalls; | 614 Options.FloatABIType = FloatABIForCalls; |
615 Options.NoZerosInBSS = DontPlaceZerosInBSS; | 615 Options.NoZerosInBSS = DontPlaceZerosInBSS; |
616 Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; | 616 Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; |
617 Options.DisableTailCalls = DisableTailCalls; | 617 Options.DisableTailCalls = DisableTailCalls; |
618 Options.StackAlignmentOverride = OverrideStackAlignment; | 618 Options.StackAlignmentOverride = OverrideStackAlignment; |
619 Options.RealignStack = EnableRealignStack; | |
620 Options.TrapFuncName = TrapFuncName; | 619 Options.TrapFuncName = TrapFuncName; |
621 Options.PositionIndependentExecutable = EnablePIE; | 620 Options.PositionIndependentExecutable = EnablePIE; |
622 Options.EnableSegmentedStacks = SegmentedStacks; | 621 Options.EnableSegmentedStacks = SegmentedStacks; |
623 Options.UseInitArray = UseInitArray; | 622 Options.UseInitArray = UseInitArray; |
624 Options.SSPBufferSize = SSPBufferSize; | |
625 | 623 |
626 if (GenerateSoftFloatCalls) | 624 if (GenerateSoftFloatCalls) |
627 FloatABIForCalls = FloatABI::Soft; | 625 FloatABIForCalls = FloatABI::Soft; |
628 | 626 |
629 // Package up features to be passed to target/subtarget | 627 // Package up features to be passed to target/subtarget |
630 std::string FeaturesStr; | 628 std::string FeaturesStr; |
631 if (MAttrs.size()) { | 629 if (MAttrs.size()) { |
632 SubtargetFeatures Features; | 630 SubtargetFeatures Features; |
633 for (unsigned i = 0; i != MAttrs.size(); ++i) | 631 for (unsigned i = 0; i != MAttrs.size(); ++i) |
634 Features.AddFeature(MAttrs[i]); | 632 Features.AddFeature(MAttrs[i]); |
(...skipping 46 matching lines...) Loading... |
681 return 0; | 679 return 0; |
682 } | 680 } |
683 | 681 |
684 int main(int argc, char **argv) { | 682 int main(int argc, char **argv) { |
685 #if defined(__native_client__) | 683 #if defined(__native_client__) |
686 return srpc_main(argc, argv); | 684 return srpc_main(argc, argv); |
687 #else | 685 #else |
688 return llc_main(argc, argv); | 686 return llc_main(argc, argv); |
689 #endif // __native_client__ | 687 #endif // __native_client__ |
690 } | 688 } |
OLD | NEW |