Remove current_block field of CodegenCx
This field often had the wrong value when using multiple builders at the same time.
This commit is contained in:
parent
07afdb8c0d
commit
62e9b50f8d
@ -379,9 +379,7 @@ impl<'gcc, 'tcx> BackendTypes for Builder<'_, 'gcc, 'tcx> {
|
||||
|
||||
impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||
fn build(cx: &'a CodegenCx<'gcc, 'tcx>, block: Block<'gcc>) -> Self {
|
||||
let bx = Builder::with_cx(cx, block);
|
||||
*cx.current_block.borrow_mut() = Some(block);
|
||||
bx
|
||||
Builder::with_cx(cx, block)
|
||||
}
|
||||
|
||||
fn llbb(&self) -> Block<'gcc> {
|
||||
@ -399,7 +397,6 @@ fn append_sibling_block(&mut self, name: &str) -> Block<'gcc> {
|
||||
}
|
||||
|
||||
fn switch_to_block(&mut self, block: Self::BasicBlock) {
|
||||
*self.cx.current_block.borrow_mut() = Some(block);
|
||||
self.block = block;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,7 @@ pub struct CodegenCx<'gcc, 'tcx> {
|
||||
pub codegen_unit: &'tcx CodegenUnit<'tcx>,
|
||||
pub context: &'gcc Context<'gcc>,
|
||||
|
||||
// TODO(antoyo): First set it to a dummy block to avoid using Option?
|
||||
pub current_block: RefCell<Option<Block<'gcc>>>,
|
||||
// TODO(bjorn3): First set it to a dummy function to avoid using Option?
|
||||
pub current_func: RefCell<Option<Function<'gcc>>>,
|
||||
pub normal_function_addresses: RefCell<FxHashSet<RValue<'gcc>>>,
|
||||
|
||||
@ -177,7 +176,6 @@ pub fn new(context: &'gcc Context<'gcc>, codegen_unit: &'tcx CodegenUnit<'tcx>,
|
||||
check_overflow,
|
||||
codegen_unit,
|
||||
context,
|
||||
current_block: RefCell::new(None),
|
||||
current_func: RefCell::new(None),
|
||||
normal_function_addresses: Default::default(),
|
||||
functions: RefCell::new(functions),
|
||||
|
Loading…
Reference in New Issue
Block a user