aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2021-12-16 15:29:26 +0100
committerNikita Popov <npopov@redhat.com>2021-12-16 15:31:55 +0100
commita0cf066eac8aa55782a6dd2deb90adc89a707a8b (patch)
treeb7f45115ba14d54e7f68f4c2b7979c20af7c034e /clang/lib/CodeGen/CodeGenFunction.h
parent3b35113ff0963c536a19b4950b5b99aca2e02372 (diff)
downloadllvm-a0cf066eac8aa55782a6dd2deb90adc89a707a8b.zip
llvm-a0cf066eac8aa55782a6dd2deb90adc89a707a8b.tar.gz
llvm-a0cf066eac8aa55782a6dd2deb90adc89a707a8b.tar.bz2
[CodeGen] Store element type in ParamValue
ParamValue is basically a union between an Address and a Value*. To be able to reconstruct the Address, we now need to store the pointer element type.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 411a36a..679c720 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3130,15 +3130,18 @@ public:
class ParamValue {
llvm::Value *Value;
+ llvm::Type *ElementType;
unsigned Alignment;
- ParamValue(llvm::Value *V, unsigned A) : Value(V), Alignment(A) {}
+ ParamValue(llvm::Value *V, llvm::Type *T, unsigned A)
+ : Value(V), ElementType(T), Alignment(A) {}
public:
static ParamValue forDirect(llvm::Value *value) {
- return ParamValue(value, 0);
+ return ParamValue(value, nullptr, 0);
}
static ParamValue forIndirect(Address addr) {
assert(!addr.getAlignment().isZero());
- return ParamValue(addr.getPointer(), addr.getAlignment().getQuantity());
+ return ParamValue(addr.getPointer(), addr.getElementType(),
+ addr.getAlignment().getQuantity());
}
bool isIndirect() const { return Alignment != 0; }
@@ -3151,7 +3154,7 @@ public:
Address getIndirectAddress() const {
assert(isIndirect());
- return Address(Value, CharUnits::fromQuantity(Alignment));
+ return Address(Value, ElementType, CharUnits::fromQuantity(Alignment));
}
};