llvm.org GIT mirror llvm / 3630e78
Add ABI information to ARM subtarget. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34245 91177308-0d34-0410-b5e6-96231b3b80d8 Lauro Ramos Venancio 13 years ago
4 changed file(s) with 25 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2525 , HasVFP2(false)
2626 , UseThumbBacktraces(false)
2727 , IsR9Reserved(false)
28 , stackAlignment(8)
29 , TargetType(isELF) { // Default to ELF unless otherwise specified.
28 , stackAlignment(4)
29 , TargetType(isELF) // Default to ELF unless otherwise specified.
30 , TargetABI(ARM_ABI_APCS) {
3031
3132 // Determine default and user specified characteristics
3233 std::string CPU = "generic";
4849 #endif
4950 }
5051
52 if (TT.find("eabi") != std::string::npos)
53 TargetABI = ARM_ABI_AAPCS;
54
55 if (isAAPCS_ABI())
56 stackAlignment = 8;
57
5158 if (isTargetDarwin()) {
5259 UseThumbBacktraces = true;
5360 IsR9Reserved = true;
54 stackAlignment = 4;
55 }
61 }
5662 }
4141
4242 /// IsR9Reserved - True if R9 is a not available as general purpose register.
4343 bool IsR9Reserved;
44
44
4545 /// stackAlignment - The minimum alignment known to hold of the stack frame on
4646 /// entry to the function and which must be maintained by every function.
4747 unsigned stackAlignment;
5050 enum {
5151 isELF, isDarwin
5252 } TargetType;
53
54 enum {
55 ARM_ABI_APCS,
56 ARM_ABI_AAPCS // ARM EABI
57 } TargetABI;
5358
5459 /// This constructor initializes the data members to match that
5560 /// of the specified module.
7075 bool isTargetDarwin() const { return TargetType == isDarwin; }
7176 bool isTargetELF() const { return TargetType == isELF; }
7277
78 bool isAPCS_ABI() const { return TargetABI == ARM_ABI_APCS; }
79 bool isAAPCS_ABI() const { return TargetABI == ARM_ABI_AAPCS; }
80
7381 bool isThumb() const { return IsThumb; }
7482
7583 bool useThumbBacktraces() const { return UseThumbBacktraces; }
3333 ///
3434 ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
3535 : Subtarget(M, FS),
36 DataLayout(Subtarget.isTargetDarwin() ?
36 DataLayout(Subtarget.isAPCS_ABI() ?
37 //APCS ABI
3738 (Subtarget.isThumb() ?
3839 std::string("e-p:32:32-d:32:32-l:32:32-s:16:32-b:8:32-B:8:32-A:32") :
3940 std::string("e-p:32:32-d:32:32-l:32:32")) :
41 //AAPCS ABI
4042 (Subtarget.isThumb() ?
41 std::string("e-p:32:32-d:32:64-l:64:64-s:16:32-b:8:32-B:8:32-A:32") :
42 std::string("e-p:32:32-d:32:64-l:64:64"))),
43 std::string("e-p:32:32-d:64:64-l:64:64-s:16:32-b:8:32-B:8:32-A:32") :
44 std::string("e-p:32:32-d:64:64-l:64:64"))),
4345 InstrInfo(Subtarget),
4446 FrameInfo(Subtarget) {}
4547
0 ; RUN: llvm-as < %s | llc -march=arm &&
1 ; RUN: llvm-as < %s | llc -mtriple=arm-linux | grep "mov r0, r2" | wc -l | grep 1 &&
1 ; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnueabi | grep "mov r0, r2" | wc -l | grep 1 &&
22 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep "mov r0, r1" | wc -l | grep 1
33
44 define i32 @f(i32 %a, i64 %b) {