|
8 | 8 |
|
9 | 9 | #include "ABIInfoImpl.h" |
10 | 10 | #include "TargetInfo.h" |
| 11 | +#include "llvm/IR/DerivedTypes.h" |
11 | 12 |
|
12 | 13 | using namespace clang; |
13 | 14 | using namespace clang::CodeGen; |
@@ -336,10 +337,6 @@ Address HexagonABIInfo::EmitVAArgForHexagonLinux(CodeGenFunction &CGF, |
336 | 337 | // Implement the block where argument is in register saved area |
337 | 338 | CGF.EmitBlock(InRegBlock); |
338 | 339 |
|
339 | | - llvm::Type *PTy = CGF.ConvertType(Ty); |
340 | | - llvm::Value *__saved_reg_area_p = CGF.Builder.CreateBitCast( |
341 | | - __current_saved_reg_area_pointer, llvm::PointerType::getUnqual(PTy)); |
342 | | - |
343 | 340 | CGF.Builder.CreateStore(__new_saved_reg_area_pointer, |
344 | 341 | __current_saved_reg_area_pointer_p); |
345 | 342 |
|
@@ -388,22 +385,16 @@ Address HexagonABIInfo::EmitVAArgForHexagonLinux(CodeGenFunction &CGF, |
388 | 385 | CGF.Builder.CreateStore(__new_overflow_area_pointer, |
389 | 386 | __current_saved_reg_area_pointer_p); |
390 | 387 |
|
391 | | - // Bitcast the overflow area pointer to the type of argument. |
392 | | - llvm::Type *OverflowPTy = CGF.ConvertTypeForMem(Ty); |
393 | | - llvm::Value *__overflow_area_p = CGF.Builder.CreateBitCast( |
394 | | - __overflow_area_pointer, llvm::PointerType::getUnqual(OverflowPTy)); |
395 | | - |
396 | 388 | CGF.EmitBranch(ContBlock); |
397 | | - |
398 | 389 | // Get the correct pointer to load the variable argument |
399 | 390 | // Implement the ContBlock |
400 | 391 | CGF.EmitBlock(ContBlock); |
401 | 392 |
|
402 | 393 | llvm::Type *MemTy = CGF.ConvertTypeForMem(Ty); |
403 | | - llvm::Type *MemPTy = llvm::PointerType::getUnqual(MemTy); |
404 | | - llvm::PHINode *ArgAddr = CGF.Builder.CreatePHI(MemPTy, 2, "vaarg.addr"); |
405 | | - ArgAddr->addIncoming(__saved_reg_area_p, InRegBlock); |
406 | | - ArgAddr->addIncoming(__overflow_area_p, OnStackBlock); |
| 394 | + llvm::PHINode *ArgAddr = CGF.Builder.CreatePHI( |
| 395 | + llvm::PointerType::getUnqual(MemTy->getContext()), 2, "vaarg.addr"); |
| 396 | + ArgAddr->addIncoming(__new_saved_reg_area_pointer, InRegBlock); |
| 397 | + ArgAddr->addIncoming(__overflow_area_pointer, OnStackBlock); |
407 | 398 |
|
408 | 399 | return Address(ArgAddr, MemTy, CharUnits::fromQuantity(ArgAlign)); |
409 | 400 | } |
|
0 commit comments